Announcement

Collapse
No announcement yet.

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.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    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 Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      560 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      325 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      101 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      547 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      547 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X