Confirmation Candles Indicator For ThinkorSwim

Hey Trader Raider,
I had posted this in a different thread <snip, snip>
Christopher, thank you for the kind heads up and detailed graphic! I've got some offline matters to attend to today but will definitely check it out tonight.

Thanks again. And thanks for making it available as a lower study. You know I can't cope with eye candy covering my candles!
 
Christopher, thank you for the kind heads up and detailed graphic! I've got some offline matters to attend to today but will definitely check it out tonight.

Thanks again. And thanks for making it available as a lower study. You know I can't cope with eye candy covering my candles!
I know how you feel!😂 Hope all is well.
 
I actually wanted to ask if I could pick your brain
@vhawkx, apologies if it seemed as if I dismissed you. I was a MACD trader for a long time so when I found the MACD BB on this site, it was a perfect fit. It's the foundation of my trading system. @Hypoluxa has a great post here with a simple MTF MACD BB strategy. If you want a clean layout that uses the MACD BB (B4 also uses MACD BB), that post may be of interest to you. If you plot the MACD BB, and customize its colors and settings to the way your eyes read a chart, that may get you started on a clean, simple layout. You can try the indicators in that post to see if they "fit" what you're seeing on the chart. Or you can try @Christopher84's in this thread. Or any of the threads on this site :) I think the key is just getting face time with charts and weeding out indicators that don't confirm what your eyes are seeing on the chart.
 
@vhawkx, apologies if it seemed as if I dismissed you. I was a MACD trader for a long time so when I found the MACD BB on this site, it was a perfect fit. It's the foundation of my trading system. @Hypoluxa has a great post here with a simple MTF MACD BB strategy. If you want a clean layout that uses the MACD BB (B4 also uses MACD BB), that post may be of interest to you. If you plot the MACD BB, and customize its colors and settings to the way your eyes read a chart, that may get you started on a clean, simple layout. You can try the indicators in that post to see if they "fit" what you're seeing on the chart. Or you can try @Christopher84's in this thread. Or any of the threads on this site :) I think the key is just getting face time with charts and weeding out indicators that don't confirm what your eyes are seeing on the chart.
No worries! I did not take it that way at all. I am not the type to usually ask for help but have just seen how clean your setups are from various screenshots and posts so wanted to ask about it. I definitely understand that price action and volume are still the most important factors that dictate everything, especially indicators. My idea is to just find one or two indicators that confirm what I am seeing or what may happen and try to be out of the market within the allotted time that I have available. I know sometimes moves don't happen or they are choppy until after my time is up but I usually have the control to just stay out of everything if that's the case. I really do appreciate your feedback though, not just in this thread but in others too. I've mostly been just writing down my "entry" and timestamp in a log and seeing if it hits my target or if it hits my stop based on the action I'm seeing. Sometimes I'll just use 1 share of the stock to test it too. Been doing this for the last couple months before I try to start scaling. Thanks for the reference to @Hypoluxa's post, will go look through it and the rest of the thread as well!
 
I know sometimes moves don't happen or they are choppy until after my time is up but I usually have the control to just stay out of everything if that's the case. I really do appreciate your feedback though, not just in this thread but in others too. I've mostly been just writing down my "entry" and timestamp in a log and seeing if it hits my target or if it hits my stop based on the action I'm seeing.

Control. If you have it, you've got the hardest part of trading down. Congrats!

I think it's another good step that you're keeping a log. I have never found back testing with estimated entries and exits particularly valuable. But my losing trades (and there have been oh so many, LOL!) taught me a lot because I kept a journal with screenshots. At the end of the month, I'd go back and review what the chart and indicators looked like when I entered the trade and when price went against me and I lost. Those screenshots of my failures taught me what I needed on a chart and what I still needed to learn about trading in general. Congrats for the wise steps you're taking on your journey :)

Best wishes and happy trading. Now I'm off to try out Christopher's EMA clouds.
 
Control. If you have it, you've got the hardest part of trading down. Congrats!

I think it's another good step that you're keeping a log. I have never found back testing with estimated entries and exits particularly valuable. But my losing trades (and there have been oh so many, LOL!) taught me a lot because I kept a journal with screenshots. At the end of the month, I'd go back and review what the chart and indicators looked like when I entered the trade and when price went against me and I lost. Those screenshots of my failures taught me what I needed on a chart and what I still needed to learn about trading in general. Congrats for the wise steps you're taking on your journey :)

Best wishes and happy trading. Now I'm off to try out Christopher's EMA clouds.
When you run the scan, I would suggest keeping it active on your watchlist. Its called out some nice moves for me on my own watchlist over the last week.👍🏼
 
@Christopher84 I really like all your hard work and really appreciate you for sharing and helping everyone. I really like the Confirmation Candles but does your Consensus Confirmation have any advantage in your opinion that would lead me to change to it? Thank you again!!!
 
