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 argusthome, 03-08-2026, 10:06 AM
      0 responses
      116 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      61 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      40 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      44 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      82 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X