You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello, am new to mql4, i need some help with this code to trade opposite
the ea place pending order and modify the pending order until it takes a trade..
so i double paste the order code for it to trade opposite but still no opposite trade
{ if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { if(OrderMagicNumber()==Magic) { odty=OrderType(); if(odty==OP_BUYLIMIT || odty==OP_SELLLIMIT) continue; if(OrderSymbol()==Symbol()) { z++; switch(odty) { case OP_SELL: if(TrailingStop<0) break; st=NormalizeDouble(OrderStopLoss(),NDigits); p2=NormalizeDouble(Bid-trail,NDigits); if(!((st==0.0 || p2>st))) break; ordmdf=OrderModify(OrderTicket(),OrderOpenPrice(),p2,OrderTakeProfit(),0,Blue); if(!(!ordmdf)) break; Print("Order Modify Error",(GetLastError())); break; case OP_BUY: if(TrailingStop<0) break; st=NormalizeDouble(OrderStopLoss(),NDigits); p2=NormalizeDouble(Ask+trail,NDigits); if(!((st==0.0 || p2<st))) break; ordmdf=OrderModify(OrderTicket(),OrderOpenPrice(),p2,OrderTakeProfit(),0,Red); if(!(!ordmdf)) break; Print("Order Modify Error", (GetLastError())); break; case OP_SELLSTOP: price=NormalizeDouble(Ask+offset,NDigits); if(!((price<opp))) break; p2= NormalizeDouble(price -(StopLoss+MarketInfo(Symbol(),MODE_SPREAD)) * Point,NDigits); ordmdf = OrderModify(OrderTicket(),price,p2,OrderTakeProfit(),0,Blue); if(!(!ordmdf)) break; Print("Order Modify Error", (GetLastError())); break; case OP_BUYSTOP: price=NormalizeDouble(Bid-offset,NDigits); if(!((price>opp))) break; p2= NormalizeDouble(price +(StopLoss+MarketInfo(Symbol(),MODE_SPREAD)) * Point,NDigits); ordmdf = OrderModify(OrderTicket(),price,p2,OrderTakeProfit(),0,Red); if(!(!ordmdf)) break; Print("Order Modify Error", (GetLastError())); } } } } }