Calculate Average Position Holding Time

 

Hi,

In the Tester Report we have a lot of useful statistics, including the Average Position Holding Time.

Unfortunately, this parameter in not accessible with the Testing Statistics for the OnTester https://www.mql5.com/en/docs/constants/environment_state/statistics

Does anyone have a formula or idea on how to calculate it?

I think this can be very helpful to optimize some Scalping strategy.


Many thanks


Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Testing Statistics
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Testing Statistics
  • www.mql5.com
Testing Statistics - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Luca De Andrea:

You already asked this question a few days ago in another thread. Please do not duplicate questions.

Forum on trading, automated trading systems and testing trading strategies

Average Position Holding Time

Luca De Andrea, 2023.07.13 11:49

Anyone with this formula for the OnTester? Could be really useful.

Testing Statistics (https://www.mql5.com/en/docs/constants/environment_state/statistics) doesn't provide yet this parameter that we can see in the Tester Report: Average Position Holding Time

Besides, your question was already answered in the same thread.

Forum on trading, automated trading systems and testing trading strategies

Average Position Holding Time

Ubzen, 2013.12.20 07:17

Sounds like (Sum_All_Closed_Positions (Position_Close_Time - Position_Open_Time)) / Total_Positions. What do you mean by Custom Max?

You will have to calculate it yourself using 'Custom Max.' in OnTester().