Chris, any ETA on when you can include arrows for the latest c3 candles indicator?Once the candle closes, it will not repaint (even on your older version).

Thanks

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Christopher84
- Start date

Chris, any ETA on when you can include arrows for the latest c3 candles indicator?Once the candle closes, it will not repaint (even on your older version).

Thanks

It is this section of code that is providing the big PIVOT arrows (VWAP Pivots)I'm going to post the full code below. When I toggle the settings, the big up and down arrows are labelled "UpPivotLow" and "DownPivotHigh" in the plots section. Since I suck at coding I have no real idea what section of code produces the big arrows, but you struck gold by including it, so I hope you can point me in the right direction on how to create a scan.

#Confirmation Candles developed 04/15/2021 by Christopher Wilson

#Select the level of agreement among the 13 indicators included.

#MACD with Price

declare upper;

def price = close;

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 >= MACDLevel;

#RSI

input RSI_length = 14;

input RSI_AverageType = AverageType.WILDERS;

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 >= 50;

#MFI

input 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 > 50;

#Intermediate Forecast

def na = Double.NaN;

def MidLine = 50;

def Momentum = MarketForecast().Momentum;

def NearT = MarketForecast().NearTerm;

def Intermed = MarketForecast().Intermediate;

def OB = 80;

def OS = 20;

def upperLine = 110;

def condition4 = Intermed[3] <= Intermed;

#Nearterm Forecast

def condition5 = NearT >= MidLine;

#VWAP_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;

plot UpPivotLow = !isNaN(PivL);

UpPivotLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

UpPivotLow.SetLineWeight(3);

UpPivotLow.SetDefaultColor(Color.GREEN);

plot DownPivotHigh = !isNaN(PivH);

DownPivotHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

DownPivotHigh.SetLineWeight(3);

DownPivotHigh.SetDefaultColor(Color.RED);

def condition6 = !isNaN(PivL);

#EMA_1

input EMA_length = 20;

def displace = 0;

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

def condition7 = price >= AvgExp;

#EMA_2

input EMA_2length = 50;

def displace2 = 0;

def AvgExp2 = ExpAverage(price[-displace2], EMA_2length);

def condition8 = price >= AvgExp2;

#DMI Oscillator

input DMI_length = 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 condition9 = Osc > ZeroLine;

#Trend_Periods

input TP_fastLength = 7;

input TP_slowLength = 15;

def Periods = sign(ExpAverage(close, TP_fastLength) - ExpAverage(close, TP_slowLength));

def condition10 = Periods > 0;

#Polarized Fractal Efficiency

input PFE_length = 10;

input smoothingLength = 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 condition11 = PFE > ZERoLine;

#Bollinger Bands PercentB

input BBPB_averageType = AverageType.Simple;

input BBPB_length = 20;

def Num_Dev_Dn = -2.0;

def Num_Dev_up = 2.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 condition12 = PercentB > 50;

#Chaikin Oscillator

input ChaikinOsc_longLength = 10;

input ChaikinOsc_shortLength = 3;

def accDist = AccDist();

def COSC = ExpAverage(accDist, ChaikinOsc_shortLength) - ExpAverage(accDist, ChaikinOsc_longLength);

def condition13 = COSC > zeroline;

#Trend Confirmation

#Confirmation_Factor range 1-13.

input Confirmation_Factor = 6;

#Use for testing conditions individually. Remove # from line below and chang Confirmation_Factor to 1.

#def Agreement_Level = condition1;

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

input coloredCandlesOn = yes;

def UP = Agreement_Level >= Confirmation_Factor;

def DOWN = Agreement_Level < Confirmation_Factor;

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

#Additional Signals

plot UPSignal = Agreement_Level crosses above Confirmation_Factor;

UPSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);

UPSignal.SetLineWeight(1);

UPSignal.SetDefaultColor(Color.green);

plot DOWNSignal = Agreement_Level crosses below Confirmation_Factor;

DOWNSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);

DOWNSignal.SetLineWeight(1);

DOWNSIGNAL.SetDefaultColor(Color.red);

Code:

```
#VWAP_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;
plot UpPivotLow = !isNaN(PivL);
UpPivotLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
UpPivotLow.SetLineWeight(3);
UpPivotLow.SetDefaultColor(Color.GREEN);
plot DownPivotHigh = !isNaN(PivH);
DownPivotHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
DownPivotHigh.SetLineWeight(3);
DownPivotHigh.SetDefaultColor(Color.RED);
```

