run indicator in specific time frame

 

Is there a way to make the indicator run on specific time frame ?

 

Yes! Just don't declare the time frame as input variable but as a fix codes value.

https://www.mql5.com/en/docs/indicators/icustom
https://www.mql5.com/en/docs/customind

Documentation on MQL5: Technical Indicators / iMA
Documentation on MQL5: Technical Indicators / iMA
  • www.mql5.com
iMA - Technical Indicators - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Behzad Hajipoor: Is there a way to make the indicator run on specific time frame ?

Your question is somewhat ambiguous and could be interpreted in different ways.

So, I will interpret it differently to the previous post and offer the opposite answer. My answer is — NO!

In live-view mode (on a chart), the indicator itself as per the OnCalculate() event handler, cannot run on a different time-frame than what it is defined by the chart it is on.

When called by the iCustom() function, it also cannot run on any other time-frame than what is set by the time-frame parameter of that function, but obviously that selected time-frame of iCustom() is user selectable.

So, in short, any plots or buffers that it displays or produces can ONLY be at the designated time-frame.

However, the indicator can access and use the information of ANY time-frame, irrespective of its currently designated one.

 

Carl and Fernando ...

Thanks for your answers . it was helpfull . thank you so much .

 
Behzad Hajipoor #: Carl and Fernando ... Thanks for your answers . it was helpfull . thank you so much .
For my part, you are welcome!
Reason: