Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 fx.practic, 10-15-2013, 12:53 AM
        5 responses
        5,404 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by Shai Samuel, 07-02-2022, 02:46 PM
        4 responses
        95 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by DJ888, Yesterday, 10:57 PM
        0 responses
        8 views
        0 likes
        Last Post DJ888
        by DJ888
         
        Started by MacDad, 02-25-2024, 11:48 PM
        7 responses
        159 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Yesterday, 09:29 PM
        0 responses
        8 views
        0 likes
        Last Post Belfortbucks  
        Working...
        X