Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer - Not running my strategy

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

    Strategy Analyzer - Not running my strategy

    Hello All,
    I am currently trying to understand what I am doing incorrectly. I can run my strategy on playback just fine, but when I attempt to run it on the analyzer, it doesn't move any further than where the "Print("00");" is; any ideas?

    Here is a snippet of the code (can and will provide more information, if needed):

    Click image for larger version  Name:	image.png Views:	0 Size:	94.8 KB ID:	1215894
    EDIT: Something I just thought about that could be important. The prints are for debugging, and I noticed that it will print the 00 twenty-four times exactly.

    Thank you for your time,
    Travis Sloneker

    #2
    I was able to figure it out; oddly, it was because of the way the first two statements are written.

    if (something)
    return;

    Needed to be written like:

    if (something) {
    return;
    }

    Comment


      #3
      Hello travisloneker,

      This would fall under general C# education and would not be specific to NinjaScript. When no curly braces are used for the action block, the next command, and only the next command, becomes a single nested statement, meaning no other commands after are nested with that if. This is also known as an inline statement or one line statement.

      // no curly braces used to define an action block. the next line becomes a single nested statement
      if (true)
      Print("a"); // <-- single nested statement run only if the if is true
      return; // <-- command not associated with any if statement and will always be run.

      // curly braces used to define an action block. anything between the curly braces is run if the if is true
      if (true)
      {
      Print("a"); // <-- within the action block and run only if the if is true
      return; // <-- also within the action block and run only if the if is true
      }

      Below is a publicly available link to a 3rd party educational site.
      Chelsea B.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      47 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      23 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      33 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      50 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      42 views
      0 likes
      Last Post CarlTrading  
      Working...
      X