Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color band

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

    Color band

    Hi, I want to create a colored band using an EMA ... basically, take 5 ticks on both sides of the EMA and color is red when falling and green when rising. Got the 'falling' and 'rising' down, but now sure how to fill in the band with a color. Can you direct me to a resource that can help. thanks!

    #2
    Hello pman777,
    You can use the DrawRegion method to color a band around the MA. A sample code will be like:
    Code:
    if (CurrentBar > 1) DrawRegion("tag" + CurrentBar , 0, 1, SMA(14), SMA(14)[0] + 5 * TickSize , Color.Transparent, Color.Blue, 3);
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      OK ... I'm doing something wrong but cannot see it. Maybe you canhelp me. when compiling, I'm getting a CS1502 error message. This error can occur when you pass in incorrect parameter object types into a method such as an indicator.

      DrawRegion("tag1", CurrentBar , 0, EMA(160)[0], (EMA(160)[0] + (6* TickSize)) , Color.Transparent, Color.LightGreen, 3);

      Comment


        #4
        Hello pman777,
        The best overload for a draw region is
        • 2 IDataSeries
        • I IDataSereis and 1 double


        You have assigned 2 double and thus you are getting the error. Please modify your code as below and see if you can get it work.
        Code:
        DrawRegion("tag1", CurrentBar , 0,[B] EMA(160)[/B], (EMA(160)[0] + (6* TickSize)) , Color.Transparent, Color.LightGreen, 3);
        JoydeepNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        571 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        331 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        549 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        550 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X