Thread: How to code?
View Single Post
  #2025 (permalink)  
Old 09-01-2009, 11:50 PM
asgard2 asgard2 is offline
Junior Member
 
Join Date: Jun 2009
Posts: 12
asgard2 is on a distinguished road
2 Days and still stuck

Hi,

I am trying to add a delay after a buystop order has been deleted. I have writen the code below and although it compiles ok, it doesn't work.

Can anyone see what I am doing wrong or give me the line of code that will work for this.

thanks


Code:
   // Time Delay for the next "Buy Stop" Order after buystop is deleted.
        
        
       if  (MayOpenDeferOrder && NextBuyStop_Order_Minutes !=0)//Time Delay for the next Buy Stop Order
         
          {
         int ordersHistoryTotal = OrdersHistoryTotal();     

            for (int o=ordersHistoryTotal;o<=0;o--)           //Count down until it hits the total trades in history  
               {
              if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))   //Getting all historical trades
                  
                if ((Symbol() == OrderSymbol()) && (OrderComment() == "Buy Stop Deleted.")) continue;     
                                                                     // "Buy Stop Deleted." is the user comment 
                                                                     //added when a buystop order is deleted.
               {
              if(((TimeCurrent() - OrderOpenTime())/60) < NextBuyStop_Order_Minutes) MayOpenDeferOrder = false; 
               break;                                                               //MayOpenDeferOrder==BuyStop Order
         }
      }
   }
Reply With Quote