Forum

How to have a variable look back?

Hi If you want a constant look back like MA it's writing is simple by: limit= rates_total - 1 - MathMax (prev_calculated, lookback) But i need a variable look back that is calulated in the last OnCalulate run. I tried two strategies: 1. Defining a variable look back using "While" instead of "For"

how to compare two consecutive peaks on indicator value

Hi I tried to make an indicator that shows MACD trend. Can anyone tell me why MACD_trend function is not working? #include <Ehsan\\Objects.mqh> #property indicator_chart_window #property strict #property indicator_buffers 6 //----------------------------------------------------------------------[