[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 296

 
Rustbunch:
Throw in the current graph
I would be inclined to think the error lies in the code itself. There needs to be surgical intervention in the script itself.
 
paladin80:
I would be inclined to think that the error lies in the code itself. Surgical intervention in the script itself is necessary.
Here's the script itself...
Files:
 
Rustbunch:
Here's the script itself...
Using MT4
 
Rustbunch:
Here's the script itself...
I'd say it's hard to operate on a patient in a spacesuit. You've posted a compiled file here, not open-source code (*.mq4). I have a feeling that you took a ready-made script somewhere (did you check it in its natural form for performance?), changed something in the code and it stopped doing what you need. If the original code behaved normally, then look where and what you changed and check that it works after each change.
 
how to modify Buy and Sell orders separately?
 
paladin80:
I would be inclined to think that the error lies in the code itself. Surgical intervention in the script itself is necessary.

Maybe changing the gasket would help
 
GarKain:
how do I modify Buy and Sell orders separately?
OrderSelect(2563,SELECT_BY_TICKET);
if (OrderType()==OP_BUY && Open[0]>Low[steploss] && OrderStopLoss()<trailstopbuy){
OrderModify(OrderTicket(),OrderOpenPrice(),trailstopbuy,OrderTakeProfit(),0,Blue);
return(0);
}
if (OrderType()==OP_SELL && Open[0]<High[steploss] && OrderStopLoss()>trailstopsell){
OrderModify(OrderTicket(),OrderOpenPrice(),trailstopsell,OrderTakeProfit(),0,Blue);
return(0);
}

so what?
 
GarKain:
how to modify Buy and Sell orders separately?

if (OrdersTotal()>0)
{  for (int i=OrdersTotal()-1; i>=0; i--)
   {  if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {  if (OrderType()==OP_BUY) // или OP_SELL
         OrderModify(OrderTicket(), ...);
}  }  }
 
why is closing an order not working?


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);
}
}
}
 
Can you please tell me how to deal with EA looping and loss of functionality in this case? I am still using restart, which is very inconvenient. I am using restart which is very inconvenient. Thank you in advance.