Thread: How to code?
View Single Post
  #1563 (permalink)  
Old 02-05-2009, 09:25 AM
primajaya's Avatar
primajaya primajaya is offline
Senior Member
 
Join Date: Aug 2006
Posts: 213
primajaya is on a distinguished road
Quote:
Originally Posted by mike360 View Post
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);
   }

__________________
You said "why?".. I said "why not?!"
Broker for 5$ Free
Trading system 4free
Reply With Quote