Yep that's what it looked like, thanks. Any idea on how to create a scan for the big arrow events? Sorry I keep asking - going through tons of tickers right now trying to find them manually but it's super time-consuming.It is this section of code that is providing the big PIVOT arrows (VWAP Pivots)

Code:`#VWAP_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; plot UpPivotLow = !isNaN(PivL); UpPivotLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); UpPivotLow.SetLineWeight(3); UpPivotLow.SetDefaultColor(Color.GREEN); plot DownPivotHigh = !isNaN(PivH); DownPivotHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); DownPivotHigh.SetLineWeight(3); DownPivotHigh.SetDefaultColor(Color.RED);`

Any help is appreciated, thanks.

I'm pretty sure this signal qualifies as repainting. I've watched it for the last 30 minutes and the signal does not come until a future pivot happens. The calculation is taking the value of a bar and looking 20 bars ahead to make a determination on a pivot. I'll keep watching it.Yep that's what it looked like, thanks. Any idea on how to create a scan for the big arrow events? Sorry I keep asking - going through tons of tickers right now trying to find them manually but it's super time-consuming.

Any help is appreciated, thanks.

Got it - won't do much good by then. You just saved me a lot of time though so thanks!A scan would work but you have to look back 20+ bars and therefore would be way too late. Unless you just want to know the pivots.

Here is a code to find the green arrows (as close as I can get the code without the too complex error). This is not the pivot arrows that you had previously mentioned. These are the arrows indicating the Agreement Level has crossed above the Confirmation Factor producing a green candle. Install this as a study, then reference it in the scan setup.I'm going to post the full code below. When I toggle the settings, the big up and down arrows are labelled "UpPivotLow" and "DownPivotHigh" in the plots section. Since I suck at coding I have no real idea what section of code produces the big arrows, but you struck gold by including it, so I hope you can point me in the right direction on how to create a scan.

Code:

```
#Confirmation Level Scan created 06/09/2021 by Christopher Wilson
#Select the level of agreement among the 15 indicators included.
#MACD with Price
declare lower;
def price = close;
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;
#RSI
input RSI_length = 14;
input RSI_AverageType = AverageType.WILDERS;
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;
#MFI
input 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;
#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);
#Change in Price
def lengthCIP = 5;
def displace = 0;
def CIP = (price - price[1]);
def AvgCIP = ExpAverage(CIP[-displace], lengthCIP);
def CIP_UP = AvgCIP > AvgCIP[1];
def CIP_DOWN = AvgCIP < AvgCIP[1];
def condition5 = CIP_UP;
#EMA_1
input EMA_length = 12;
def AvgExp = ExpAverage(price[-displace], EMA_length);
def condition6 = (price >= AvgExp) and (AvgExp[2] <= AvgExp);
#EMA_2
input EMA_2length = 20;
def displace2 = 0;
def AvgExp2 = ExpAverage(price[-displace2], EMA_2length);
def condition7 = (price >= AvgExp2) and (AvgExp2[2] <= AvgExp2);
#DMI Oscillator
input DMI_length = 5;
input averageType = AverageType.WILDERS;
def diPlus = DMI(DMI_length, averageType)."DI+";
def diMinus = DMI(DMI_length, averageType)."DI-";
def Osc = diPlus - diMinus;
def Hist = Osc;
def ZeroLine = 0;
def condition8 = Osc >= ZeroLine;
#Trend_Periods
input TP_fastLength = 3;
input TP_slowLength = 4;
def Periods = sign(ExpAverage(close, TP_fastLength) - ExpAverage(close, TP_slowLength));
def condition9 = Periods > 0;
#Polarized Fractal Efficiency
input PFE_length = 5;
input smoothingLength = 2.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 > ZERoLine;
#Bollinger Bands PercentB
input BBPB_averageType = AverageType.Simple;
input BBPB_length = 20;
def Num_Dev_Dn = -2.0;
def Num_Dev_up = 2.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 > 50;
#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);
#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 condition13 = (PROSC > 50);
#Trend Confirmation
#Confirmation_Factor range 1-13.
plot Confirmation_Factor = 7;
#Use for testing conditions individually.
#def Agreement_Level = condition1;
plot Agreement_Level = condition1 + condition2 + condition3 + condition4 + condition5 + condition6 + condition7 + condition8 + condition9 + condition10 + condition11 + condition12 + condition13;
plot UpArrow = Agreement_Level crosses above Confirmation_Factor;
plot DownArrow = Agreement_Level crosses below Confirmation_Factor;
```

Last edited:

This is from the original code and hasn't been a part of the code in awhile. I would caution anyone against using it. There's a reason it's not part of the current code.It is this section of code that is providing the big PIVOT arrows (VWAP Pivots)

Code:`#VWAP_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; plot UpPivotLow = !isNaN(PivL); UpPivotLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP); UpPivotLow.SetLineWeight(3); UpPivotLow.SetDefaultColor(Color.GREEN); plot DownPivotHigh = !isNaN(PivH); DownPivotHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN); DownPivotHigh.SetLineWeight(3); DownPivotHigh.SetDefaultColor(Color.RED);`

@Christopher84 Thanks. The image you attached is for the Squeeze. I tried Agreement Level crosses above Confirmation Factor but I get an error. Is that how one would setup?Here is a code to find the green arrows (as close as I can get the code without the too complex error). This is not the pivot arrows that you had previously mentioned. These are the arrows indicating the Agreement Level has crossed above the Confirmation Factor producing a green candle. Install this as a study, then reference it in the scan setup.

Not yet unfortunately. Try to remember that the arrows and change in candle color are equivalent. So having an arrow is essentially seeing the same information twice. Another idea in the interim, is to use the Confirmation Candles for the arrows only while using the C3 study.Chris, any ETA on when you can include arrows for the latest c3 candles indicator?

Thanks

Thank you for catching that! Here's what I meant to post.@Christopher84 Thanks. The image you attached is for the Squeeze. I tried Agreement Level crosses above Confirmation Factor but I get an error. Is that how one would setup?

Hi Everyone!

I have just posted C3 v6 on pg.1 of the thread. Most notable change, arrows are back! The arrows will be triggered by the Agreement Level crossing the Confirmation Factor (now an adjustable input). Please note that this is not the same as the Consensus Level. It will be similar to the arrows in Confirmation Candles v10. The SPX and FOREX Version have also been updated.

I have just posted C3 v6 on pg.1 of the thread. Most notable change, arrows are back! The arrows will be triggered by the Agreement Level crossing the Confirmation Factor (now an adjustable input). Please note that this is not the same as the Consensus Level. It will be similar to the arrows in Confirmation Candles v10. The SPX and FOREX Version have also been updated.

Last edited:

Just posted the new version with arrows!Not yet unfortunately. Try to remember that the arrows and change in candle color are equivalent. So having an arrow is essentially seeing the same information twice. Another idea in the interim, is to use the Confirmation Candles for the arrows only while using the C3 study.

Thank you for catching that! Here's what I meant to post.

HI Christopher,

In the above screen shot , right side condition was not covered.

Can you please send the updated screen shot?

The condition is shown on the right side. Select value then set to 7. Hope that helps!HI Christopher,

In the above screen shot , right side condition was not covered.

Can you please send the updated screen shot?

Hi Christopher. Love your CC chart! How do you set up the watchlist column? I don't see the columns shown in your image as an option when I paste script into my Scan. Is there another way to do this?Here is a custom watchlist column for the Confirmation Candles. If you sort the column, it makes it easier to see OB/OS conditions. Especially when grouped with the Super OB/OS custom watchlist column which is also posted below.

Last edited:

Hi sectorsailor!Hi Christopher. Love your CC chart! How do you set up the watchlist column? I don't see the columns shown in your image as an option when I paste script into my Scan. Is there another way to do this?

Based on your description I’m not really sure. Can you share a screenshot of what’s going on when you try to setup the scan?

All I get are the default columns. See image attached. Queried for "Confirm_Level" but nothing shows up. Is there a way to query the scan/study for all stocks that get a new up arrow/buy signal at time of query or within specified number of candles?

Last edited:

Here's a share link to scan for a new up arrow. https://tos.mx/gtlwiP4All I get are the default columns. See image attached. Queried for "Confirm_Level" but nothing shows up. Is there a way to query the scan/study for all stocks that get a new up arrow/buy signal at time of query or within specified number of candles?

Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|

Y | Remove order confirmation from ThinkorSwim app | Questions | 1 | |

M | Single-Candle Reversal & Confirmation Pattern | Questions | 9 | |

Pivot Confirmation with Trading Levels | Indicators | 37 | ||

Volume Confirmation Indicator Version 2 | Indicators | 3 | ||

Pivot Confirmation Indicator for ThinkorSwim | Indicators | 5 |