TTM Squeeze scan for second yellow bar after 2 or more red bars


Category:
0
0

Hi Pete,

Is it possible to modify the TTM Squeeze Scan to return only results with the second yellow bar after 2 or more red bars (histogram)?

Thanks

Marked as spam
Posted by (Questions: 8, Answers: 10)
Asked on February 8, 2019 11:58 am
1193 views
0
Private answer

Update: There is a newer version of this type of scan which enables you to select any number of consecutive bars and any combination of colors. You will find that solution posted here:

https://www.hahn-tech.com/ans/ttm-squeeze-histogram-any-color-change-any-bar-count/

This should do the trick. FYI, I updated your question so that is clearly explains the context of your question. This will help other viewers to search for and find your question.

input price = CLOSE;
input length = 20;
input nK = 1.5;
input nBB = 2.0;
input alertLine = 1.0;
def hist = TTM_Squeeze(price, length, nK, nBB, alertLine).Histogram;
def histRed = hist < 0 and hist < hist[1];
def histYellow = hist < 0 and hist > hist[1];
plot scan = histYellow and histYellow[1] and histRed[2] and histRed[3];

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 12, 2019 2:51 pm
0

This works perfectly. Thank you Pete!

( at February 18, 2019 11:52 am)
0
Thanks Pete for awesome work and helping community. I am looking for little bit variation in this script. I am looking for recent 4 bars, current bar yellow, current -1 bar to be yellow , current -2 bar to be red , current -3 bar to be red. I tried above code in 1 hour time frame for GLD (May 19,2020), what I saw is there were 4 recent yellow bars and before that 2 red bars. May be I am doing something wrong. appreciate your help on this.. thanks so much
( at May 19, 2020 6:25 pm)
0
You probably have the chart set to "start aggregation at market open". That setting is completely incompatible with every other tool on the platform. Check your chart settings and make sure that setting is unchecked. This only impacts specific intraday time frames, hourly being one of them.
( at May 19, 2020 6:58 pm)
0
Wow spot on Pete... appreciate quick response..
( at May 19, 2020 7:13 pm)
0
Another quick question. So in order to add more 4 red bars and 2 yellow bars in last 6 bars, do I need to modify condition like below based on your above code? I tried below and results are not what I expected. plot scan = histYellow and histYellow[1] and histRed[2] and histRed[3] and histRed[4] and histRed[5];
( at May 19, 2020 7:59 pm)