Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by bortz, 11-06-2023, 08:04 AM
    47 responses
    1,607 views
    0 likes
    Last Post aligator  
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    9 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    19 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    6 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    15 views
    0 likes
    Last Post Javierw.ok  
    Working...
    X