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 Mindset, 04-21-2026, 06:46 AM
      0 responses
      88 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      134 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      68 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by cmoran13, 04-16-2026, 01:02 PM
      0 responses
      119 views
      0 likes
      Last Post cmoran13  
      Started by PaulMohn, 04-10-2026, 11:11 AM
      0 responses
      67 views
      0 likes
      Last Post PaulMohn  
      Working...
      X