TTM Trend Heikin-Ashi Scan Alert


Category:
0
0

Hello,

I’ve seen some code on here for both one and two green heiken ashi candles. I was wondering how I can change this to scan for either one or two red candles?

 

Similarly with the TTM Trend. I have the code for indicating up or down for two changed bars, but how about for just one bar?

Marked as spam
Posted by (Questions: 4, Answers: 6)
Asked on February 22, 2020 11:44 am
519 views
0
Please provide links to where you got the code or the code itself. If I try to provide a solution I have no way of knowing if I am using the same source that you are referencing.
( at February 22, 2020 3:17 pm)
0
https://www.hahn-tech.com/ans/two-consecutive-green-heikin-ashi-candles/
( at February 22, 2020 5:03 pm)
0
https://www.hahn-tech.com/thinkorswim-scan-ttm-trend/
( at February 22, 2020 5:04 pm)
0
Private answer

After requesting links to the sources referenced in the question we can provide a solution. The original code for the two green HA candles is located here:

https://www.hahn-tech.com/ans/two-consecutive-green-heikin-ashi-candles/

All we need to do is change the greater than sign to a lesser than sign in the third to the last line of code. Here is the original:

def haColor = haClose > haOpen;

And to make this look for two consecutive red candles we change it to this:

def haColor = haClose < haOpen;

The next question was how to change it from two consecutive bars to only one. Here is second to last line of code (the one that determines two consecutive candles):

def trendUp = haColor and haColor[1] and !haColor[2];

And here is how you modify this to include only one bar instead of two:

def trendUp = haColor and !haColor[1];

For the second portion of this request we have the following link:

https://www.hahn-tech.com/thinkorswim-scan-ttm-trend/

The request was to modify the scan from that video so that it only counts the first bar to change color. Here are the two lines of code to modify:

def trendPivotLow = upTrend == 1 and upTrend[1] == 0 and upTrend[2] == 0;

def trendPivotHigh = downTrend == 1 and downTrend[1] == 0 and downTrend[2] == 0;

And here they are after the modification to only count one bar instead of two:

def trendPivotLow = upTrend == 1 and upTrend[1] == 0;

def trendPivotHigh = downTrend == 1 and downTrend[1] == 0 ;

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on February 22, 2020 6:13 pm
0
Do these codes work as if the bar is changing from green to red or just each time the specific bar is red or green? Basically I want it to notify me when the 5 min bar has closed green after the previous bars being red and vice versa.
( at June 6, 2022 11:56 am)
0
The Heikin-Ashi portion of this solution is for the bars changing from red to green. Current bar is green and previous bar is red. You can simply plot the scan on the lower chart subgraph and it will show you exactly where it is being triggered. The previous solution which was linked at the beginning of my solution was for 1 red bar followed by two consecutive green.
( at June 6, 2022 1:21 pm)