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

Session High Low - New Bar Type

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

    Session High Low - New Bar Type

    Hi everyone,

    I've been working on creating a new bar type recently and have been running into an issue with figuring out how to get the session high and low without just looping through every candle.

    My plan is to have what is essentially a renko with a variable tick size based on the high and low of the previous session. so by doing this each renko would have a different size depending on what the price was exactly 24 hours prior.

    What I need to be able to do is get the MAX and MIN from the 24 hour period but unfortunately MAX[bars.GetBar(DateTime.Now.AddHours(-24))] and MIN[bars.GetBar(DateTime.Now.AddHours(-24))] doesn't work because the candle type can't see an indicator that gets drawn FROM the chart data itself.

    I thought I'd come here to see if anyone has some ideas before I forge ahead in an inefficient way.

    #2
    Hello,

    Thank you for the post.

    Generally getting the session high and low would require a greater scope such as an indicator. BarsTypes are generally used only for basic bar creation and as you have noted there is no access to the Indicators in this scope.

    From a BarsType specifically, this is something you would need to likely collect yourself using logic contained in the BarsType. In respect to NT7 there is not really any sample or solution I could provide here as BarsTypes were not documented or supported in NT7.

    Alternatively, this would need to be done from an Indicator. An Indicator could be used for its Plot override to render bars on the chart from data on the chart.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Understood.
      So in that case my question revolves around the barstypes themselves. Would I be able to create a global variable inside of the barstype that would carry over so that it exists for when the next bar is created?

      If so I can store the two required variables and use those to generate my range.

      Comment


        #4
        Hello,

        I would suggest looking at how the standard barstypes in the @BarsTypes.cs file to give you a good idea of how a BarsType is intended to be created. You can try to use variables at the class level similar to the renko but as there are no guidelines here it would really require that you test the idea and see if it works as you expect. Depending on your logic you may be able to utilize class level variables to store data.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by BarzTrading, Today, 07:25 AM
        2 responses
        24 views
        1 like
        Last Post BarzTrading  
        Started by devatechnologies, 04-14-2024, 02:58 PM
        3 responses
        20 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by tkaboris, Today, 08:01 AM
        0 responses
        4 views
        0 likes
        Last Post tkaboris  
        Started by EB Worx, 04-04-2023, 02:34 AM
        7 responses
        163 views
        0 likes
        Last Post VFI26
        by VFI26
         
        Started by Mizzouman1, Today, 07:35 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X