i used ibarshift on the orderopentime to get the bars passed
u can try it
somehow lost the code
I want to modify my TakeProfit order 12 Hour after to OrderOpenPrice(Breakeven point) if there is no profit.Below code doesn't work.Please help...
For starters, you're calling OrderProfit() before OrderSelect(). You're asking to check the profitability without having specified which order you are interested in. OrderProfit() is almost certainly returning zero, and therefore the rest of the code isn't getting called at all.
For starters, you're calling OrderProfit() before OrderSelect(). You're asking to check the profitability without having specified which order you are interested in. OrderProfit() is almost certainly returning zero, and therefore the rest of the code isn't getting called at all.
Thanks for replies.I changed the code as you said.( I took OrderProfit after OrderSelect)But still nothing changed.My code does not change takeprofit order.Shouldn't I use OrderOpenPrice for my new takeprofit level ??? Any idea?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I want to modify my TakeProfit order 12 Hour after to OrderOpenPrice(Breakeven point) if there is no profit.Below code doesn't work.Please help...
int timeout=12; // hours
if (OrderProfit() < 0 )
{
OrderSelect(i, SELECT_BY_POS);
if ( (TimeCurrent()-OrderOpenTime())>=(60*60*timeout) && OrderType() == OP_SELL)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid+StopLoss*Point,(OrderOpenPrice() ),0,0 );
if ((TimeCurrent()-OrderOpenTime())>=(60*60*timeout) && OrderProfit() <= 10 && OrderType() == OP_BUY)
{
OrderModify(OrderTicket(),OrderOpenPrice(),Bid-StopLoss*Point,(OrderOpenPrice() ),0,0 );
return;
}
}
}