When you run the scan, I would suggest keeping it active on your watchlist. Its called out some nice moves for me on my own watchlist over the last week.👍🏼

Hmmm, I thought I was running the scan correctly. I saved it and came back a few hours later and found this. Any clue what I'm doing wrong? Every time I save the scan under a different name it freezes and I have to reload the original link you sent.


Here's a silver chart from a scan I ran this afternoon. Is this what I'm looking for? The scan seemed to pick up price breaking out of a consolidation zone and then after a sloppy double top, breaking down from another consolidation area.


I have a feeling I've got the wrong end of the stick here. Thanks in advance if you can set me straight!
 
@Christopher84 I really like all your hard work and really appreciate you for sharing and helping everyone. I really like the Confirmation Candles but does your Consensus Confirmation have any advantage in your opinion that would lead me to change to it? Thank you again!!!
Well... I currently use the CC Candles because it feels like a more balanced approach to establishing the trend which helps keep me from looking at every indicator to see if I have overlooked something.lol However, the Confirmation Candles offer a wider range of versatility with the ability to change the confirmation level. It can be geared to be more conservative or more risky to suit the trader. It really just depends how you are using them and your trading style. I really like them both and will continue improving both studies.
 
Hmmm, I thought I was running the scan correctly. I saved it and came back a few hours later and found this. Any clue what I'm doing wrong? Every time I save the scan under a different name it freezes and I have to reload the original link you sent.


Here's a silver chart from a scan I ran this afternoon. Is this what I'm looking for? The scan seemed to pick up price breaking out of a consolidation zone and then after a sloppy double top, breaking down from another consolidation area.


I have a feeling I've got the wrong end of the stick here. Thanks in advance if you can set me straight!
Hmmm...yeah that doesn’t look right. I’ll send another share link in the morning. I’m sure we can figure it out.
 
Hi, C84 -- I've tried changing the upper cloud color to anything i can think of that might make it stand out more in front of my weak eyes but i can't get it to be more pronounced than muffled. any way around that you can think of? thanks. and thanks for all your hard, intelligent and inventive work on this!
 
Hi, C84 -- I've tried changing the upper cloud color to anything i can think of that might make it stand out more in front of my weak eyes but i can't get it to be more pronounced than muffled. any way around that you can think of? thanks. and thanks for all your hard, intelligent and inventive work on this!
Hi Floydddd!
This was an idea I came up with for you this morning. I added an input for opacity on the indicator, which doesn't affect the cloud really, but it does affect the outline around the cloud making it easier to see. I currently have it set at 3 for you. 0 will make the outline disappear and a setting of 10 will make it as visible as possible. I hope this helps! Here's the code.
Code:
#(Consensus Confirmation) CC Candles V.2 
#Created 04/28/2021 by Christopher84
#Based off of the Confirmation Candles Study. Main difference is that CC Candles weigh factors of positive and negative price movement to create the Consensus_Level. The Consensus_Level is considered positive if above zero and negative if below zero. 
#Modified to V.2 05/11/2021 - dialed in studies to give stronger signals. Removed reversal buy and sell signals with OB/OS signals. Included OB/OS clouds to indicate favorable zones to buy or take profit. Clouds can also indicate nearterm reversals. Cleaned up code.
#Modified to 05/14/2021 to include opacity setting for cloud outline.

#Keltner Channel
declare upper;
def displace = 0;
def factorK = 2.0;
def lengthK = 20;
def price = close;
input averageType = AverageType.SIMPLE;
def trueRangeAverageType = AverageType.SIMPLE;
def BulgeLengthK = 150;
def SqueezeLengthK = 150;
def BulgeLengthK2 = 40;
def SqueezeLengthK2 = 40;
def BulgeLengthPrice = 75;
def SqueezeLengthPrice = 75;
def BulgeLengthPrice2 = 20;
def SqueezeLengthPrice2 = 20;


def shift = factorK * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), lengthK);
def averageK = MovingAverage(averageType, price, lengthK);
def AvgK = averageK[-displace];
def Upper_BandK = averageK[-displace] + shift[-displace];
def Lower_BandK = averageK[-displace] - shift[-displace];

def conditionK1 = price >= Upper_BandK;
def conditionK2 = (Upper_BandK[1] < Upper_BandK) and (Lower_BandK[1] < Lower_BandK);
def conditionK3D = price < Lower_BandK;
def conditionK4D = (Upper_BandK[1] > Upper_BandK) and (Lower_BandK[1] > Lower_BandK);

def conditionK2L = (Upper_BandK[2] < Upper_BandK[1]) and (Lower_BandK[2] < Lower_BandK[1]);
def conditionK3L = (Upper_BandK[3] < Upper_BandK[2]) and (Lower_BandK[3] < Lower_BandK[2]);
def conditionK3 = (Upper_BandK[1] > Upper_BandK) and (Lower_BandK[1] > Lower_BandK);

