Closing Trades after a certain days

 

Hi everybody,


i would like to gernerate a MT5 EA code which closes trades after certain days.

I loop all open trades and after a holding period of e.g. 10 days I would like to close them

Anybody an idea how the loop could look like?


Th

 
  1. Hattori_Hanso: Anybody an idea how the loop could look like?

    Same as any position select loop. MT5: first select a position via CPositionInfo, directly, or by 'MT4Orders' library (2016)

    Show us your attempt (using the CODE button) and state the nature of your difficulty.
              No free help (2017)

  2. You also have to decide what you mean by 10 days. TimeCurrent() - OpenTime) > 10*PeriodSecond(PERIOD_D1) or 10 trading days iBarShift(s, PERIOD_D1, OpenTime) > 10.