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 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 rhyminkevin, Today, 04:58 PM
      1 response
      43 views
      0 likes
      Last Post Anfedport  
      Started by iceman2018, Today, 05:07 PM
      0 responses
      5 views
      0 likes
      Last Post iceman2018  
      Started by lightsun47, Today, 03:51 PM
      0 responses
      7 views
      0 likes
      Last Post lightsun47  
      Started by 00nevest, Today, 02:27 PM
      1 response
      14 views
      0 likes
      Last Post 00nevest  
      Started by futtrader, 04-21-2024, 01:50 AM
      4 responses
      49 views
      0 likes
      Last Post futtrader  
      Working...
      X