What needs to be done for the advisor to work on all pairs at the same time. On the pair on which it is installed, everything works great.
Attached File(s)
Inserted Code
//+------------------------------------------------------------------+ //| BU.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property strict extern double BULevel = 1; extern double BUPoint = 0.2; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- BU(); } //+------------------------------------------------------------------+ void BU() { bool m; double atr = iATR(Symbol(),PERIOD_M15,14,0); for(int i=OrdersTotal()-1; i>=0; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderSymbol()==Symbol()) { if(OrderType()==OP_BUY) { if(OrderOpenPrice()<=(Bid-(BULevel+BUPoint)*atr) && OrderOpenPrice()>OrderStopLoss()) { m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+BUPoint*atr,OrderTakeProfit(),0,Yellow); return; } } if(OrderType()==OP_SELL) { if(OrderOpenPrice()>=(Ask+(BULevel+BUPoint)*atr) && (OrderOpenPrice()<OrderStopLoss() || OrderStopLoss()==0)) { m=OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-BUPoint*atr,OrderTakeProfit(),0,Yellow); return; } } } } } }