Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy changes ticks per bar on the fly?

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

    Strategy changes ticks per bar on the fly?

    I am running a strategy on a chart with tick bars. Is it possible/supported to have the strategy change the configuration of the tick bars on the fly? I have tried assigning a value to BarsPeriod.Value and this seems to change the Tick Counter but have no obvious other effect. What I am looking for is the strategy disables; the chart reloads; the strategy re-enables; all exactly as if I had manually clicked on Data Series and edited Value. The big picture is that under certain conditions I want to alter the timeframe I am looking at; the most important thing is that an indicator applied to the chart gets to recalculate based upon the new data.

    If this is not possible, as a fallback, is it possible to manage one's own data series and recreate it when needed? For example, call AddDataSeries as shown under the Creating a new BarsPeriod object example. I'm guessing this wouldn't be charted so it is not ideal but it might work for my purposes.

    Thanks!



    #2
    Hello aworldnervelink,

    Thank you for the post.

    In general what you described is not really possible from supported code. You could use keyboard events to manually change the chart and cause the reload similar to how the RolloverIndications indicator on the user app share changes instrument.
    Shows a button on the chart to roll the expiry to the next available contract month. Option to hide button until a number of days before or on roll date. Another option to confirm by opening the instrument overlay selector or automatically rollover without confirmation. (Update June 27th, 2019 – Added an option to show […]


    From code there is no supported way to dynamically change the series or chart data series properties. This also applies to AddDataSeries, there is no supported way to dynamically change that. You can do a BarsRequest to access bar data and live data however this is not useful if you need to pass data to indicators as a series. https://ninjatrader.com/support/help...ub=barsrequest


    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    51 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    128 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X