def BandwidthK = (Upper_BandK - Lower_BandK) / AvgK * 100;
def condition_BWKUP = BandwidthK[1] < BandwidthK;
def condition_BWKDOWN = BandwidthK[1] > BandwidthK;
def BulgeK = Highest(BandwidthK, BulgeLengthK);
def SqueezeK = Lowest(BandwidthK, SqueezeLengthK);
def BulgeK2 = Highest(BandwidthK, BulgeLengthK2);
def SqueezeK2 = Lowest(BandwidthK, SqueezeLengthK2);

plot IntermResistance = Highest(price, BulgeLengthPrice);
IntermResistance.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
plot IntermSupport = Lowest(price, SqueezeLengthPrice);
IntermSupport.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);

plot NearTResistance = Highest(price, BulgeLengthPrice2);
NearTResistance.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
NearTResistance.SetStyle(Curve.SHORT_DASH);
plot NearTSupport = Lowest(price, SqueezeLengthPrice2);
NearTSupport.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
NearTSupport.SetStyle(Curve.SHORT_DASH);

#MACD with Price
def fastLength = 12;
def slowLength = 26;
def MACDLength = 9;
input MACD_AverageType = {SMA, default EMA};
def MACDLevel = 0.0;

def fastEMA = ExpAverage(price, fastLength);
def slowEMA = ExpAverage(price, slowLength);
def Value;
def Avg;
switch (MACD_AverageType) {
case SMA:
    Value = Average(price, fastLength) - Average(price, slowLength);
    Avg = Average(Value, MACDLength);
case EMA:
    Value = fastEMA - slowEMA;
    Avg = ExpAverage(Value, MACDLength);
}
def Diff = Value - Avg;
def Level = MACDLevel;

def condition1 = Value[1] <= Value;
def condition1D = Value[1] > Value;

#RSI
def RSI_length = 14;
def RSI_AverageType = AverageType.WILDERS;
def RSI_OB = 70;
def RSI_OS = 30;

def NetChgAvg = MovingAverage(RSI_AverageType, price - price[1], RSI_length);
def TotChgAvg = MovingAverage(RSI_AverageType, AbsValue(price - price[1]), RSI_length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);

def condition2 = (RSI[3] < RSI) is true or (RSI >= 80) is true;
def condition2D = (RSI[3] > RSI) is true or (RSI < 20) is true;
def conditionOB1 = RSI > RSI_OB;
def conditionOS1 = RSI < RSI_OS;


#MFI
def MFI_Length = 14;
def MFIover_Sold = 20;
def MFIover_Bought = 80;
def movingAvgLength = 1;
def MoneyFlowIndex = Average(MoneyFlow(high, close, low, volume, MFI_Length), movingAvgLength);
def MFIOverBought = MFIover_Bought;
def MFIOverSold = MFIover_Sold;

def condition3 = (MoneyFlowIndex[2] < MoneyFlowIndex) is true or (MoneyFlowIndex > 85) is true;
def condition3D = (MoneyFlowIndex[2] > MoneyFlowIndex) is true or (MoneyFlowIndex < 20) is true;
def conditionOB2 = MoneyFlowIndex > MFIover_Bought;
def conditionOS2 = MoneyFlowIndex < MFIover_Sold;

#Forecast
def na = Double.NaN;
def MidLine = 50;
def Momentum = MarketForecast().Momentum;
def NearT =  MarketForecast().NearTerm;
def Intermed = MarketForecast().Intermediate;
def FOB = 80;
def FOS = 20;
def upperLine = 110;

def condition4 = (Intermed[1] <= Intermed) or (NearT >= MidLine);
def condition4D = (Intermed[1] > Intermed) or (NearT < MidLine);
def conditionOB3 = Intermed > FOB;
def conditionOS3 = Intermed < FOS;
def conditionOB4 = NearT > FOB;
def conditionOS4 = NearT < FOS;


#Pivot Signals
def n = 20;
def ticks = 2.0;
def bnOK = BarNumber() > n;
def isHigher = fold i = 1 to n + 1 with p = 1 while p do high > GetValue(high, -i);
def HH = if bnOK and isHigher and high == Highest(high, n) then high else Double.NaN;
def isLower = fold j = 1 to n + 1 with q = 1 while q do low < GetValue(low, -j);
def LL = if bnOK and isLower and low == Lowest(low, n) then low else Double.NaN;
def PivH = if HH > 0 then HH else Double.NaN;
def PivL = if LL > 0 then LL else Double.NaN;

