Announcement

Collapse
No announcement yet.

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.

    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.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        64 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X