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 showing inconsistent trade entries on historical chart

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

    strategy showing inconsistent trade entries on historical chart

    Hello,

    I am having this issue:

    I load my strategy on a chart, and it will show historical trades that are appropriate for the strategy. Then I can disable the strategy, reload historical data, and re-enable the strategy, and (only sometimes) the historical trades are very different. Im not changing the trading hours or the date range or anything, just reloading. And it looks like when this happens, the historical trades are not correct based on the strategy logic. Like its entering trades as if it was on every tick, instead of on bar close as it should be. Which makes a difference for the worse in this strategy. I have compared the trades to market replay, and it is very similar to if I were to run the strategy "OnEveryTick" instead of the desired "OnBarClose".

    Is it possible that it is not processing "OnBarClose" as I have selected? Also, I have seen this behavior while running live as well. Not good.

    Any ideas?

    Thanks!

    #2
    Well, whatever the cause, I added the if (firsttickofbar) condition prior to the entries, and it seems like its working now.

    Comment


      #3
      Hello RobotSyndicate,

      Thanks for opening the thread.

      It sounds like the strategy was processing OnEachTick. Historically, Calculate.OnEachTick will still calculate on bar closes, while realtime data can be processed each tick. Given the behavior noted with trades occurring each tick and the behavior changing after adding a check for IsFirstTickOfBar, this sounds like it was the case.

      You can always confirm what the strategy is processing with by adding a print for Calculate in your code.

      For the thread's reference, I have included a publicly available documentation link for the discrepancies between historical and realtime data - https://ninjatrader.com/support/help...ime_vs_bac.htm

      If you have any questions or run into any other issue that you wish to troubleshoot, please don't hesitate to write back.
      JimNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by alifarahani, Today, 09:40 AM
      6 responses
      36 views
      0 likes
      Last Post alifarahani  
      Started by Waxavi, Today, 02:10 AM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by Kaledus, Today, 01:29 PM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by Waxavi, Today, 02:00 AM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_LuisH  
      Started by gentlebenthebear, Today, 01:30 AM
      3 responses
      17 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X