def UpPivotLow = !IsNaN(PivL);
#UpPivotLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
#UpPivotLow.SetLineWeight(4);
#UpPivotLow.SetDefaultColor(Color.GREEN);

def DownPivotHigh = !IsNaN(PivH);
#DownPivotHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
#DownPivotHigh.SetLineWeight(4);
#DownPivotHigh.SetDefaultColor(Color.RED);

def condition5 = !IsNaN(PivL);
def condition5D = !IsNaN(PivH);

#EMA_1
def EMA_length = 12;
def AvgExp = ExpAverage(price[-displace], EMA_length);

def condition6 = (price >= AvgExp) and (AvgExp[2] <= AvgExp);
def condition6D = (price < AvgExp) and (AvgExp[2] > AvgExp);

#EMA_2
def EMA_2length = 20;
def displace2 = 0;
def AvgExp2 = ExpAverage(price[-displace2], EMA_2length);

def condition7 = (price >= AvgExp2) and (AvgExp[2] <= AvgExp);
def condition7D = (price < AvgExp2) and (AvgExp[2] > AvgExp);

#DMI Oscillator
def DMI_length = 5;#Typically set to 10
input DMI_averageType = AverageType.WILDERS;
def diPlus = DMI(DMI_length, DMI_averageType)."DI+";
def diMinus = DMI(DMI_length, DMI_averageType)."DI-";
def Osc = diPlus - diMinus;
def Hist = Osc;
def ZeroLine = 0;

def condition8 = Osc >= ZeroLine;
def condition8D = Osc < ZeroLine;

#Trend_Periods
def TP_fastLength = 3;#Typically 7
def TP_slowLength = 4;#Typically 15
def Periods = Sign(ExpAverage(close, TP_fastLength) - ExpAverage(close, TP_slowLength));

def condition9 = Periods > 0;
def condition9D = Periods < 0;

#Polarized Fractal Efficiency
def PFE_length = 5;#Typically 10
def smoothingLength = 2.5;#Typically 5
def PFE_diff = close - close[PFE_length - 1];
def val = 100 * Sqrt(Sqr(PFE_diff) + Sqr(PFE_length)) / Sum(Sqrt(1 + Sqr(close - close[1])), PFE_length - 1);
def PFE = ExpAverage(if PFE_diff > 0 then val else -val, smoothingLength);
def UpperLevel = 50;
def LowerLevel = -50;

def condition10 = PFE > 0;
def condition10D = PFE < 0;
def conditionOB5 = PFE > UpperLevel;
def conditionOS5 = PFE < LowerLevel;


#Bollinger Bands PercentB
input BBPB_averageType = AverageType.SIMPLE;
def BBPB_length = 20;#Typically 20
def Num_Dev_Dn = -2.0;
def Num_Dev_up = 2.0;
def BBPB_OB = 100;
def BBPB_OS = 0;
def upperBand = BollingerBands(price, displace, BBPB_length, Num_Dev_Dn, Num_Dev_up, BBPB_averageType).UpperBand;
def lowerBand = BollingerBands(price, displace, BBPB_length, Num_Dev_Dn, Num_Dev_up, BBPB_averageType).LowerBand;
def PercentB = (price - lowerBand) / (upperBand - lowerBand) * 100;
def HalfLine = 50;
def UnitLine = 100;

def condition11 = PercentB > HalfLine;
def condition11D = PercentB < HalfLine;
def conditionOB6 = PercentB > BBPB_OB;
def conditionOS6 = PercentB < BBPB_OS;


#STARC Bands
def ATR_length = 15;
def SMA_lengthS = 6;
def multiplier_factor = 1.25;
def valS = Average(price, SMA_lengthS);
def average_true_range = Average(TrueRange(high, close, low), length = ATR_length);
def Upper_BandS = valS[-displace] + multiplier_factor * average_true_range[-displace];
def Middle_BandS = valS[-displace];
def Lower_BandS = valS[-displace] - multiplier_factor * average_true_range[-displace];

def condition12 = (Upper_BandS[1] <= Upper_BandS) and (Lower_BandS[1] <= Lower_BandS); 
def condition12D = (Upper_BandS[1] > Upper_BandS) and (Lower_BandS[1] > Lower_BandS); 

#Klinger Histogram
def Klinger_Length = 13;
def KVOsc = KlingerOscillator(Klinger_Length).KVOsc;
def KVOH = KVOsc - Average(KVOsc, Klinger_Length);
def condition13 = (KVOH > 0);
def condition13D = (KVOH < 0);

#Projection Oscillator
def ProjectionOsc_length = 30;#Typically 10
def MaxBound = HighestWeighted(high, ProjectionOsc_length, LinearRegressionSlope(price = high, length = ProjectionOsc_length));
def MinBound = LowestWeighted(low, ProjectionOsc_length, LinearRegressionSlope(price = low, length = ProjectionOsc_length));
def ProjectionOsc_diff = MaxBound - MinBound;
def PROSC = if ProjectionOsc_diff != 0 then 100 * (close - MinBound) / ProjectionOsc_diff else 0;
def PROSC_OB = 80;
def PROSC_OS = 20;

