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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    52 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    142 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    160 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    96 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    276 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X