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 works in playback, but not in the strategy analyzer

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

    Strategy works in playback, but not in the strategy analyzer

    Hello, I'm not a programmer, but I enjoy learning, and I'm now working on my first open-source bot. When I playback the strategy, it works OK, but when I try to backtest it in the Strategy Analyzer, nothing happens; no operation is opened. I can't see the performance or the trades that have been opened in the past on the chart. It's as if I never opened a transaction. The strategy works perfectly in real-time with CQG data.
    What is the best way for me to figure out what I'm doing wrong? Do I send you the code so you can look at it?
    Last edited by Xolotradin92; 09-21-2021, 09:21 AM.

    #2
    Hello Xolotradin92,

    Thanks for your post.

    I see in the screenshot you shared that you have the following line of code in your script.

    if (State != State.Realtime)
    return;


    This means that the strategy will not process data unless the current state is State.Realtime. To backtest the strategy, you would need to remove this from your code so that the strategy can process historical data.

    Please let us know if we may assist further.
    Brandon H.NinjaTrader Customer Service

    Comment


      #3
      Thanks the problem was solved, you are the best. The one who does not know programming is like the one who does not see, haha.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by arvidvanstaey, Yesterday, 02:19 PM
      5 responses
      14 views
      0 likes
      Last Post NinjaTrader_Zachary  
      Started by Rapine Heihei, Yesterday, 08:25 PM
      1 response
      12 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Mongo, Yesterday, 11:05 AM
      6 responses
      27 views
      0 likes
      Last Post Mongo
      by Mongo
       
      Started by ct, 05-07-2023, 12:31 PM
      7 responses
      206 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by wzgy0920, Yesterday, 09:53 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X