def condition14 = PROSC > 50;
def condition14D = PROSC < 50;
def conditionOB7 = PROSC > PROSC_OB;
def conditionOS7 = PROSC < PROSC_OS;


#Trend Confirmation Calculator
#Confirmation_Factor range 1-15.
input coloredCandlesOn = yes;
def Confirmation_Factor = 7;
#Use for testing conditions individually. Remove # from line below and change Confirmation_Factor to 1.
#def Agreement_Level = condition1; 
def Agreement_LevelOB = 7;
def Agreement_LevelOS = -7;

def Agreement_Level = condition1 + condition2 + condition3 + condition4 + condition5 + condition6 + condition7 + condition8 + condition9 + condition10 + condition11 + condition12 + condition13 + condition14 + conditionK1 + conditionK2;

def Agreement_LevelD = (condition1D + condition2D + condition3D + condition4D + condition5D + condition6D + condition7D + condition8D + condition9D + condition10D + condition11D + condition12D + condition13D + condition14D + conditionK3D + conditionK4D);

def Consensus_Level = Agreement_Level - Agreement_LevelD;

def UP = Consensus_Level >= 0;
def DOWN = Consensus_Level < 0;

AssignPriceColor(if coloredCandlesOn and UP then Color.LIGHT_GREEN else if coloredCandlesOn and DOWN then Color.RED else Color.CURRENT);

#Additional Signals

#Keltner #2
input showCloud = yes;
def factorK2 = 3.25;
def lengthK2 = 20;

def shiftK2 = factorK2 * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), lengthK2);
def averageK2 = MovingAverage(averageType, price, lengthK2);
def AvgK2 = averageK2[-displace];
def Upper_BandK2 = averageK2[-displace] + shiftK2[-displace];
def Lower_BandK2 = averageK2[-displace] - shiftK2[-displace];
def condition_BandRevDn = (Upper_BandS > Upper_BandK2);
def condition_BandRevUp = (Lower_BandS < Lower_BandK2);

input opacity = 3;
AddCloud(if showCloud and condition_BandRevUp then Lower_BandK2 else Double.NaN, Lower_BandS, Color.LIGHT_GREEN, color.CURRENT, opacity);
AddCloud(if showCloud and condition_BandRevDn then Upper_BandS else Double.NaN, Upper_BandK2, Color.LIGHT_Red, Color.CURRENT, opacity);
#Super_OB/OS Signal
def OB_Level = conditionOB1 + conditionOB2 + conditionOB3 + conditionOB4 + conditionOB5 + conditionOB6 + conditionOB7;
def OS_Level = conditionOS1 + conditionOS2 + conditionOS3 + conditionOS4 + conditionOS5 + conditionOS6 + conditionOS7;

def Concensus_Line = OB_Level - OS_Level;
def Zero_Line = 0;
def Super_OB = 4;
def Super_OS = -3;

def DOWN_OB = (Agreement_Level > Agreement_LevelOB) and (Concensus_Line > Super_OB);
def UP_OS = (Agreement_Level < Agreement_LevelOS) and (Concensus_Line < Super_OS);

def OS_Buy = UP_OS;
def OB_Sell = DOWN_OB;
def neutral = Concensus_Line < Super_OB and Concensus_Line > Super_OS;

#AddVerticalLine (OS_Buy and !OS_Buy[1], close, Color.GREEN, Curve.SHORT_DASH);
#AddVerticalLine (Neutral and !neutral[1], close, Color.Gray, Curve.SHORT_DASH);
#AddVerticalLine (OB_Sell and OB_Sell and !OB_Sell[1], close, Color.RED, Curve.SHORT_DASH);

def Buy_Opportnity = if OS_Buy then Double.POSITIVE_INFINITY else Double.NEGATIVE_INFINITY;
#AddCloud(Buy_Opportnity, Neutral, Color.LIGHT_GREEN, Color.LIGHT_RED);
def Sell_Opportnity = if OB_Sell then Double.POSITIVE_INFINITY else Double.NEGATIVE_INFINITY;
#AddCloud(Sell_Opportnity, Neutral, Color.LIGHT_RED, Color.LIGHT_RED);

plot OB_Signal = Upper_BandS crosses above IntermResistance;
OB_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
OB_Signal.SetLineWeight(3);
OB_Signal.SetDefaultColor(Color.RED);

plot OS_Signal = (condition_BandRevUP) and (Lower_BandS crosses below IntermSupport);
OS_Signal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
OS_Signal.SetLineWeight(3);
OS_Signal.SetDefaultColor(Color.GREEN);

