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 Jon17, Today, 04:33 PM
        0 responses
        1 view
        0 likes
        Last Post Jon17
        by Jon17
         
        Started by Javierw.ok, Today, 04:12 PM
        0 responses
        5 views
        0 likes
        Last Post Javierw.ok  
        Started by timmbbo, Today, 08:59 AM
        2 responses
        10 views
        0 likes
        Last Post bltdavid  
        Started by alifarahani, Today, 09:40 AM
        6 responses
        41 views
        0 likes
        Last Post alifarahani  
        Started by Waxavi, Today, 02:10 AM
        1 response
        20 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Working...
        X