Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Dynamically Adjust Data Series

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

    Dynamically Adjust Data Series

    I'm trying to make my strategy dynamically adjust the data series being analyzed based on the volume that is being traded. Right now I add two data series, then call two indicators for each data series. I know how to make this work using a static number for the two data series, however, I would like to change the data series so that data series 1 is equal to the volume traded in the last bar, and data series 2 is half of that. That way my strategy would automatically adjust throughout the day.

    For example I want to be able to do
    AddDataSeries("ES 06-16", Data.BarsPeriodType.Volume, currentVolume, Data.MarketDataType.Last);
    AddDataSeries("ES 06-16", Data.BarsPeriodType.Volume, currentVolume / 2, Data.MarketDataType.Last);

    I have tried to set currentVolume = BarsArray[0].GetVolume(CurrentBar); and then set State = State.Configure; and then call OnStateChange();. But this does not seem to change anything.

    Any ideas on how to dynamically change data series? I can provide better example code if it would help you understand what I am trying to do.

    #2
    Hello,

    Thank you for the question.

    Yes something this dynamic would not be able to work using the AddDataSeries specifically as you would then need to then remove and re add the script to allow for that change to complete. Unfortunately I do not really see a way for this to be possible using AddDataSeries specifically.

    There is a sample that NinjaTrader_ChelseaB created that utilizes an Addon to perform a BarsRequest on an arbitrary instrument, this is likely the path you would need to follow to do a BarsRequest while the script is enabled.

    The sample is an Indicator, but could be moved into a strategy as well.




    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    633 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    364 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    105 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    567 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    568 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X