Squeeze Scan Not Working


Category:
0
0

Hi Pete,

I entered this code in Study Custom for scanning, but it gave me error: “AddLabel is not allowed in this context”. Please show how to fix this issue so it can scan for squeeze. Thanks!


def squeeze = if(reference BollingerBands().”upperband” – KeltnerChannels().”Upper_Band”)<0 then 1 else 0;
def insqueeze = if squeeze then insqueeze[1] + 1 else 0;
def fired = if !squeeze then fired[1]+1 else 0;
def direction = if (fired == 1 , if( TTM_Squeeze() > TTM_Squeeze()[1] , 1 , 0 ), direction[1]);
plot result = if insqueeze > 0 then insqueeze else if fired >0 and fired <8 then fired else 0;
AddLabel(yes, Concat(if insqueeze>0 then “Squeeze: ” else if fired >0 and fired <8 then Concat(“FIRED: “, if direction then ” ” else ” “) else “”, result), if insqueeze>0 then color.white else color.black);
AssignBackgroundColor( if insqueeze>0 then color.red else if fired>0 and fired <8 then color.green else color.black);


 

Marked as spam
Posted by (Questions: 23, Answers: 57)
Asked on March 9, 2018 9:42 am
831 views
0
Private answer

Where did you get this code from? This code is not designed for a custom scan filter. It is designed for a watchlist column.

I will also mention that the way this code tries to compute the TTM Squeeze dots is wrong. This code is garbage and should be deleted immediately. 

If you want to scan for the red and green dots on the center line of the TTM Squeeze I suggest you take a look at the following post: https://www.hahn-tech.com/ans/ttm-squeeze-scan-that-looks-the-number-of-red-dots-in-a-row/

This request was to scan for the number of red dots in a row. The code can be easily modified to scan for green dots as well.

Marked as spam
Posted by (Questions: 37, Answers: 4086)
Answered on March 9, 2018 10:28 am
0

I got this code from a trading room that I’m subscribed to. It was given out to everyone for free. Wow! I did not know that was garbage code. That’s why it slows down my computer quite a lot. Thank you!

( at March 9, 2018 1:00 pm)