#Squeeze Alert
def length = 20;
def BulgeLength = 150;
def SqueezeLength = 150;
def upperBandBB = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_up, averageType).UpperBand;
def lowerBandBB = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_up, averageType).LowerBand;
def midLineBB = BollingerBands(price, displace, length, Num_Dev_Dn, Num_Dev_up, averageType).MidLine;
def Bandwidth = (upperBandBB - lowerBandBB) / midLineBB * 100;
def Bulge = Highest(Bandwidth, BulgeLength);
def Squeeze = Lowest(Bandwidth, SqueezeLength);

plot Squeeze_Alert = Bandwidth <= Squeeze;
Squeeze_Alert.SetPaintingStrategy(PaintingStrategy.BOOLEAN_POINTS);
Squeeze_Alert.SetLineWeight(3);
Squeeze_Alert.SetDefaultColor(Color.YELLOW);

#Trend Signals
#Bollinger_Bands2
def lengthBB = 10;
def Num_Dev_DnBB = -0.8;
def Num_Dev_upBB = 0.8;

def price1 = open;
def sDev = StDev(data = price[-displace], length = lengthBB);
def MidLineBB2 = MovingAverage(averageType, data = price[-displace], length = lengthBB);
def LowerBandBB2 = MidLineBB2 + Num_Dev_DnBB * sDev;
def UpperBandBB2 = MidLineBB2 + Num_Dev_upBB * sDev;

plot UPConfirmSignal = Consensus_Level crosses above 0;
UPConfirmSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UPConfirmSignal.SetLineWeight(1);
UPConfirmSignal.SetDefaultColor(Color.GREEN);

plot DOWNConfirmSignal = Consensus_Level crosses below 0;
DOWNConfirmSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DOWNConfirmSignal.SetLineWeight(1);
DOWNConfirmSignal.SetDefaultColor(Color.RED);

#Labels
def Buy = UP_OS;
def Sell = DOWN_OB;
AddLabel(yes, "Look_To_Buy", if Buy then Color.GREEN else Color.GRAY);
AddLabel(yes, "Look_To_Sell", if Sell then Color.RED else Color.GRAY);

def MomentumUP = Agreement_Level[1] < Agreement_Level;
def MomentumDOWN = Agreement_Level[1] > Agreement_Level;
AddLabel(yes, "Increasing Momentum", if MomentumUP then Color.GREEN else Color.GRAY);
AddLabel(yes, "Decreasing Momentum", if MomentumDOWN then Color.RED else Color.GRAY);

def conditionMR = (Upper_BandK[1] > Upper_BandK) and (Lower_BandK[1] > Lower_BandK);
AddLabel(yes, "MEAN REVERSION", if conditionMR then Color.RED else Color.GRAY);

def conditionBO = ((Upper_BandS[1] < Upper_BandS) and (Lower_BandS[1] < Lower_BandS)) and ((Upper_BandK[1] < Upper_BandK) and (Lower_BandK[1] < Lower_BandK));
AddLabel(yes, "BREAKOUT", if conditionBO then Color.GREEN else Color.GRAY);

def conditionBD = ((Upper_BandS[1] > Upper_BandS) and (Lower_BandS[1] > Lower_BandS) and (Upper_BandK[1] > Upper_BandK) and (Lower_BandK[1] > Lower_BandK));
AddLabel(yes, "BREAKDOWN", if conditionBD then Color.RED else Color.GRAY);

def Squeeze_Signal = Squeeze_Alert;
AddLabel(yes, "SQUEEZE ALERT", if Squeeze_Signal then Color.YELLOW else Color.GRAY);
[/CODE}
 
Hmmm, I thought I was running the scan correctly. I saved it and came back a few hours later and found this. Any clue what I'm doing wrong? Every time I save the scan under a different name it freezes and I have to reload the original link you sent.


Here's a silver chart from a scan I ran this afternoon. Is this what I'm looking for? The scan seemed to pick up price breaking out of a consolidation zone and then after a sloppy double top, breaking down from another consolidation area.


I have a feeling I've got the wrong end of the stick here. Thanks in advance if you can set me straight!
I think the best idea is to give you the components of the scan so you are able to setup instead of relying on the share link. So here are the codes I am using to do the scan with images to show my settings.
Code:
# MTF Moving Average Cloud Scan Day (For Scan Only)

declare lower;
input length = 10;
input agperiod1 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "1 hour", "4 hours", default "Day", "Week"};
#input agperiod2 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "1 hour", "4 hours", "Day", default "Week"};

