Scan base off of TTM squeeze color of histogram


Category:
0
1

Pete

Is it possible to do a scan based off of TTM squeeze colors in the histogram…I’m looking for stocks that have Red/Cyan in the morning…

 

declare lower;

def nBB = 2.0;
def Length = 20.0;
def nK_High = 1.0;
def nK_Mid = 1.5;
def nK_Low = 2.0;
def price = close;

def momentum = TTM_Squeeze(price = price, length = length, nk = nk_Mid, nbb = nbb).”Histogram”;
plot oscillator = momentum;
def BolKelDelta_Mid = reference BollingerBands(“num_dev_up” = nBB, “length” = Length ).”upperband” – KeltnerChannels(“factor” = nK_Mid, “length” = Length).”Upper_Band”;
def BolKelDelta_Low = reference BollingerBands(“num_dev_up” = nBB, “length” = Length ).”upperband” – KeltnerChannels(“factor” = nK_Low, “length” = Length).”Upper_Band”;
def BolKelDelta_High = reference BollingerBands(“num_dev_up” = nBB, “length” = Length ).”upperband” – KeltnerChannels(“factor” = nK_High, “length” = Length).”Upper_Band”;
oscillator.DefineColor(“Up”, CreateColor(0, 255, 255));
oscillator.DefineColor(“UpDecreasing”, CreateColor(0, 0, 255));
oscillator.DefineColor(“Down”, CreateColor(255, 0, 0));
oscillator.DefineColor(“DownDecreasing”, CreateColor(255, 255, 0));
oscillator.AssignValueColor(
if oscillator[1] < oscillator then if oscillator[0] >= 0
then oscillator.Color(“Up”)
else oscillator.Color(“DownDecreasing”)
else if oscillator >= 0
then oscillator.Color(“UpDecreasing”)
else oscillator.Color(“Down”) );
oscillator.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
oscillator.SetLineWeight(5);

plot squeeze = If(IsNaN(close), Double.NaN, 0);
squeeze.DefineColor(“NoSqueeze”, Color.GREEN);
squeeze.DefineColor(“SqueezeLow”, Color.black);
squeeze.DefineColor(“SqueezeMid”, Color.RED);
squeeze.DefineColor(“SqueezeHigh”, Color.orange);
squeeze.AssignValueColor(if BolKelDelta_High <= 0 then squeeze.Color(“SqueezeHigh”) else if BolKelDelta_Mid <= 0 then squeeze.Color(“SqueezeMid”) else if BolKelDelta_Low <= 0 then squeeze.Color(“SqueezeLow”) else squeeze.color(“noSqueeze”));
squeeze.SetPaintingStrategy(PaintingStrategy.POINTS);
squeeze.SetLineWeight(3);

Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on September 24, 2019 2:52 pm
838 views
0
Private answer

You do not need any code for this. You can build this scan using the Condition Wizard.

https://www.hahn-tech.com/thinkorswim-condition-wizard/

You need to separate it into two different scans because the histogram of TTM_Squeeze cannot be two colors at the same time.

For Cyan colored histogram you need one condition to check if it is above zero and a second condition to check if current histogram bar is greater than previous. Screenshots below show this one example.

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 25, 2019 8:56 am
0
Sure but what about dark blue (positive momentum) and yellow (negative momentum) decelerating @ inflection point?
( at April 16, 2021 10:29 pm)
0
Each of those scenarios have already been posted and solved in this forum.
( at April 17, 2021 8:15 am)