Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BackColor & alerts based on orders entered

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BackColor & alerts based on orders entered

    Hi - a short time ago, you kindly showed me how to code strategies using rising/falling conditions and EnterShortStopLimit to enter trades. This is working very well. Thank you.

    What I would like to be able to do now is have a chart which places one color on the chart (using 'BackColor') for when long trades are in progress and another color for short trades.

    Is this possible and I'd be very grateful for your explanation as to how to proceed.

    Moreover, would it be possible to have alerts sound, i.e. sound files I could make or choose (besides the usual "order entered", etc.) whenever trades are entered?

    Roughly, the coding looks like this:

    if (Rising(...) == true)
    {
    EnterLongStopLimit(0, true, 1, Close[0] + 10 * TickSize, Close[0] + 10 * TickSize, "BuyStop");

    if (Falling(...) == true)
    {
    EnterShortStopLimit(0, true, 1, Close[0] - 10 * TickSize, Close[0] - 10 * TickSize, "SellStop");

    Many thanks in advance.

    Arbuthnot

    #2
    Hello Arbuthnot,

    Thank you for your note.

    You could create a separate if statement to check when you are long and color the background accordingly.

    if (Position.MarketPosition == MarketPosition.Long)
    {
    BackColor = Color.PaleGreen;
    }

    This example will check your MarketPosition and then the following action will be to change the background color.

    MarketPosition


    BackColor()
    CameronNinjaTrader Customer Service

    Comment


      #3
      That's great, Cameron. I've done as you suggested and the trades show up perfectly.

      Much obliged.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      67 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      36 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      59 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      62 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X