Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

new Series<int>(this, MaximumBarsLookBack.Infinite) TO .TwoHundredFiftySix)

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

    new Series<int>(this, MaximumBarsLookBack.Infinite) TO .TwoHundredFiftySix)

    new Series<int>(this, MaximumBarsLookBack.Infinite) CONVERSION TO new Series<int>(this, MaximumBarsLookBack.TwoHundredFiftySix)

    I have several indicators that are set as Infinite for testing but will need to be set to TwoHundredFiftySix for trading to save on memory.
    With infinite I can call indicator 1 from indicator 2 with no errors but it turns into a train wreck when set to TwoHundredFiftySix.
    eg. Indicator 2 calls original Indicator 1

    if (Indicator1bar[0] > 0)
    bar 5 = bar 4;
    bar 4 = bar 3;
    bar 3 = bar 2;
    bar 2 = bar 1;
    bar 0 = Indicator1bar[0]

    This works fine only in infinite and corrupts when using the last 256 bars. 256 bars would be enough in real time

    Is there a simple method used to get the right data and would it need to be done I guess, more likely in the original Indicator 1 rather than Indicator 2
    I assume that this is a common requirement but there is no explanation in the help pages and I can't find it in the forum, but I am sure it must have been discussed before.
    Any example would be handy if it has come up before.
    I am thinking maybe:
    1. A different type of series in the original indicator
    2. A new series for every bar from 1 to 5 in the original indicator (there could be about 5 to 10 bars within the 256 bars but more than that is some of the other indicators)
    3. An Array in the original indicator
    I have quite a few indicators to change so I would like to use the most simple and usual method
    Last edited by Ray12345; 01-05-2024, 07:27 AM.

    #2
    Hello Ray12345,

    For a series those are the only two options. If you need more than 256 values you would need to keep infinite selected.

    MaximumBarsLookBack.TwoHundredFiftySix Only the last 256 values of the series object will be stored in memory and accessible for reference (improves memory performance)

    MaximumBarsLookBack.Infinite Allow full access of the series, but you will then not be able to utilize the benefits of memory optimization

    Comment


      #3
      Can you create 4 instances of the data series and set two different and then call on the ones that are needed using a boolean if in playback or not a set when connecting live data.
      such that the lookback is only loaded for the type of connection that is the current one.

      Comment


        #4
        Hello LoganJKTrader,

        Yes you could do that. The easiest way would be to make a bool user input that you can toggle in the user interface and then use that to change which series are used in your logic. You would need to make conditions that use that variable wherever you use the series in OnBarUpdate to togget which values you are getting/setting.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        647 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        369 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        108 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        572 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X