plot avg1 = ExpAverage(close(period = agperiod1), length);
def height = avg1 - avg1[length];
avg1.SetStyle(Curve.SHORT_DASH);
avg1.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);
plot UP1 = avg1[1] < avg1;
def DOWN1 = avg1[1] > avg1;
Avg1.AssignValueColor(if UP1 then Color.LIGHT_GREEN else if DOWN1 then Color.RED else Color.YELLOW);

#plot avg2 = ExpAverage(close(period = agperiod2), length);
#def height2 = avg2 - avg2[length];
#avg2.SetStyle(Curve.SHORT_DASH);
#avg2.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);

#def UP2 = avg2[1] < avg2;
#def DOWN2 = avg2[1] > avg2;
#Avg2.AssignValueColor(if UP2 then Color.LIGHT_GREEN else if DOWN2 then Color.RED else Color.YELLOW);

plot price1 = close;
def UP3 = price1[1] < price1;
def DOWN3 = price1[1] > price1;
price1.AssignValueColor(if UP3 then Color.LIGHT_GREEN else if DOWN3 then Color.RED else Color.YELLOW);


#AddCloud(avg2, avg1, Color.LIGHT_RED, Color.CURRENT);
#AddCloud(avg1, avg2, Color.LIGHT_GREEN, Color.CURRENT);
YV9bL9B.png

Xr7InFZ.png


Here's the MA Week scan component.
Code:
# MTF Moving Average Cloud (For Week Scan Only)

declare lower;
input length = 10;
#input agperiod1 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "1 hour", "4 hours", default "Day", "Week"};
input agperiod2 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "1 hour", "4 hours", "Day", default "Week"};

#plot avg1 = ExpAverage(close(period = agperiod1), length);
#def height = avg1 - avg1[length];
#avg1.SetStyle(Curve.SHORT_DASH);
#avg1.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);
#def UP1 = avg1[1] < avg1;
#def DOWN1 = avg1[1] > avg1;
#Avg1.AssignValueColor(if UP1 then Color.LIGHT_GREEN else if DOWN1 then Color.RED else Color.YELLOW);

plot avg2 = ExpAverage(close(period = agperiod2), length);
def height2 = avg2 - avg2[length];
avg2.SetStyle(Curve.SHORT_DASH);
avg2.SetLineWeight(1);
avg2.SetDefaultColor(Color.Gray);

plot UP2 = avg2[1] < avg2;
def DOWN2 = avg2[1] > avg2;
Avg2.AssignValueColor(if UP2 then Color.LIGHT_GREEN else if DOWN2 then Color.RED else Color.YELLOW);

plot price1 = close;
def UP3 = price1[1] < price1;
def DOWN3 = price1[1] > price1;
price1.AssignValueColor(if UP3 then Color.LIGHT_GREEN else if DOWN3 then Color.RED else Color.YELLOW);


#AddCloud(avg2, avg1, Color.LIGHT_RED, Color.CURRENT);
#AddCloud(avg1, avg2, Color.LIGHT_GREEN, Color.CURRENT);
xbKr3Cm.png

Here are the results of my scan this morning.
R68x7eC.png

Let me know if you have any trouble setting it up. I had to break the code up a bit due to it being an MTF indicator.
 
Last edited:
I think the best idea is to give you the components of the scan so you are able to setup instead of relying on the share link. So here are the codes I am using to do the scan with images to show my settings.
Code:
# MTF Moving Average Cloud Scan Day (For Scan Only)

declare lower;
input length = 10;
input agperiod1 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "60 min", "4 hours", default "Day", "Week"};
#input agperiod2 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "60 min", "4 hours", "Day", default "Week"};

plot avg1 = ExpAverage(close(period = agperiod1), length);
def height = avg1 - avg1[length];
avg1.SetStyle(Curve.SHORT_DASH);
avg1.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);
plot UP1 = avg1[1] < avg1;
def DOWN1 = avg1[1] > avg1;
Avg1.AssignValueColor(if UP1 then Color.LIGHT_GREEN else if DOWN1 then Color.RED else Color.YELLOW);

#plot avg2 = ExpAverage(close(period = agperiod2), length);
#def height2 = avg2 - avg2[length];
#avg2.SetStyle(Curve.SHORT_DASH);
#avg2.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);

#def UP2 = avg2[1] < avg2;
#def DOWN2 = avg2[1] > avg2;
#Avg2.AssignValueColor(if UP2 then Color.LIGHT_GREEN else if DOWN2 then Color.RED else Color.YELLOW);

plot price1 = close;
def UP3 = price1[1] < price1;
def DOWN3 = price1[1] > price1;
price1.AssignValueColor(if UP3 then Color.LIGHT_GREEN else if DOWN3 then Color.RED else Color.YELLOW);


#AddCloud(avg2, avg1, Color.LIGHT_RED, Color.CURRENT);
#AddCloud(avg1, avg2, Color.LIGHT_GREEN, Color.CURRENT);
YV9bL9B.png

