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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      111 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      156 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      76 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      125 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      79 views
      0 likes
      Last Post PaulMohn  
      Working...
      X