29 March 2022

This snippet shows how to use timeframes as input field. For that you just have to use the ENUM_TIMEFRAMES. It contains all of the predefined timeframes. This way you can use multiple times in a single optimization.

Source code viewer
  1. input ENUM_TIMEFRAMES timeframeForMyIndicator = PERIOD_CURRENT;
  2.  
  3. // You can use the custom time in an indicator.
  4. forceIndicator = iForce(Symbol(), timeframeForMyIndicator);
Programming Language: MQL5