Examples: Theoretical Basis of Building Cluster Indicators for FOREX - page 2

 

I think the missing break is not an error. It is done intentionally to add the values for higher timeframes as well by continuing down to the following cases.

 

But I think there is another error. After each call to iMA(), k is updated using '+=' operator. I think it should be '*='. As the higher timeframe should be calculated by multiplying the current time frame by a number. So if the current timeframe is H4, k should change as k *= 6 to calculate D1 from it. Also for case 1440: the multiplier should be 5 (not 4) as there are 5 daily bars in a week.  

 

In my opinion, the algorithm of the indicator is right, nothing to be changed. The smaller the timeframe, the more bars that are used on the calculation, what makes sense to me.

I would have done it other way, using "break" on the switch statements, and modifying the period depending on the current timeframe the number of bars, to avoid calling so many times iMA() when using small timeframes for each bar. But anyway, it works the way it is.

I have modified the code to cope with the new MQL4. But indicator values are exactly the same as on the original CCFp.mq4.

List of changes:

  1. Adapted original CCFp.mq4 to new MQL4
  2. Minor changes to improve speed and clarity (renaming)
  3. Added zero line level to the indicator
  4. Once indicator is loaded, as a default, each time a tick arrives, only the last 2 candles are recalculated.

I have left the copyright values to the original author, and change the link to this article on mql5.com.

Files:
 
Hi it seems the author has removed the links to download the indicators. I can't find them in the OP.
 
Oluwaseyi olajuyigbe:
Hi it seems the author has removed the links to download the indicators. I can't find them in the OP.

It's in the first post. Links are underlined.

This will take you to the relevant page

Reason: