Question: Time base exit

 

Hi,

How can I know the duration expresse by number of bars (in the current chart) for a specific position ?

Actually, I want to close a position automatically after 30 bars (in my expert-advisor)

How can I do that ?

10X !

 

On m1 timeframe one bar will be appeared every one minute.

If m15 - every 15 minutes.

Just 30 multiply by timeframe.

 

But how can I code this (in mql4)?

I understand what you said, but I still don't know how to code it in mql4.

How can I know the number of bars from the opening of a specific position ?

The timeframe is not important because I simply want to close a posision after X bars (no matter the timeframe)

 

Look at https://www.mql5.com/en/forum/173059

It is template to create EA. May be you will find it.

I can not write EA from the beginning up to end.

Will wait for the codersguru lessons.

I think Codersguru may answer.

Sorry.

 

I'll put that question at codersguru thread

10X anyway (:

 

Answered!

yaniv_av,

I've submitted the answer here .

Hope I solved it.

Reason: