well every company is different same for every day is different. when I play short I look between 20 to 45% but I put a lot of contracts and when I go long I start with few contracts, some time goes over 100% sometime even higher. Right now market its inconsistent, to mush inflation so you has to play the best you can.Is there a way to scan for "exts" as true using Day timeframe? What about UpSignal?
Does this mean no way to scan for "exts" dots and "UpSignal" lines using this indicator?well every company is different same for every day is different. when I play short I look between 20 to 45% but I put a lot of contracts and when I go long I start with few contracts, some time goes over 100% sometime even higher. Right now market its inconsistent, to mush inflation so you has to play the best you can.
BreakPriceMomentum()."UpSignal" is true.
I do not create the exts for scanner.Does this mean no way to scan for "exts" dots and "UpSignal" lines using this indicator?
Edit: Figured out the scan for the UpSignal. Now just for the exts...
Code:BreakPriceMomentum()."UpSignal" is true.
cases like that can appear at any time. There is not a magic formula to avoid those situations, all depends your experience. No I haven't create any watchlist at this moment.Thank u so much , it is an amazing work . just in case how to avoid like this , or what is the strong sign to get in from your experience , and is there any watchlist code ..
again thank u so much .
Silly question, but is it possible to just say something like "paint any candle X color if it gets within 1.5 points of EMA"I do both stocks and options. I always take my contracts minimum 60+ days of expiration.
what percentage you asking about?
# BPM, WTO, QQE Labels by mbarcala
####### BPM #######
def length = 20;
def lowlength = 6;
def slength = 17;
def lowest_k = Lowest(low, slength);
def c1 = close - lowest_k;
def c2 = Highest(high, slength) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovAvgExponential(FastK, lowlength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);
def BPM = flen;
def cLine = 0;
####### WTO #######
def chLength = 10;
def esa = ExpAverage(hlc3, chLength);
def d = ExpAverage(AbsValue(hlc3 - esa), chLength);
def ci = (hlc3 - esa) / (0.015 * d);
def WTO = ExpAverage(ci, length);
####### QQE #######
def rsi = RSI(price = close, length = length).RSI;
def QQE = ExpAverage(rsi, lowlength);
def line50 = 50;
def sarea = 2.5;
# Label
AddLabel(yes, if BPM > cLine then " Bullish " else
if BPM < cLine then "Bearish" else "",
if BPM > cLine then Color.GREEN else
if BPM < cLine then Color.RED else Color.CURRENT);
AddLabel(yes, if WTO > cLine then " " else
if WTO < cLine then " " else " ",
if WTO > cLine then Color.GREEN else
if WTO < cLine then Color.RED else Color.CURRENT);
AddLabel(yes, if WTO > 7 then " " else
if WTO < -7 then " " else " ",
if WTO > 7 then Color.GREEN else
if WTO < -7 then Color.RED else Color.CURRENT);
AddLabel(yes, if QQE > line50 then " " else
if QQE < line50 then " " else " ",
if QQE > line50 then Color.GREEN else
if QQE < line50 then Color.RED else Color.CURRENT);
AddLabel(yes, if QQE > line50 + sArea then " " else
if QQE < line50 - sArea then " " else " ",
if QQE > line50 + sArea then Color.GREEN else
if QQE < line50 - sArea then Color.RED else Color.CURRENT);
Hi @mbarcala it would be helpful if you create a watchlist column with the same concept. also, I would like to know what are those 4 bars next to the label? because sometimes the label says bullish but those bars are red.Im creating a label here to have some fun but I need some help from those who got better understanding in thinkscript. I combine on this label the signal of 3 indicators
Break Price Momentum - https://usethinkscript.com/threads/break-price-momentum-bpm-for-thinkorswim.9453/
WaveTrend Oscillator - https://usethinkscript.com/threads/wavetrend-oscillator-for-thinkorswim-lazybear.233/post-47277
QQE - https://usethinkscript.com/threads/qqe-quantitative-qualitative-estimation-for-thinkorswim.938/
Code:# BPM, WTO, QQE Labels by mbarcala ####### BPM ####### def length = 20; def lowlength = 6; def slength = 17; def lowest_k = Lowest(low, slength); def c1 = close - lowest_k; def c2 = Highest(high, slength) - lowest_k; def FastK = if c2 != 0 then c1 / c2 * 100 else 0; def FullK = MovAvgExponential(FastK, lowlength); def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50; def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]); def BPM = flen; def cLine = 0; ####### WTO ####### def chLength = 10; def esa = ExpAverage(hlc3, chLength); def d = ExpAverage(AbsValue(hlc3 - esa), chLength); def ci = (hlc3 - esa) / (0.015 * d); def WTO = ExpAverage(ci, length); ####### QQE ####### def rsi = RSI(price = close, length = length).RSI; def QQE = ExpAverage(rsi, lowlength); def line50 = 50; # Label AddLabel(yes, if BPM > cLine then " Bullish " else if BPM < cLine then "Bearish" else "", if BPM > cLine then Color.GREEN else if BPM < cLine then Color.RED else Color.CURRENT); AddLabel(yes, if WTO > cLine then " " else if WTO < cLine then " " else " ", if WTO > cLine then Color.GREEN else if WTO < cLine then Color.RED else Color.CURRENT); AddLabel(yes, if QQE > line50 then " " else if QQE < line50 then " " else " ", if QQE > line50 then Color.GREEN else if QQE < line50 then Color.RED else Color.CURRENT);
I would like to know if there is a way that when BPM crosses above or below cLine I can reset WTO and QQE to black and only turn their color again to red or green once they cross they level line?
the BPM indicator is the main guide here on the label, the other 2 other indicators will let you know when their are going in bullish/bearish trend as the BPM once the 3 indicator are together over the middle line in each case. Im trying to create a little animation between the 3 indicator in case someone want to use in short time frame, looks really fun!Hi @mbarcala it would be helpful if you create a watchlist column with the same concept. also, I would like to know what are those 4 bars next to the label? because sometimes the label says bullish but those bars are red.
That means if BPM bullish and 3 bars next to lebal is green then all indications bullish. Correct me if I am wrong. It's a great start towards something amazing. But it will be used in full potential if we have scan, watchlist colum and alert for it.the BPM indicator is the main guide here on the label, the other 2 other indicators will let you know when their are going in bullish/bearish trend as the BPM once the 3 indicator are together over the middle line in each case. Im trying to create a little animation between the 3 indicator in case someone want to use in short time frame, looks really fun!
yes that's the idea behind this label, about the scan you can use this. to scan above just take off # from BPMup and place # on BPMdnThat means if BPM bullish and 3 bars next to lebal is green then all indications bullish. Correct me if I am wrong. It's a great start towards something amazing. But it will be used in full potential if we have scan, watchlist colum and alert for it.
def lowlength = 6;
def slength = 17;
def lowest_k = Lowest(low, slength);
def c1 = close - lowest_k;
def c2 = Highest(high, slength) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovAvgExponential(FastK, lowlength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);
def BPM = if !IsNaN(close) then flen else Double.NaN;
def cLine = 0;
#plot BPMup = BPM crosses above cLine;
plot BPMdn = BPM crosses below cLine;
90% of the time daily timeframe and the other 10% hour timeframe, but you can use with any time frame it will work fine!Hi all,
What timeframe do you use this study with?
compression from the squeeze compression and the exit is that after you take a position those point indication could be a possible exit point. I should explain a little more on the photo, my bad.Good idea but it looks like it could use some labels in the corner of the chart just to remind you what the symbols represent. Have a feature that let's you toggle to display or not in the options.
Tos needs a wider range of symbols you can program a study to display, No fault on your own.
- What is compression?
- What exactly is "exit"?
# Break Price Momentum "BPM" by mbarcala and usethinkscript.com on 12/21/21(18)
declare lower;
input length = 20;
input lowlength = 5;
input lookForward = yes;
input reverType = {default "Momentum", "hiloMomentum", "temaMomentum"};
def exitLevelBeg = 1.5;
def calDays = 0.5;
def mLev = 1.1;
def nDev = 2.0;
def AvgExp = ExpAverage(close, length);
def UpSignal = close crosses above AvgExp;
def DnSignal = close crosses below AvgExp;
def SignUpDn = UpSignal or DnSignal;
def slength = 17;
def lowest_k = Lowest(low, slength);
def c1 = close - lowest_k;
def c2 = Highest(high, slength) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovAvgExponential(FastK, lowlength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);
plot BPM = flen;
BPM.SetDefaultColor(CreateColor(0, 101, 255));
BPM.SetLineWeight(2);
BPM.HideBubble();
BPM.HideTitle();
plot cLine = 0;
cLine.SetPaintingStrategy(PaintingStrategy.LINE);
cLine.SetDefaultColor(Color.GRAY);
cLine.SetLineWeight(1);
cLine.HideTitle();
cLine.HideTitle();
plot oBl = mLev;
oBl.SetPaintingStrategy(PaintingStrategy.LINE);
oBl.SetDefaultColor(CreateColor(22, 42, 115));
oBl.SetLineWeight(1);
oBl.HideTitle();
plot oSl = -mLev;
oSl.SetPaintingStrategy(PaintingStrategy.LINE);
oSl.SetDefaultColor(CreateColor(22, 42, 115));
oSl.SetLineWeight(1);
oSl.HideTitle();
plot centlev = 0.2;
centlev.SetDefaultColor(Color.BLACK);
centlev.HideBubble();
centlev.HideTitle();
plot centLev2 = -centlev;
centLev2.SetDefaultColor(Color.BLACK);
centLev2.HideBubble();
centLev2.HideTitle();
AddCloud(BPM, centlev, CreateColor(15, 50, 108), CreateColor(27, 27, 27));#GREEN
AddCloud(BPM, -centlev, CreateColor(27, 27, 27), CreateColor(99, 17, 73));#RED
def extValue = if BPM >= exitLevelBeg then RoundDown((BPM - exitLevelBeg) / calDays, 0) + 1 else if BPM <= -exitLevelBeg then RoundDown((-exitLevelBeg - BPM) / calDays, 0) + 1 else 0;
def ema2 = ExpAverage(AvgExp, length);
def ema3 = ExpAverage(ema2, length);
def TEMA = 3 * AvgExp - 3 * ema2 + ema3;
plot upArrow;
plot dnArrow;
plot trendUp;
plot trendDn;
plot exts;
plot upBuy;
plot dnSell;
plot temaUp;
plot temaDn;
switch (reverType) {
case "Momentum":
upArrow = if BPM crosses above cLine then BPM else Double.NaN;
dnArrow = if BPM crosses below cLine then BPM else Double.NaN;
trendUp = if BPM > centlev and BPM crosses above BPM[1] then BPM + -0.1 else Double.NaN;
trendDn = if BPM < -centlev and BPM crosses below BPM[1] then BPM + 0.1 else Double.NaN;
exts = if extValue > 0 and extValue[1] != extValue then BPM else Double.NaN;
upBuy = Double.NaN;
dnSell = Double.NaN;
temaUp = Double.NaN;
temaDn = Double.NaN;
case "hiloMomentum":
upArrow = if BPM crosses above cLine then BPM else Double.NaN;
dnArrow = if BPM crosses below cLine then BPM else Double.NaN;
trendUp = Double.NaN;
trendDn = Double.NaN;
exts = Double.NaN;
upBuy = if flen crosses above flen[1] then flen[1] else Double.NaN;
dnSell = if flen crosses below flen[1] then flen[1] else Double.NaN;
temaUp = Double.NaN;
temaDn = Double.NaN;
case "temaMomentum":
upArrow = Double.NaN;
dnArrow = Double.NaN;
trendUp = Double.NaN;
trendDn = Double.NaN;
exts = Double.NaN;
upBuy = Double.NaN;
dnSell = Double.NaN;
temaUp = if TEMA crosses above TEMA[1] then BPM + -0.1 else Double.NaN;
temaDn = if TEMA crosses below TEMA[1] then BPM + 0.1 else Double.NaN;
}
############### BPM Crossing cLine ################
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(3);
upArrow.HideBubble();
upArrow.HideTitle();
dnArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnArrow.SetDefaultColor(Color.RED);
dnArrow.SetLineWeight(3);
dnArrow.HideBubble();
dnArrow.HideTitle();
############### Price Reversals ################
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.WHITE);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.WHITE);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();
############## Possible Exit Levels #################
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(Color.MAGENTA);
exts.SetLineWeight(3);
exts.HideBubble();
exts.HideTitle();
############## Multi Revertion Points #################
upBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upBuy.SetDefaultColor(Color.MAGENTA);
upBuy.SetLineWeight(1);
upBuy.HideBubble();
upBuy.HideTitle();
dnSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnSell.SetDefaultColor(Color.MAGENTA);
dnSell.SetLineWeight(1);
dnSell.HideBubble();
dnSell.HideTitle();
############## TEMA Arrows #################
temaUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
temaUp.SetDefaultColor(Color.MAGENTA);
temaUp.SetLineWeight(1);
temaUp.HideBubble();
temaUp.HideTitle();
temaDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
temaDn.SetDefaultColor(Color.MAGENTA);
temaDn.SetLineWeight(1);
temaDn.HideBubble();
temaDn.HideTitle();
############## Vertical Lines #################
AddVerticalLine(if lookForward then UpSignal and !SignUpDn[-1] else UpSignal and !UpSignal[1], "Up", Color.DARK_GREEN, Curve.SHORT_DASH);
AddVerticalLine(if lookForward then DnSignal and !SignUpDn[-1] else DnSignal and !UpSignal[1], "Down", Color.DARK_RED, Curve.SHORT_DASH);
########## BB Squeeze ###########
def sDev = StDev(close, length);
def MidLine = MovAvgExponential(close, length);
def LowerBand = MidLine + -nDev * sDev;
def UpperBand = MidLine + nDev * sDev;
def shhigh = 1.0 * MovAvgExponential(TrueRange(high, close, low), length);
def shMid = 1.5 * MovAvgExponential(TrueRange(high, close, low), length);
def shlow = 2.0 * MovAvgExponential(TrueRange(high, close, low), length);
def average = MovAvgExponential(close, length);
def UpperBandKCLow = average + shlow;
def LowerBandKCLow = average - shlow;
def UpperBandKCMid = average + shMid;
def LowerBandKCMid = average - shMid;
def UpperBandKCHigh = average + shhigh;
def LowerBandKCHigh = average - shhigh;
def preSqueeze = LowerBand > LowerBandKCLow and UpperBand < UpperBandKCLow;
def oriSqueeze = LowerBand > LowerBandKCMid and UpperBand < UpperBandKCMid;
def ExtSqueeze = LowerBand > LowerBandKCHigh and UpperBand < UpperBandKCHigh;
plot squeezeline = if IsNaN(close) then Double.NaN else if ExtSqueeze or oriSqueeze or preSqueeze then cLine else Double.NaN;
squeezeline.AssignValueColor(if ExtSqueeze then CreateColor(155, 83, 21) else if oriSqueeze then CreateColor(122, 22, 46) else if preSqueeze then Color.DARK_GRAY else Color.GREEN);
squeezeline.SetPaintingStrategy(PaintingStrategy.SQUARES);
squeezeline.SetLineWeight(4);
squeezeline.HideTitle();
AddCloud(centlev, -centlev, Color.BLACK);
# Break Price Momentum "BPM" by mbarcala and usethinkscript.com on 12/21/21(18)
declare lower;
input length = 20;
input lowlength = 5;
input lookForward = yes;
input reverType = {default "Momentum", "MultiMomentum", "temaMomentum"};
def exitLevelBeg = 1.5;
def calDays = 0.5;
def mLev = 1.1;
def nDev = 2.0;
def AvgExp = ExpAverage(close, length);
def UpSignal = close crosses above AvgExp;
def DnSignal = close crosses below AvgExp;
def SignUpDn = UpSignal or DnSignal;
def slength = 17;
def lowest_k = Lowest(low, slength);
def c1 = close - lowest_k;
def c2 = Highest(high, slength) - lowest_k;
def FastK = if c2 != 0 then c1 / c2 * 100 else 0;
def FullK = MovAvgExponential(FastK, lowlength);
def FullD = Max(-100, Min(100, (MovAvgExponential(FullK, 1))) - 50) / 50;
def flen = 0.5 * (Log((1 + FullD) / (1 - FullD)) + flen[1]);
plot BPM = flen;
BPM.SetDefaultColor(CreateColor(0, 101, 255));
BPM.SetLineWeight(2);
BPM.HideBubble();
BPM.HideTitle();
plot cLine = 0;
cLine.SetPaintingStrategy(PaintingStrategy.LINE);
cLine.SetDefaultColor(Color.GRAY);
cLine.SetLineWeight(1);
cLine.HideTitle();
cLine.HideTitle();
plot oBl = mLev;
oBl.SetPaintingStrategy(PaintingStrategy.LINE);
oBl.SetDefaultColor(CreateColor(22, 42, 115));
oBl.SetLineWeight(1);
oBl.HideTitle();
plot oSl = -mLev;
oSl.SetPaintingStrategy(PaintingStrategy.LINE);
oSl.SetDefaultColor(CreateColor(22, 42, 115));
oSl.SetLineWeight(1);
oSl.HideTitle();
plot centlev = 0.2;
centlev.SetDefaultColor(Color.BLACK);
centlev.HideBubble();
centlev.HideTitle();
plot centLev2 = -centlev;
centLev2.SetDefaultColor(Color.BLACK);
centLev2.HideBubble();
centLev2.HideTitle();
AddCloud(BPM, centlev, CreateColor(15, 50, 108), CreateColor(27, 27, 27));#GREEN
AddCloud(BPM, -centlev, CreateColor(27, 27, 27), CreateColor(99, 17, 73));#RED
def extValue = if BPM >= exitLevelBeg then RoundDown((BPM - exitLevelBeg) / calDays, 0) + 1 else if BPM <= -exitLevelBeg then RoundDown((-exitLevelBeg - BPM) / calDays, 0) + 1 else 0;
#def ema1 = ExpAverage(close, length);
def ema2 = ExpAverage(AvgExp, length);
def ema3 = ExpAverage(ema2, length);
def TEMA = 3 * AvgExp - 3 * ema2 + ema3;
plot upArrow;
plot dnArrow;
plot trendUp;
plot trendDn;
plot exts;
plot upBuy;
plot dnSell;
plot temaUp;
plot temaDn;
switch (reverType) {
case "Momentum":
upArrow = if BPM crosses above cLine then BPM else Double.NaN;
dnArrow = if BPM crosses below cLine then BPM else Double.NaN;
trendUp = if BPM > centlev and BPM crosses above BPM[1] then BPM + -0.1 else Double.NaN;
trendDn = if BPM < -centlev and BPM crosses below BPM[1] then BPM + 0.1 else Double.NaN;
exts = if extValue > 0 and extValue[1] != extValue then BPM else Double.NaN;
upBuy = Double.NaN;
dnSell = Double.NaN;
temaUp = Double.NaN;
temaDn = Double.NaN;
case "MultiMomentum":
upArrow = if BPM crosses above cLine then BPM else Double.NaN;
dnArrow = if BPM crosses below cLine then BPM else Double.NaN;
trendUp = Double.NaN;
trendDn = Double.NaN;
exts = Double.NaN;
upBuy = if flen crosses above flen[1] then flen[1] else Double.NaN;
dnSell = if flen crosses below flen[1] then flen[1] else Double.NaN;
temaUp = Double.NaN;
temaDn = Double.NaN;
case "temaMomentum":
upArrow = Double.NaN;
dnArrow = Double.NaN;
trendUp = Double.NaN;
trendDn = Double.NaN;
exts = Double.NaN;
upBuy = Double.NaN;
dnSell = Double.NaN;
temaUp = if TEMA crosses above TEMA[1] then BPM + -0.1 else Double.NaN;
temaDn = if TEMA crosses below TEMA[1] then BPM + 0.1 else Double.NaN;
}
############### BPM Crossing cLine ################
upArrow.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upArrow.SetDefaultColor(Color.GREEN);
upArrow.SetLineWeight(3);
upArrow.HideBubble();
upArrow.HideTitle();
dnArrow.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnArrow.SetDefaultColor(Color.RED);
dnArrow.SetLineWeight(3);
dnArrow.HideBubble();
dnArrow.HideTitle();
############### Price Reversals ################
trendUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
trendUp.SetDefaultColor(Color.WHITE);
trendUp.SetLineWeight(1);
trendUp.HideBubble();
trendUp.HideTitle();
trendDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
trendDn.SetDefaultColor(Color.WHITE);
trendDn.SetLineWeight(1);
trendDn.HideBubble();
trendDn.HideTitle();
############## Possible Exit Levels #################
exts.SetPaintingStrategy(PaintingStrategy.POINTS);
exts.SetDefaultColor(Color.MAGENTA);
exts.SetLineWeight(3);
exts.HideBubble();
exts.HideTitle();
############## Multi Revertion Points #################
upBuy.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
upBuy.SetDefaultColor(Color.MAGENTA);
upBuy.SetLineWeight(1);
upBuy.HideBubble();
upBuy.HideTitle();
dnSell.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
dnSell.SetDefaultColor(Color.MAGENTA);
dnSell.SetLineWeight(1);
dnSell.HideBubble();
dnSell.HideTitle();
############## TEMA Arrows #################
temaUp.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
temaUp.SetDefaultColor(Color.MAGENTA);
temaUp.SetLineWeight(1);
temaUp.HideBubble();
temaUp.HideTitle();
temaDn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
temaDn.SetDefaultColor(Color.MAGENTA);
temaDn.SetLineWeight(1);
temaDn.HideBubble();
temaDn.HideTitle();
############## Vertical Lines #################
AddVerticalLine(if lookForward then UpSignal and !SignUpDn[-1] else UpSignal and !UpSignal[1], "Up", Color.DARK_GREEN, Curve.SHORT_DASH);
AddVerticalLine(if lookForward then DnSignal and !SignUpDn[-1] else DnSignal and !UpSignal[1], "Down", Color.DARK_RED, Curve.SHORT_DASH);
########## BB Squeeze ###########
def sDev = StDev(close, length);
def MidLine = MovAvgExponential(close, length);
def LowerBand = MidLine + -nDev * sDev;
def UpperBand = MidLine + nDev * sDev;
def shhigh = 1.0 * MovAvgExponential(TrueRange(high, close, low), length);
def shMid = 1.5 * MovAvgExponential(TrueRange(high, close, low), length);
def shlow = 2.0 * MovAvgExponential(TrueRange(high, close, low), length);
def average = MovAvgExponential(close, length);
def UpperBandKCLow = average + shlow;
def LowerBandKCLow = average - shlow;
def UpperBandKCMid = average + shMid;
def LowerBandKCMid = average - shMid;
def UpperBandKCHigh = average + shhigh;
def LowerBandKCHigh = average - shhigh;
def preSqueeze = LowerBand > LowerBandKCLow and UpperBand < UpperBandKCLow;
def oriSqueeze = LowerBand > LowerBandKCMid and UpperBand < UpperBandKCMid;
def ExtSqueeze = LowerBand > LowerBandKCHigh and UpperBand < UpperBandKCHigh;
plot squeezeline = if IsNaN(close) then Double.NaN else if ExtSqueeze or oriSqueeze or preSqueeze then cLine else Double.NaN;
squeezeline.AssignValueColor(if ExtSqueeze then CreateColor(155, 83, 21) else if oriSqueeze then CreateColor(122, 22, 46) else if preSqueeze then Color.DARK_GRAY else Color.GREEN);
squeezeline.SetPaintingStrategy(PaintingStrategy.SQUARES);
squeezeline.SetLineWeight(4);
squeezeline.HideTitle();
AddCloud(centlev, -centlev, Color.BLACK);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.