MQL4 - automated forex trading   /  

Forum

Time a Position has been opened

Back to topics list To post a new topic, please log in or register

avatar
9
Sammasati 2011.03.06 07:25 

I need help, to close positions after a certain amount of time has elapsed


Can anyone help with the code?


Thanks

Graphic Expert Advisor: AutoGraf

Graphic Expert Advisor: AutoGraf

The article shows the workability of graphics in creation of a convenient interface to manage trading.


avatar
571
brewmanz 2011.03.06 09:31 

maybe something like

// select order (lots of examples elsewhere) then
if(OrderOpenTime() - Time[0] > 3600 * kMaxOrderOpenHours)
OrderClose(...);


avatar
9
Sammasati 2011.03.06 17:57 
Can this be backtested?

avatar
571
brewmanz 2011.03.07 10:58 

yes

if(time[0]==MyOrderOpenTime)
OpenMyOrder();
CloseOrdersOpenOverXTime();

Then backtest EA & examine results

Back to topics list  

To add comments, please log in or register