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 SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        38 views
        0 likes
        Last Post SalmaTrader  
        Started by CarlTrading, 07-05-2026, 01:16 PM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 06-17-2026, 10:32 AM
        0 responses
        14 views
        0 likes
        Last Post CaptainJack  
        Started by kinfxhk, 06-17-2026, 04:15 AM
        0 responses
        20 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 06-17-2026, 04:06 AM
        0 responses
        22 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Working...
        X