• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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, 07:14 PM.

    #2
    Hello Delta007,

    Thank you for your post.

    What is the condition that sets the action to Print()?
    Patrick H.NinjaTrader Customer Service

    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?
        Patrick H.NinjaTrader Customer Service

        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])
          
          { 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]); }
          }

          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
            Patrick H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mquinteroj, Today, 02:41 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by JPPoulin, Today, 01:32 PM
            3 responses
            14 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by bltdavid, Today, 01:09 PM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Kate  
            Started by pstrusi, Today, 12:50 PM
            2 responses
            8 views
            0 likes
            Last Post pstrusi
            by pstrusi
             
            Started by ralett, Today, 11:52 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_PatrickG  
            Working...
            X