Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing Macd

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

    Printing Macd

    For the Print statement below, the results in the output are printing the Macd twice for one of the instruments on each day at different times but not the other instruments. I've highlighted examples below for the instruments that were printed twice. I see in the trace orders that when it tries to enter for that same instrument again and it gets rejected, as I have entries for same instrument limited to 1 per 30min, it will print the Macd value anyway. Is there anyway I can stop it from printing the Macd value for rejected orders?

    entryOrder[i] = EnterShort(i, 200, "EnterShort"+i);
    entryOrder[i]=null;
    Print(" Time: " + Time[0].ToString() + " Index: " + BarsInProgress
    + " MACD: " + MACD(BarsArray[i], 12, 26, 9)[0]);

    Time: 2/5/2013 10:31:00 AM Index: 1 MACD: 0.00221988172902599
    Time: 2/5/2013 10:31:00 AM Index: 17 MACD: 0.028904396719124
    Time: 2/5/2013 10:58:00 AM Index: 3 MACD: 0.122260550756316
    Time: 2/5/2013 10:59:00 AM Index: 1 MACD: 0.0067948736304615
    Time: 2/6/2013 10:34:00 AM Index: 9 MACD: 0.0073746363182039
    Time: 2/6/2013 10:35:00 AM Index: 25 MACD: 0.0808183085833178
    Time: 2/6/2013 10:36:00 AM Index: 21 MACD: 0.00445382753498258
    Time: 2/6/2013 10:57:00 AM Index: 21 MACD: 0.014506722389859
    Time: 2/6/2013 10:58:00 AM Index: 15 MACD: 0.0119781800206127
    Last edited by Delta007; 08-24-2014, 08:14 PM.

    #2
    Hello Delta007,

    Thank you for your post.

    What is the condition that sets the action to Print()?

    Comment


      #3
      I have it underneath EnterLong() so I assumed that was the condition that sets the action to Print()?

      Comment


        #4
        Hello Delta007,

        Thank you for your response.

        Can you provide those lines of code?

        Comment


          #5
          Code:
          {
          for(int i = 0; i < 26; i++)
          			
          			if(entryOrder[i]==null)
          		
          			if(BarsInProgress == i)
          			if (Bars.GetDayBar(1).Close <= 150)
          			if(BarsSinceExit(i,"",0)>30||BarsSinceExit(i,"",0)==-1)
          
          			if (MACD(BarsArray[i], 12, 26, 9).Avg[1] < MACD(BarsArray[i], 12, 26, 9)[1])
          			if (MACD(BarsArray[i], 12, 26, 9)[0] < MACD(BarsArray[i], 12, 26, 9).Avg[0])
          [INDENT]{
          entryOrder[i] = EnterShort(i, 200, "EnterShort"+i);
          entryOrder[i]=null;
          Print(" Time: " + Time[0].ToString() + " Index: " + BarsInProgress 
          + " MACD: " + MACD(BarsArray[i], 12, 26, 9)[0]);
          }[/INDENT]
          }

          Comment


            #6
            Hello Delta007,

            Thank you for your response.

            There really isn't a way we could accurately pull if the order was rejected from within your loop. You would need an OnOrderUpdate() but the loop is being called from one OnBarUpdate(), so you are not going to see the OnOrderUpdate() until the loop finishes.

            For information on OnOrderUpdate() please visit the following link: http://www.ninjatrader.com/support/h...rderupdate.htm

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            152 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Started by CaptainJack, 04-24-2026, 11:07 PM
            0 responses
            305 views
            0 likes
            Last Post CaptainJack  
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            244 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            345 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            176 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Working...
            X