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

Adding secondary Bars object doesn't work for AddRenko, AddPointAndFigure, etc.

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

    Adding secondary Bars object doesn't work for AddRenko, AddPointAndFigure, etc.

    So I finally got to coverting my old NT7 strategies to NT8 (great platform!) and I came across this snag.

    In NT7 I was able to add a secondary bar type during Initialize like so:

    Code:
    AddLineBreak(Instrument.FullName,PeriodType.Minute, TimeFrame2,3,MarketDataType.Last); //BarsArray[1]
    In NT8, according to the help docs, I no longer can use Instrument.FullName, and I have to hard code the symbol?

    From the help doc on AddDataSeries...


    Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input).
    But I tried it anyway, being who I am, and using Instrument.FullName as a parameter actually works! But ONLY during a Standard execution of the strategy. When you try to optimize it you get the following error in the log:

    Error on calling 'OnStateChange' method: Object reference not set to instance of an object.
    I'm guessing there is some engineering reason behind this behavior, so I'm willing to accept it as it is, but is there any work around for trying to achieve what I'm trying to do here? Why can't this behave just like a regular AddDataSeries() method?

    I've attached an example strategy based on the SampleMultiTimeFrame called SampleMultiTimeFramePnF which attempts to add a secondary Point and Figure data series, just in case anyone wants to give it a go. Standard back test works, but optimization fails with the above error.






    Attached Files

    #2
    Hello dave416,

    You are correct, this was not supported NinjaTrader 7 as it could cause issues with optimizations and can cause more extensive issues with NinjaTrader 8.

    I will submit a feature request on your behalf for the development to consider allowing dynamic handling / loading of additional Data Series

    Once I have a tracking ID for this I will post in this thread for future reference.


    The cumbersome workaround is using a BarsRequest and doing all calculations in the script (meaning the data called from a BarsRequest cannot be supplied to an indicator calls as the input series.

    Below is a public link to the help guide on BarsRequest.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea, I was afraid that would be the answer, so I started to migrate the @PointAndFigureBarsType code over to an indicator. I finished it today and It works quite well, but ya it would be nice to have any type of bar supported in strategies without having to hardcode symbols. Thanks for following up and offering the feature request!

      Comment


        #4
        Hello dave416,

        I have received tracking ID #SFT-882 for this request to allow dynamic handling / loading of additional Data Series.

        Please note it is up to the NinjaTrader Development to decide if or when any request will be implemented.

        We appreciate your input on this.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by helpwanted, Today, 03:06 AM
        1 response
        5 views
        0 likes
        Last Post sarafuenonly123  
        Started by Brevo, Today, 01:45 AM
        0 responses
        7 views
        0 likes
        Last Post Brevo
        by Brevo
         
        Started by aussugardefender, Today, 01:07 AM
        0 responses
        5 views
        0 likes
        Last Post aussugardefender  
        Started by pvincent, 06-23-2022, 12:53 PM
        14 responses
        242 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by TraderG23, 12-08-2023, 07:56 AM
        9 responses
        384 views
        1 like
        Last Post Gavini
        by Gavini
         
        Working...
        X