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 NullPointStrategies, Today, 05:17 AM
      0 responses
      51 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      127 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      69 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      42 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      46 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X