Need help in writing ea - Time factor to close order

 

if order took place, take profit=100pips & stop lost=100pips is written in the ea,

i would like to write additonal time factor(control) to close order as below:-

says the order is a buy order
---------------------------------
1) if in 1st hour, a sudden price up of 80 pips happen in 10 minutes within this hour, close order;
2) if in 2nd hour, a sudden price up of 70 pips happen in 10 minutes within this hour, close order;
3) if in 3rd hour, a sudden price up of 60 pips happen in 10 minutes within this hour, close order;
4) if in 4th hour, profit at 50 pips, close order;

5) if in 1st hour, a sudden price down of 60 pips happen in 10 minutes within this hour, close order;
6) if in 2nd hour, a sudden price down of 70 pips happen in 10 minutes within this hour, close order;
7) if in 3rd hour, a sudden price down of 80 pips happen in 10 minutes within this hour, close order;
8) if in 4th hour, loses at 50 pips, close order;

Can somebody kindly help me to write this? I have problem to write this kind of time factor in closing order.

Thanks

Rgds,
FES

 

Hi FES

The function OrderOpenTime() gives the time an order was opened. You can subtract it from the current time (TimeCurrent() or Time[0]) to find out how much time (in seconds) has passed.

Cheers

Jellybean

Reason: