Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Print statements in Output window do not match info in Strategy Analyzer

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

    Print statements in Output window do not match info in Strategy Analyzer

    Hi, I'm new to NinjaTrader (and to trading as well) and just started dabbling in NinjaScript. Following an online tutorial, I've written a simple strategy for testing. Here's what I have in the OnBarUpdate() function:

    Code:
    protected override void OnBarUpdate()
    {
    	var sma1 = SMA(10);
    	var sma2 = SMA(20);
    	/* Enter a long position if 10 SMA crosses above 20 SMA within the last bar */
    	if (CrossAbove(sma1, sma2, 1)) {
    		/* Debug messages, to NinjaTrader output window */
    		var msg = string.Format("Entering Long. SMA1 = {0}, SMA2 = {1}", sma1[0], sma2[0] );
    		Print(msg);
    		EnterLong();
    	}
    }
    When I ran this strategy in the Strategy Analyzer, here's what I see in the Output screen:


    And here's what I see under "Orders($)" in the Strategy Analyzer screen:


    There seems to be a mismatch; the Output screen shows that EnterLong() was called 5 times, yet under "Orders($)" it shows that there were only 2 Buy Market orders. Shouldn't there be 5 Buy Market orders as well? Could you explain on this?

    Greatly appreciate your help on this, and sorry if this is a newbie question.
    Attached Files
    Last edited by Vypre; 06-16-2018, 04:23 AM.

    #2
    Hello Vypre,

    Thank you for your note.

    This is due to using the managed approach, which you can read about at the the following section in our helpguide,


    You could uniquely name each EnterLong call, for example EnterLong("LongA",1); EnterLong("LongB",1);, then set entryhandling to Unique Entries, which will allow 5 entries to be submitted in the same block.

    You should see Entries Per Direction and EntryHandling sections of our helpguide,




    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Ok I see, great I will check out the links and info. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jaybedreamin, Today, 05:56 PM
      0 responses
      2 views
      0 likes
      Last Post jaybedreamin  
      Started by DJ888, 04-16-2024, 06:09 PM
      6 responses
      18 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by Jon17, Today, 04:33 PM
      0 responses
      1 view
      0 likes
      Last Post Jon17
      by Jon17
       
      Started by Javierw.ok, Today, 04:12 PM
      0 responses
      6 views
      0 likes
      Last Post Javierw.ok  
      Started by timmbbo, Today, 08:59 AM
      2 responses
      10 views
      0 likes
      Last Post bltdavid  
      Working...
      X