[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 297

 
yosuf:
Can you please tell me how to deal with the EA looping and the loss of performance in doing so?
Remove the looping and whack the coder :)
 
TheXpert:
Take out the loop and whack the coder's hands :)
Where and how is this written in the code? What, exactly, should be removed?
 
yosuf:
Where and how is this written in the code? What, exactly, should be removed?
It is written on the face of the Expert Advisor's author. You didn't write it yourself, did you?
 
granit77:
It says so on the face of the person who wrote the advisor. You didn't write it yourself, did you?

If you're familiar with Five, you might want to check it out... - the indica doesn't work on five. No questions on four.

Getting ready for the Championships - time is running out before the start...

I appreciate it.

 
GarKain:
why does closing an order not work?


if (OrdersTotal()>0){
for(int g=OrdersTotal()-1; g>=0; g--){
OrderSelect(g,SELECT_BY_POS);
if (OrderMagicNumber()==2563 && OrderType()==OP_BUY){
if (Open[0]<=Low[steploss]){
OrderClose(g,1,Bid,3,Red);
return(0);
}
if (GradusEDBuy==true){
OrderClose(g,1,Bid,3,Red);
return(0);
}
}
}
if (OrderMagicNumber()==2563 && OrderType()==OP_SELL){
if (Open[0]>=High[steploss]){
OrderClose(g,1,Ask,3,Red);
return(0);
}
if (GradusEDSell==true){
OrderClose(g,1,Bid,3,Red);
return(0);
}
}
}
the OrderClose function requires a unique ticket number of the order, not its number in the list of open orders
 
GarKain:
why doesn't the order close work?

...

Try a taste of this design. Compare it with the one you had and find the differences yourself. By the way, when you close, the slip is 3, and that's for 4-digit quotes. If you have 5-digit quotes, put 30.

if (OrdersTotal()>0
{  //--- 1 start
   for(int g=OrdersTotal()-1; g>=0; g--)
   {  //--- 2 start
      if OrderSelect(g,SELECT_BY_POS,MODE_TRADES);
      {  //--- 3 start
         if (OrderMagicNumber()==2563 && OrderType()==OP_BUY)
         {  //--- 4.a start
            if (Open[0]<=Low[steploss] || GradusEDBuy==true)
            {  RefreshRates();
               OrderClose(OrderTicket(),OrderLots(),Bid,3,Red);
               return(0);
            }
         } //--- 4.a end
         if (OrderMagicNumber()==2563 && OrderType()==OP_SELL)
         {  //--- 4.b start
            if (Open[0]>=High[steploss] || GradusEDSell==true)
            {  RefreshRates();
               OrderClose(OrderTicket(),OrderLots(),Ask,3,Red);
               return(0);
            }
         } //--- 4.b end
      } //--- 3 end
   }  //--- 2 end
}  //--- 1 end
 

Help !

How can I teach my EA not to close other people's orders?


Thanks in advance

 
Ale-xander:

Help !

How can I teach my EA not to close other people's orders?


Thanks in advance

Write down how other people's orders differ from yours. The options depend on this difference. A universal option is to open your orders from a magic number and then filter the orders by that number.
 

Can you tell me where I can download MT4 with five-digit quotes?

 
paladin80:
Write down how other people's orders differ from yours. The options depend on this difference. A universal option is to open your orders from a magic number and then filter the orders by that number.
Thank you for the quick reply. Then teach me how to open your orders with a magic number.
Reason: