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

MaximumBarsLookBack

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

    MaximumBarsLookBack

    Hi,

    I would like to apply my strategy for extend periods instead of only 7 days (since I'm using Renko bars). So, I changed the following line:
    From
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    To
    MaximumBarsLookBack = MaximumBarsLookBack.Infinite;

    However, the strategy still gets Disabled when I try to apply it with longer data range (over than 7 days). Is there a way to overcome this?


    Thanks..

    #2
    Hello Abdullah_KSA,

    Thank you for your note.

    MaximumBarsLookback doesn't control how long your strategy can process for. It determines memory performance of custom Series<T> objects (such as Series<double>, Series<long>, etc.). When using MaximumBarsLookBack.TwoHundredFiftySix, only the last 256 values of the series object will be stored in memory and be accessible for reference. This results in significant memory savings when using multiple series objects over using MaximumBarsLookback.Infinite.

    Strategies will by default be disabled when there is a disconnection. Most data providers have at least a weekly disconnect for maintenance. Do you see this occurring when running the strategy on real time data, or on historical data? If on real time data, does setting Tools > Options > Strategies > Connection Loss to "Keep Running" seem to work to keep the strategy running during a maintenance disconnection?

    If this is in reference to trying to run the strategy over historical data, I would not expect it to stop after 7 days unless it is hitting an error. If this is the case, are there any errors regarding the strategy in the Control Center Log tab when trying to apply the strategy to a chart?

    Thanks in advance; I look forward to assisting you further.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thank you, Kate
      When applying over than 7 days, the following error message appears in my log:
      Strategy 'ABD1K200Time5': Error on calling 'OnBarUpdate' method on bar 3: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
      This looks as a Pharaonic symbols to me
      Any simple ideas to fix that?

      I'd like to add that when I change the Data series type to anything else (such as bars) rather than ninZaRenko, it works just fine (I can go back even for 12 months)
      Last edited by Abdullah_KSA; 02-19-2021, 09:45 AM.

      Comment


        #4
        Hello Abdullah_KSA,

        Thank you for your reply.

        We would generally see this if the script is trying to access data for a bar before that number of bars has passed.

        These types of issue are best dealt with by debugging your script with print statements. You would use print statements to see when and where the error is occurring. Debugging is tedious and time-consuming, but it is the only way to ensure you understand what data the code is working with and making decisions upon. Please review our debugging tips here: https://ninjatrader.com/support/help...script_cod.htm

        This forum post goes into great detail on how to use prints to help figure out where issues may stem from — this should get you going in the correct direction. You can even add these using the Strategy Builder.

        https://ninjatrader.com/support/foru...ns-not-working

        Since it works with the built in bar types, but not this specific custom type, you might also contact the vendor of the custom bar type to see if they could offer any advice.

        Thanks in advance; I look forward to assisting you further.
        Kate W.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by FrazMann, Today, 11:21 AM
        0 responses
        1 view
        0 likes
        Last Post FrazMann  
        Started by geddyisodin, Yesterday, 05:20 AM
        8 responses
        51 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by cmtjoancolmenero, Yesterday, 03:58 PM
        10 responses
        36 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by DayTradingDEMON, Today, 09:28 AM
        4 responses
        24 views
        0 likes
        Last Post DayTradingDEMON  
        Started by George21, Today, 10:07 AM
        1 response
        18 views
        0 likes
        Last Post NinjaTrader_ChristopherJ  
        Working...
        X