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 sjsj2732, Yesterday, 04:31 AM
        0 responses
        27 views
        0 likes
        Last Post sjsj2732  
        Started by NullPointStrategies, 03-13-2026, 05:17 AM
        0 responses
        283 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        280 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        131 views
        1 like
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        90 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Working...
        X