MACD histogram reversal after consecutive lower bars


Category:
0
0

Hello Pete,

I’m wondering how to create a scanner that shows the first day that the histogram starts to move back to zero from it’s “negative peak” after x amount of days of moving negative.

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on February 6, 2021 8:55 am
279 views
0
Private answer

This should do it:

input consecutiveBars = 2;
input fastLength = 12;
input slowLength = 26;
input macdLength = 9;
input macdAverageType = AverageType.EXPONENTIAL;
def value = MovingAverage(macdAverageType, close, fastLength) - MovingAverage(macdAverageType, close, slowLength);
def average = MovingAverage(macdAverageType, value, macdLength);
def diff = value - average;
plot signal = Lowest(diff[1] < 0 and diff[1] < diff[2], consecutiveBars) > 0 and diff > diff[1];

Marked as spam
Posted by (Questions: 37, Answers: 4091)
Answered on February 6, 2021 10:21 am