Quote:
Originally Posted by mike360
What would be the code to modify an order ( adjust the take profit of it ) after X amount of minutes has passed since the order has opened ? Thanks in advance to anyone who responds to this.
|
first you have to select the order using OrderSelect function,
then check the the order open time and compare it with time current,
you can change the Stop Loss and Take Profit
You might use the following code
PHP Code:
for (int i=0;i<OrdersTotal();i++)
{
OrderSelect(i,SELECT_BY_POS,MODE_TRADES)
if(TimeCurrent()-OrderOpenTime()>= after_X_amaount_of_time_in_seconds)
{
OrderModify(OrderTicket(),OrderOpenPrice(),New_SL,New_TP,0,CLR_NONE);
}
}