MACD compared to multiple past bars
Created at 20 Feb 2016, 23:16
CT
MACD compared to multiple past bars
20 Feb 2016, 23:16
This should be simple to do, but I must be overlooking something. What is the easiest way to see if the current MACD histogram value is greater (or less than) it has been for the last 300 or more bars? I know I can compare it to (1) or (10) individually, but I can't compare it to (1-300) in one line like I need to. I would also like to compare its current value to a range of previous bars like (5-300) previous bars. Thanks for your help.
Spotware
24 Feb 2016, 16:55
Dear Trader,
You could write a loop to compare the values. However, we kindly ask you to be careful when writing loops in the Calculate method. The Calculate method is called for each historic bar starting from the beginning of the series up to the current bar and then on each incoming tick. In the case of multi-symbol / multi-timeframe implementation, it will be called on each tick of each symbol that is used in the indicator.
In other words, a loop in the Calculate method may consume a lot of memory and CPU usage according to the frequency the Calculate method is called.
@Spotware