Xr7InFZ.png


Here's the MA Week scan component.
Code:
# MTF Moving Average Cloud (For Week Scan Only)

declare lower;
input length = 10;
#input agperiod1 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "60 min", "4 hours", default "Day", "Week"};
input agperiod2 = {"1 min", "2 min", "5 min", "10 min", "15 min", "30 min", "60 min", "4 hours", "Day", default "Week"};

#plot avg1 = ExpAverage(close(period = agperiod1), length);
#def height = avg1 - avg1[length];
#avg1.SetStyle(Curve.SHORT_DASH);
#avg1.SetLineWeight(1);
#avg.SetDefaultColor(Color.Gray);
#def UP1 = avg1[1] < avg1;
#def DOWN1 = avg1[1] > avg1;
#Avg1.AssignValueColor(if UP1 then Color.LIGHT_GREEN else if DOWN1 then Color.RED else Color.YELLOW);

plot avg2 = ExpAverage(close(period = agperiod2), length);
def height2 = avg2 - avg2[length];
avg2.SetStyle(Curve.SHORT_DASH);
avg2.SetLineWeight(1);
avg2.SetDefaultColor(Color.Gray);

plot UP2 = avg2[1] < avg2;
def DOWN2 = avg2[1] > avg2;
Avg2.AssignValueColor(if UP2 then Color.LIGHT_GREEN else if DOWN2 then Color.RED else Color.YELLOW);

plot price1 = close;
def UP3 = price1[1] < price1;
def DOWN3 = price1[1] > price1;
price1.AssignValueColor(if UP3 then Color.LIGHT_GREEN else if DOWN3 then Color.RED else Color.YELLOW);


#AddCloud(avg2, avg1, Color.LIGHT_RED, Color.CURRENT);
#AddCloud(avg1, avg2, Color.LIGHT_GREEN, Color.CURRENT);
xbKr3Cm.png

Here are the results of my scan this morning.
R68x7eC.png

Let me know if you have any trouble setting it up. I had to break the code up a bit due to it being an MTF indicator.
I walked thru the studies and run the scan, it really did a great job! TKS
 
Thank you for that, Christopher! Clearly, I am not doing something right because even when I change the aggregations in the indicator, I can't get it to display on anything except 10 min and daily charts. I'll have to fiddle with TOS this weekend because the whole program is acting slow and buggy.

Here's this morning's 10 min RTY. The MTF cloud did a nice job confirming the breakout along with the MACD BB. I noticed too that your lower cloud picked up the slightly higher highs that price was making overnight. It was a struggle to discern that with the MACD BB. The candle colors also made those little overnight movements pop out.


Thanks again for sharing your talent with us!
 
Thank you for that, Christopher! Clearly, I am not doing something right because even when I change the aggregations in the indicator, I can't get it to display on anything except 10 min and daily charts. I'll have to fiddle with TOS this weekend because the whole program is acting slow and buggy.

Here's this morning's 10 min RTY. The MTF cloud did a nice job confirming the breakout along with the MACD BB. I noticed too that your lower cloud picked up the slightly higher highs that price was making overnight. It was a struggle to discern that with the MACD BB. The candle colors also made those little overnight movements pop out.


Thanks again for sharing your talent with us!
Can't agree more!
 
Thank you for that, Christopher! Clearly, I am not doing something right because even when I change the aggregations in the indicator, I can't get it to display on anything except 10 min and daily charts. I'll have to fiddle with TOS this weekend because the whole program is acting slow and buggy.

Here's this morning's 10 min RTY. The MTF cloud did a nice job confirming the breakout along with the MACD BB. I noticed too that your lower cloud picked up the slightly higher highs that price was making overnight. It was a struggle to discern that with the MACD BB. The candle colors also made those little overnight movements pop out.


Thanks again for sharing your talent with us!
Your chart looks great! I typically use the day and week aggregation in the indicator with a chart timeframe of no less than 1 hour. I have used it on a 10 min chart but its not as easy to see (still doable). If you change the indicator to a lower aggregation period for the averages, it will not show up on a higher timeframe charts. For instance, it appears you have set your aggregation periods to 10 min and 30 min, so they will not show on charts with higher timeframes (such as a 1 hour chart). I am not sure if that is what's going on, but it could be part of the issue. Also, I personally like using the day and week aggregation periods due to the strength of those averages as support and resistance. Lower aggregation periods will still work, but it will diminish the strength of the support or resistance. One other thing I wanted to point out is that the MA Cloud was calling the breakout about two bars before the B4. If you see the red cloud with both averages going green (its telling you price action is extremely bullish and about to breakout). Very similar to the signal that the scan is setup to find just on a lower aggregation period. Very nice example!
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
409 Online
Create Post

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

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.

How do I get started?

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.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top