// you may need something this
... if (OrderStopLoss() < newstop) newstop=OrderStopLoss(); ...
newstop=0; preceding another newstop=... line is redundant.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I have a rebot takes 6 positions. I wish all of my lines is the same stop must be the stop of my line 1 which is with 0.01 lot
For example here is my online purchase
OrderSend(Symbol(),OP_BUY,ldLot,NormalizeDouble( Ask ,Digits), Slippage ,Bid-300*Point,ldTake,lsComm,iMagic,0,NULL);
I made this code to manage the same stop on any lines but its not working
can you help me?
thank you
// buy
for(i = 0 ; i <= 1 ; i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderType()==OP_BUY && OrderLots()==0.01)
{
newstop=0;
newstop=OrderStopLoss();
}
}
for(i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber() == iMagic && OrderSymbol()==Symbol() && OrderType()==OP_BUY )
{
OrderModify(OrderTicket(),OrderOpenPrice(),newstop,OrderTakeProfit(),0,Green);
return(0);
}
}