There is no shorting in this particular strategy
Did you see how well your MA cloud nailed the short on the daily?
There is no shorting in this particular strategy
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Oh yes! I have been watching it very closely. That short played out beautifully! The scan was calling out a buy on the SQQQ for about 4 days now. That played out well too.
The color of the candle and the color of the cloud aren't really what I would be looking at. I am looking at the color of the candle with the color of the channel. The channel gives you insight to the trend environment (Red Channel downtrend, Green Channel uptrend). A red candle in a green channel potentially represents weakness in a strong trend and a potential buying opportunity (in general these are the safest entry points). Conversely, a green candle in a red channel potentially represents strength in a weak trend and a potential selling opportunity. Buying in a red channel is aggressive and inherently more risky. The clouds are meant to show short term reversal potential. They can serve as an indication to take profit and reduce risk or to buy the dip. The charts in your image look like aggressive entry positions in a downtrend which can workout well depending your risk tolerance and time horizon. Definitely give the most attention to the candle signals to get in or out of trades. Be cautious of entering trades in red channels unless you are playing the mean reversion or you are shorting. Also, it looks like you may be using an older version of the indicator, I would highly suggest getting the newest version on page 1 of this thread. Thank you for testing it out! Hope this helps!HI Christopher84,
I am closely following and testing this. This is regarding two trades , NKE and SNBR, both has green cloud with Red candle, I am not sure when do I need to enter the trade, Can yo please give your thought on the below two trades. ?
Please let me know what are the other criteria need to check before enter into these trades.
hi Christ, thanks for the good work. is that a way for us to scan the green cloud?The color of the candle and the color of the cloud aren't really what I would be looking at. I am looking at the color of the candle with the color of the channel. The channel gives you insight to the trend environment (Red Channel downtrend, Green Channel uptrend). A red candle in a green channel potentially represents weakness in a strong trend and a potential buying opportunity (in general these are the safest entry points). Conversely, a green candle in a red channel potentially represents strength in a weak trend and a potential selling opportunity. Buying in a red channel is aggressive and inherently more risky. The clouds are meant to show short term reversal potential. They can serve as an indication to take profit and reduce risk or to buy the dip. The charts in your image look like aggressive entry positions in a downtrend which can workout well depending your risk tolerance and time horizon. Definitely give the most attention to the candle signals to get in or out of trades. Be cautious of entering trades in red channels unless you are playing the mean reversion or you are shorting. Also, it looks like you may be using an older version of the indicator, I would highly suggest getting the newest version on page 1 of this thread. Thank you for testing it out! Hope this helps!
Thank you for your explanation.The color of the candle and the color of the cloud aren't really what I would be looking at. I am looking at the color of the candle with the color of the channel. The channel gives you insight to the trend environment (Red Channel downtrend, Green Channel uptrend). A red candle in a green channel potentially represents weakness in a strong trend and a potential buying opportunity (in general these are the safest entry points). Conversely, a green candle in a red channel potentially represents strength in a weak trend and a potential selling opportunity. Buying in a red channel is aggressive and inherently more risky. The clouds are meant to show short term reversal potential. They can serve as an indication to take profit and reduce risk or to buy the dip. The charts in your image look like aggressive entry positions in a downtrend which can workout well depending your risk tolerance and time horizon. Definitely give the most attention to the candle signals to get in or out of trades. Be cautious of entering trades in red channels unless you are playing the mean reversion or you are shorting. Also, it looks like you may be using an older version of the indicator, I would highly suggest getting the newest version on page 1 of this thread. Thank you for testing it out! Hope this helps!
You are correct. I like buying in green clouds and taking profits in red clouds (especially with confirmation/consensus signal) because I know that I am buying low and selling high. I also like the fact that price tends to retrace these zones. They can be extremely effective for swing trades. I would highly suggest looking for a confirmation signal (arrows) in these zones or for the OB/OS signals in conjunction. It makes for a higher probability of success.Thank you for your explanation.
in one of your screenshot, you mentioned that green cloud look to buy and redcloud look to sell. That is the reason i asked but thanks for clarification.
It is possible to scan for that condition, however, I find it more useful as a watchlist column. Here's the watchlist code if you are interested. The number that shows in the column is just the average. When it turns red, there is a red cloud, green a green cloud. Hope this helps.hi Christ, thanks for the good work. is that a way for us to scan the green cloud?
#Keltner_STARC_WL
#Keltner
declare weak_volume_dependency;
input displace = 0;
input factor = 3.25;
input length = 20;
input price = close;
input averageType = AverageType.SIMPLE;
input trueRangeAverageType = AverageType.SIMPLE;
def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length);
def average = MovingAverage(averageType, price, length);
plot Avg = average[-displace];
def Upper_BandK = average[-displace] + shift[-displace];
def Lower_BandK = average[-displace] - shift[-displace];
#STARC
input ATR_length = 15;
input SMA_length = 6;
input multiplier_factor = 1.25;
def val = Average(price, sma_length);
def average_true_range = Average(TrueRange(high, close, low), length = atr_length);
def Upper_BandS = val[-displace] + multiplier_factor * average_true_range[-displace];
def Lower_BandS = val[-displace] - multiplier_factor * average_true_range[-displace];
def UP = Lower_BandS < Lower_BandK;
def DOWN = Upper_BandS > Upper_BandK;
AssignBackgroundColor(if DOWN then color.LIGHT_RED else if UP then color.dark_green else color.black);
Thank you for giving more clarificationYou are correct. I like buying in green clouds and taking profits in red clouds (especially with confirmation/consensus signal) because I know that I am buying low and selling high. I also like the fact that price tends to retrace these zones. They can be extremely effective for swing trades. I would highly suggest looking for a confirmation signal (arrows) in these zones or for the OB/OS signals in conjunction. It makes for a higher probability of success.
thanks a lot.It is possible to scan for that condition, however, I find it more useful as a watchlist column. Here's the watchlist code if you are interested. The number that shows in the column is just the average. When it turns red, there is a red cloud, green a green cloud. Hope this helps.
Code:#Keltner_STARC_WL #Keltner declare weak_volume_dependency; input displace = 0; input factor = 3.25; input length = 20; input price = close; input averageType = AverageType.SIMPLE; input trueRangeAverageType = AverageType.SIMPLE; def shift = factor * MovingAverage(trueRangeAverageType, TrueRange(high, close, low), length); def average = MovingAverage(averageType, price, length); plot Avg = average[-displace]; def Upper_BandK = average[-displace] + shift[-displace]; def Lower_BandK = average[-displace] - shift[-displace]; #STARC input ATR_length = 15; input SMA_length = 6; input multiplier_factor = 1.25; def val = Average(price, sma_length); def average_true_range = Average(TrueRange(high, close, low), length = atr_length); def Upper_BandS = val[-displace] + multiplier_factor * average_true_range[-displace]; def Lower_BandS = val[-displace] - multiplier_factor * average_true_range[-displace]; def UP = Lower_BandS < Lower_BandK; def DOWN = Upper_BandS > Upper_BandK; AssignBackgroundColor(if DOWN then color.LIGHT_RED else if UP then color.dark_green else color.black);
Now, that's what I'm talking about. Is it possible for you to share the strategy?Hi Everyone!
Just for fun, I ran my CC Candles strategy on the 2 min chart of /BTC over the last 30 days to see how it would perform. There is no shorting in this particular strategy, and it trades 1 share/coin at a time. The results were interesting. Gave me a good laugh this morning. Hope everyone is doing well. Happy trading on this bearish day!
Hi Everyone!
Just wanted to let you know that the newest version of Confirmation Candles and CC Candles (upper and lower studies) have been posted on page 1 along with an update for the Confirmation Level watchlist column. The main changes include adding a new study and reworking some of the labels. Mean Reversion label has been removed and incorporated into the Look To Buy/Look To Sell labels to help indicate confident high probability entry/exit points indicative of the trend environment. I have also included a label to show the Confirmation Level or the Consensus Level (depending on the indicator you are using). This label will go green when price is in an oversold condition and red when in an overbought condition. This can help reduce the need to use the lower indicators and saves some valuable real estate on your screen. I hope everyone likes the new changes. Thanks to everyone for your feedback!
Hi barbaros!Now, that's what I'm talking about. Is it possible for you to share the strategy?
#(Consensus Confirmation) CC Candles V.3
#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.
#Keltner Channel
declare upper;
def displace = 0;
input factorK = 2.0;
input 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;
input BulgeLengthPrice = 75;
input SqueezeLengthPrice = 75;
input BulgeLengthPrice2 = 20;
input 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 BulgePrice = Highest(price, BulgeLengthPrice);
BulgePrice.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
plot SqueezePrice = Lowest(price, SqueezeLengthPrice);
SqueezePrice.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
plot BulgePrice2 = Highest(price, BulgeLengthPrice2);
BulgePrice2.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
BulgePrice2.SetStyle(Curve.SHORT_DASH);
plot SqueezePrice2 = Lowest(price, SqueezeLengthPrice2);
SqueezePrice2.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY);
SqueezePrice2.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;
#Change in Price
def lengthCIP = 5;
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;
def condition5D = CIP_DOWN;
#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.5;
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) and (KVOsc[1] <= KVOsc);
def condition13D = (KVOH < 0) and (KVOsc[1] > KVOsc);
#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 = 3;
#Use for testing conditions individually. Remove # from line below and change Confirmation_Factor to 1.
#def Agreement_Level = condition1;
def Agreement_LevelOB = 12;
def Agreement_LevelOS = 3;
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 conditionChannel1 = Upper_BandK > price;
def conditionChannel2 = Lower_BandK < price;
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);
AddOrder(OrderType.BUY_TO_OPEN, condition = UP, price = open, 1, tickColor = GetColor(1), arrowColor = GetColor(1), name = "Long");
AddOrder(OrderType.SELL_TO_CLOSE, condition = DOWN, price = open, 1, tickColor = GetColor(2), arrowColor = GetColor(2), name = "Close");
Good Morning Trader Raider!@Christopher84, thank you for again sharing your hard work with us! I've been trying to understand differences between the Consensus Confirmation Candles v3 and Confirmation Candles v10. Looking at them side by side across multiple instruments and timeframes, I cannot find a single instance where candle colors paint differently. What I have seen is one indicator painting a cloud where the other doesn't or a momentum label flashing for one but not the other.
Both look great to me. Do you have suggestions about circumstances where one would be more advantageous over the other? Are the Consensus Candles geared for mixed market conditions and the Confirmation Candles for strongly bullish scenarios? Feel free to address me like I'm a second grader because I'm not certain I get this
Thank you @Christopher84. The price entries probably needs to be the next candle's open. If the buy and sell are being triggered at the current candle, you can't realistically put an order in place for the same candle at open.Hi barbaros!
Sure, I am happy to share. The code isn't fully cleaned up, I am working on that currently. The signals still work great though. Let me know what you think.
Code:#(Consensus Confirmation) CC Candles V.3 #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. #Keltner Channel declare upper; def displace = 0; input factorK = 2.0; input 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; input BulgeLengthPrice = 75; input SqueezeLengthPrice = 75; input BulgeLengthPrice2 = 20; input 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 BulgePrice = Highest(price, BulgeLengthPrice); BulgePrice.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY); plot SqueezePrice = Lowest(price, SqueezeLengthPrice); SqueezePrice.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY); plot BulgePrice2 = Highest(price, BulgeLengthPrice2); BulgePrice2.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY); BulgePrice2.SetStyle(Curve.SHORT_DASH); plot SqueezePrice2 = Lowest(price, SqueezeLengthPrice2); SqueezePrice2.AssignValueColor(if (conditionK2) then Color.GREEN else if (conditionK3) then Color.RED else Color.GRAY); SqueezePrice2.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; #Change in Price def lengthCIP = 5; 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; def condition5D = CIP_DOWN; #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.5; 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) and (KVOsc[1] <= KVOsc); def condition13D = (KVOH < 0) and (KVOsc[1] > KVOsc); #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 = 3; #Use for testing conditions individually. Remove # from line below and change Confirmation_Factor to 1. #def Agreement_Level = condition1; def Agreement_LevelOB = 12; def Agreement_LevelOS = 3; 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 conditionChannel1 = Upper_BandK > price; def conditionChannel2 = Lower_BandK < price; 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); AddOrder(OrderType.BUY_TO_OPEN, condition = UP, price = open, 1, tickColor = GetColor(1), arrowColor = GetColor(1), name = "Long"); AddOrder(OrderType.SELL_TO_CLOSE, condition = DOWN, price = open, 1, tickColor = GetColor(2), arrowColor = GetColor(2), name = "Close");
AddOrder(OrderType.BUY_TO_OPEN, condition = UP, price = open[-1], 1, tickColor = GetColor(1), arrowColor = GetColor(1), name = "Long");
AddOrder(OrderType.SELL_TO_CLOSE, condition = DOWN, price = open[-1], 1, tickColor = GetColor(2), arrowColor = GetColor(2), name = "Close");
Thank you for the great feedback! I can't tell you how many times that's happened to me. That's one of the reasons I set out coding this indicator was to help take doubt out of my decision making process.This has to be one of the best indicators I have ever used. I played with LRCX AND AMZN. Profit on LRCX 0ver 9,000. Both CALL/PUTS AMZN $465.00 on a put. So mad at myself I should have trusted the chart! Would have 10 times my money with AMZN.
I did change the macd to 8/16/10 Time frames 1 minute 5 minute 10 minute and 15 min.
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.