I need to modified open order SL over a fixed range every time price move over the same range.
I have try this way but doen't work....
Any suggestions?
Thanks.
Lubo.
I have try this way but doen't work....
Inserted Code
//modifing order to range
if(set_to_break_even == true){
int cnt, total;
int r=1;
int p=1;
int r1=0;
int p1=0;
total=OrdersTotal();
for(cnt=0;cnt<total;cnt++)
{
OrderSelect(cnt, SELECT_BY_POS,MODE_TRADES);
if(OrderType()<=OP_SELL && // check for opened position
OrderSymbol()==Symbol() && OrderMagicNumber() == magic_num) // check for symbol
{
if(OrderType()==OP_BUY) // long position is opened
{
if (Bid - OrderOpenPrice() >= range*r)
{
if (OrderStopLoss() < OrderOpenPrice() + range*r)
{
Print("modifying buy order for set_to_break_even",OrderOpenPrice()+range*r1);
OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + range*r1,0,0,Green);
r++; r1++;
}
}
}
else // go to short position
{
if(OrderOpenPrice()-Ask < OrderOpenPrice() - range*p)
{
if (OrderStopLoss() > OrderOpenPrice() - range*p)
{
Print("modifying sell order for set_to_break_even",OrderOpenPrice()-range*p1);
OrderModify(OrderTicket(),OrderOpenPrice(),OrderOpenPrice()-range*p1,0,0,Red);
p=p+1; p1++;
}
}
}
}
}
}//end if Any suggestions?
Thanks.
Lubo.
If I know how, I tell You!! Few but Good!!