Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator development-Draw region syntax and Time

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

    indicator development-Draw region syntax and Time

    developing an indicator with multiple moving averages. I need to know how to reference time at the exact point when EMA 20 and EMA 60 intersect. So I can use that in a draw region syntax to draw color .

    Draw Region Syntax:

    DrawRegion(string tag, DateTime startTime, DateTime endTime, IDataSeries series1, IDataSeries series2, Color outlineColor, Color areaColor, int areaOpacity)

    I included a chart.. that shows that when 2 lines intersect the region before the intersection. the color bleed over.

    do you have any suggestions or do you have any questions so I can clarify.

    Regards,
    George
    Attached Files

    #2
    Hi traderfolife777,

    DrawRegion uses bars as the end points. The cross happens mid bar.

    You can choose to add or subtract a bar, but there is not a way to get it perfect.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      thank you for your reply.

      How would I add or subtract a bar from calculation. what is the syntax I need to use to get this accomplished.

      Comment


        #4
        Hello traderfolife777,

        In the DrawRegion are you using a date time value or a bars ago value?

        If you are using a bars ago value, use variableName-1 to subtract 1 from the value.

        If you are using a datetime value, I recommend you use Bars.GetBar() to get the bar number and then use CurrentBar-Bars.GetBar(DateTime)-1.

        http://www.ninjatrader.com/support/h...nt7/getbar.htm
        Chelsea B.NinjaTrader 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
        549 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X