Can I add it to one chart and apply for all pairs I open it
can you add Trailing Stop to it
Can I add it to one chart and apply for all pairs I open it
can you add Trailing Stop to it
Can I add it to one chart and apply for all pairs I open it
can you add Trailing Stop to it
for work on all symbol just remove highlighted code
//+------------------------------------------------------------------+ //| Auto Stop&TakeProfit.mq4 | //| Copyright 2019, Catalin Zachiu | //| https://www.mql5.com/en/users/catalinzachiu | //+------------------------------------------------------------------+ #property copyright "Copyright 2019, Catalin Zachiu" #property link "https://www.mql5.com/en/users/catalinzachiu" #property version "1.00" #property strict input double StopLoss =500; input double TakeProfit =500; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ void OnTick() { //--- for(int j=0;j<OrdersTotal();j++) { if(OrderSelect(j,SELECT_BY_POS,MODE_TRADES)==false) break; if(OrderSymbol()!=Symbol() || OrderCloseTime()!=0) continue; { //--- long position is opened if(OrderType()==OP_BUY && OrderStopLoss()==0) //--- check for trailing stop { if(OrderStopLoss()==OrderOpenPrice()-StopLoss*Point) break; else { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-StopLoss*Point,OrderTakeProfit(),0,Green)) Print("OrderModify error ",GetLastError()); // return; } } if(OrderType()==OP_BUY && OrderTakeProfit()==0) //--- check for trailing stop { if(OrderTakeProfit()==OrderOpenPrice()+TakeProfit*Point) break; else { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()+TakeProfit*Point,0,Green)) Print("OrderModify error ",GetLastError()); // return; } } if(OrderType()==OP_SELL && OrderStopLoss()==0) //--- check for trailing stop { if(OrderStopLoss()==OrderOpenPrice()+StopLoss*Point) break; else { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()+StopLoss*Point,OrderTakeProfit(),0,Red)) Print("OrderModify error ",GetLastError()); //return; } } if(OrderType()==OP_SELL && OrderTakeProfit()==0) //--- check for trailing stop { if(OrderTakeProfit()==OrderOpenPrice()-TakeProfit*Point) break; else { //--- modify order and exit if(!OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),OrderOpenPrice()-TakeProfit*Point,0,Red)) Print("OrderModify error ",GetLastError()); // return; } } } } Sleep(1000); } //+------------------------------------------------------------------+
thanks a lot for this help
I will try it and update it
The Symbol selection must be canceled and trailstop may be added , I may be able to do it tomorrow .
thanks a lot waiting you
can you add magic number to orders
does it virtual Stop lose and take profit
cause when I add it to chart I can't see take profit change
The Symbol selection must be canceled and trailstop may be added , I may be able to do it tomorrow .
I still waiting you my friend
does it virtual Stop lose and take profit
cause when I add it to chart I can't see take profit change
it's not virtual, this expert works if positions SL & TP not placed on server, it means SL & TP equal to 0
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Auto Stop And TakeProfit:
This is a simple EA that automatically places Stops and TakeProfit on opened orders .
Author: Catalin Zachiu