How to create a chronometer with restart?

 
How to create a chronometer (just with one variable, second, no minute and no hour) that restart the accounting every time that a position is openned?

I'm trying do it but I often fall into an infinite loop...

PS: For MT5...

Thanks...
 
JHenry:
How to create a chronometer (just with one variable, second, no minute and no hour) that restart the accounting every time that a position is openned?

I'm trying do it but I often fall into an infinite loop...

PS: For MT5...

Thanks...
Why would you need that when you can get the exact time of the position open time (using the PositionGetInteger(POSITION_TIME))?
 
mladen:
Why would you need that when you can get the exact time of the position open time (using the PositionGetInteger(POSITION_TIME))?

Yeah!!!

Good Ideia!!! :)

Now, I tryied this, and worked!! 

PositionSelectByTicket(PositionGetTicket(0));

TimeCurrent() - PositionInfo.Time()

 But I have a problem, look...

 How to write 15 min in mql5 ??

 
JHenry:

Yeah!!!

Good Ideia!!! :)

Now, I tryied this, and worked!! 

 But I have a problem, look...

 How to write 15 min in mql5 ??

As I see you are trying to calculate seconds passed since the position has been opened

Then compare that to seconds (not that format). Instead of writing 00:15:00 there, write 15*60 there

 
mladen:

As I see you are trying to calculate seconds passed since the position has been opened

Then compare that to seconds (not that format). Instead of writing 00:15:00 there, write 15*60 there

Yeah!!! 
THank you again man!!!!
Reason: