Heikin-Ashi Red to Green After X number of Red


Category:
0
0

Hi Pete,

I’m looking for a Heikin-Ashi red to green after five red with the green closing above the body of the previous red.

Thanks!

Marked as spam
Posted by (Questions: 8, Answers: 18)
Asked on October 28, 2022 10:22 am
133 views
0
Private answer

I moved your question out of the "Alerts and Notifications" topic and into the "Stock Scanners" topic. The Heikin-Ashi code using recursive variables, which means it cannot be used with the Study Alert tool located in the MarketWatch tab of Thinkorswim. So you can only use this code as a scan, chart study or custom watchlist column:

input consecutiveBars = 5;
def haClose = ohlc4;
def haOpen = if haOpen[1] == 0 then haClose[1] else (haOpen[1] + haClose[1]) / 2;
def haHigh = Max(high, Max(haClose, haOpen));
def haLow = Min(low, Min(haClose, haOpen));
def haGreen = haClose > haOpen;
def haRed = haClose < haOpen; def consecutiveRed = Sum(haRed, consecutiveBars) == consecutiveBars; def closeAbovePreviousRedBody = haClose > haOpen[1];
plot signal = consecutiveRed[1] and haGreen and closeAbovePreviousRedBody;

Notice I have included a user input to adjust the number of consecutive red bars before the first green.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on October 28, 2022 10:55 am
0
Thanks Pete! I thought I asked the question under "Stock Scanners", but apparently not. Btw, you write the cleanest filters!
( at October 28, 2022 2:55 pm)