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

Possible to rewind indicator?

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

    Possible to rewind indicator?

    Hi,

    I have a need to re-bias past values in some indicators. By that I mean say something happens at time X that requires all times before X to be shifted by a delta value.

    For some indicators it is simple to manually set prior Plot values by back-stepping. But for other indicators that maintain a running state/accumulator the problem is more difficult. Other issues come up when indicators are chained so the main question is....

    Is there any way to programmatically rewind the CurrentBar value to a specific value and reset the mode to historical thereby causing the next call to Update() to recalculate all bars from that point forward to the end? If there is no way to do this for a partial time range, is there a way to recalculate the entire indicator programmatcially (like hitting F5).

    Thanks,
    Chris

    #2
    Hello crokusek,

    Thank you for your post.

    There is no means to force CurrentBar back a number of bars, however it is possible to reload the historical bars, although liberal use of this is not recommended. It is also not recommended to use this through OnStateChange or data based methods like OnBarUpdate().

    ReloadAllHistoricalData(): https://ninjatrader.com/support/help...oricaldata.htm

    The other option is to reload the NinjaScript with 'F5' which would require SendKeys.SendWait() but this is not reliable as it interacts with all windows. We currently have a feature request open to send keys and I can add a vote for this if you would like.

    Please let me know if you have any questions.

    Comment


      #3
      Hi Patrick,

      Thanks for the info. It looks like that call retrieves fresh data from the server for every window that depends on the same data series so that would be too slow/overkill. I'll first try and customize the indicator to rewrite past bars rather than use the send key for now since I just need it for a few indicators.

      Thanks,
      Chris

      Comment


        #4
        Originally posted by NinjaTrader_PatrickH View Post
        Hello crokusek,

        Thank you for your post.

        There is no means to force CurrentBar back a number of bars, however it is possible to reload the historical bars, although liberal use of this is not recommended. It is also not recommended to use this through OnStateChange or data based methods like OnBarUpdate().

        ReloadAllHistoricalData(): https://ninjatrader.com/support/help...oricaldata.htm

        The other option is to reload the NinjaScript with 'F5' which would require SendKeys.SendWait() but this is not reliable as it interacts with all windows. We currently have a feature request open to send keys and I can add a vote for this if you would like.

        Please let me know if you have any questions.
        Please, add my vote too.
        fx.practic
        NinjaTrader Ecosystem Vendor - fx.practic

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by cre8able, Today, 03:20 PM
        0 responses
        5 views
        0 likes
        Last Post cre8able  
        Started by Fran888, 02-16-2024, 10:48 AM
        3 responses
        47 views
        0 likes
        Last Post Sam2515
        by Sam2515
         
        Started by martin70, 03-24-2023, 04:58 AM
        15 responses
        114 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by The_Sec, Today, 02:29 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by jeronymite, 04-12-2024, 04:26 PM
        2 responses
        31 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X