# C-Deck combo

#### horserider

##### Well-known member
VIP
Merry Christmas. A holiday contribution since it is so colorful with the red and green of the season. Developed by C-Deck with some instructions for use in the header of the code. All the combo and dot lovers rejoice.

Code:
# MyCollection
#
# Developed by C-Deck
#
# All indicators (green = Buy) .. (Red = Sell)
# except ADX blue means trending .. white means range-bound
# Last three are my entry signals.
declare lower;

input MA_Price = Close;
input MA1Length = 3;
input MA2Length = 5;
input MA3Length = 8;
input MA4Length = 13;
input MA5Length = 21;
input MA6Length = 34;
def ma1 = Average(MA_Price, MA1Length);
def MA2 = Average(MA_Price, MA2Length);
def ma3 = Average(MA_Price, MA3Length);
def ma4 = Average(MA_Price, MA4Length);
def ma5 = Average(MA_Price, MA5Length);
def ma6 = Average(MA_Price, MA6Length);

Plot topline = 1.13;
topline.HideBubble();
#topline.Hide();
topline.AssignValueColor( Color.black);

Plot MA1S =  if !IsNaN(close) then 1.1 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 1.1, concat( "MA-" , MA1Length), color.White, yes);
MA1S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
MA1S.AssignValueColor(
if close > MA1 then Color.Green
else Color.Red);
MA1S.HideBubble();

Plot MA2S =  if !IsNaN(close) then 1.05 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 1.05, concat( "MA-" , MA2Length), color.White, yes);
MA2S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
MA2S.AssignValueColor(
if close > MA2 then Color.Green
else Color.Red);
MA2S.HideBubble();
Plot MA3S =  if !IsNaN(close) then 1 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close ,1, concat( "MA-" , MA3Length), color.White, yes);
MA3S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
MA3S.AssignValueColor(
if close > MA3 then Color.Green
else Color.Red);
MA3S.HideBubble();
Plot MA4S = if !IsNaN(close) then 0.95 else double.Nan;
MA4S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
AddChartBubble(IsNaN(MA1[-1]) && close , 0.95, concat( "MA-" , MA4Length), color.White, yes);
MA4S.AssignValueColor(
if close > MA4 then Color.Green
else Color.Red);
MA4S.HideBubble();
Plot MA5S = if !IsNaN(close) then 0.90 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close ,0.9, concat( "MA-" , MA5Length), color.White, yes);
MA5S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
MA5S.AssignValueColor(
if close > MA5 then Color.Green
else Color.Red);
MA5S.HideBubble();
Plot MA6S =  if !IsNaN(close) then 0.85 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 0.85, concat( "MA-" , MA6Length), color.White, yes);
MA6S.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
MA6S.AssignValueColor(
if close > MA6 then Color.Green
else Color.Red);
MA6S.HideBubble();
###########################################################
input TS_price = close;
input TS_length = 9;
input bar_plus = 4;

def TSF = Inertia(TS_price, TS_length) - LinearRegressionSlope(TS_price, TS_length) * bar_plus;
plot TSFvalue =  if !IsNaN(close) then 0.8 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 0.8, concat( "TimeSeries" , ""), color.White, yes);
TSFvalue.SetPaintingStrategy(paintingStrategy.liNE_VS_TRIANGLES);
TSFvalue.AssignValueColor(
if close > TSF then Color.Green
else Color.Red);
TSFvalue.HideBubble();
########################################################

plot ADXCross = if !IsNaN(close) then 0.75 else double.Nan;
if  ADX > 25 then Color.Blue
else Color.White);
########################################################
input DMIlength = 13;

def hiDiff = high - high[1];
def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = WildersAverage(TrueRange(high, close, low), DMIlength);
Def DIPlus = 100 * WildersAverage(plusDM, DMIlength) / ATR;
Def DIMinus = 100 * WildersAverage(minusDM, DMIlength) / ATR;
Plot dmiSignal =  if !IsNaN(close) then 0.73 else double.Nan;
dmiSignal.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);

dmiSignal.AssignValueColor(
if DIPlus > DIMinus then Color.Green
else if DIMinus > DIPlus then Color.Red
else Color.White);
dmiSignal.HideBubble();

##############################################
input Fishlength = 7;
def maxHigh = Highest(high, FISHlength);
def minLow = Lowest(low, FISHlength);

rec value = if maxHigh - minLow == 0 then 0 else 0.66 * ((HL2 - minLow) / (maxHigh - minLow) - 0.5) + 0.67 * value[1];

def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;

rec fish = 0.5 * (log((1 + truncValue) / (1 - truncValue)) + fish[1]);

plot FT = if !IsNaN(close) then 0.65 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 0.65,  "Fisher" , color.White, yes);
FT.SetPaintingStrategy(paintingStrategy.liNE_VS_TRIANGLES);
FT.AssignValueColor(
if fish > fish[1] then Color.Green
else Color.Red);
FT.HideBubble();
#################################################
input averageType = {Simple, Exponential, default Weighted, Wilders, Hull,  Disabled};
input BoPlength = 16;

def rawBMP = if high != low then (close - open) / (high - low) else 1;

def BMP;
switch (averageType) {
case Simple:
BMP = Average(rawBMP, BoPlength);
case Exponential:
BMP = ExpAverage(rawBMP, BoPlength);
case Weighted:
BMP = wma(rawBMP, BoPlength);
case Wilders:
BMP = WildersAverage(rawBMP, BoPlength);
case Hull:
BMP = HullMovingAvg(rawBMP, BoPlength);
case Disabled:
BMP = rawBMP;
}
plot BoP =  if !IsNaN(close) then 0.6 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 0.6,  "BoP" , color.White, yes);
BoP.SetPaintingStrategy(paintingStrategy.liNE_VS_SQUARES);
BoP.AssignValueColor(
if BMP > 0 then Color.Green
else Color.Red);

BoP.HideBubble();
########################################################
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

def SMI = avgrel / (avgdiff / 2) * 100;

def AvgSMI = ExpAverage(smi, percentDLength);

#def diffr = smi - avgsmi;

plot SM =  if !IsNaN(close) then 0.55 else double.Nan;
AddChartBubble(IsNaN(MA1[-1]) && close , 0.55,  "Stoc-Mom" , color.White, yes);
SM.SetPaintingStrategy(paintingStrategy.liNE_VS_TRIANGLES);
SM.AssignValueColor(
if smi > avgsmi then Color.Green
else Color.Red);
SM.HideBubble();

VIP

#### HighBredCloud

##### Well-known member
@horserider This looks very interesting...Thanks and Merry X-Mas!

#### irishgold

##### Active member
How about Up arrow at first bottom 3 greens and no current up_arrow then Dn_arrow first bottom 3 reds and no current red dn_arrow. Though, I know it could get busy on short duration chart. I just don't know how to limit it to the first time it turns green or red and not repeat until it starts a new
Code:
# MyCollection
#
# Developed by C-Deck
#
# All indicators (green = Buy) .. (Red = Sell)
# except ADX blue means trending .. white means range-bound
# Last three are my entry signals.

input MA_Price = Close;
input MA1Length = 3;
def ma1 = Average(MA_Price, MA1Length);

###########################################################
input TS_price = close;
input TS_length = 9;
input bar_plus = 4;

def TSF = Inertia(TS_price, TS_length) - LinearRegressionSlope(TS_price, TS_length) * bar_plus;

########################################################

########################################################
input DMIlength = 13;

def hiDiff = high - high[1];
def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM = if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = WildersAverage(TrueRange(high, close, low), DMIlength);
def DIPlus = 100 * WildersAverage(plusDM, DMIlength) / ATR;
def DIMinus = 100 * WildersAverage(minusDM, DMIlength) / ATR;

##############################################
input Fishlength = 7;
def maxHigh = Highest(high, Fishlength);
def minLow = Lowest(low, Fishlength);

rec value = if maxHigh - minLow == 0 then 0 else 0.66 * ((HL2 - minLow) / (maxHigh - minLow) - 0.5) + 0.67 * value[1];

def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;

rec fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);

#################################################
input averageType = {Simple, Exponential, default Weighted, Wilders, Hull, Disabled};
input BoPlength = 16;

def rawBMP = if high != low then (close - open) / (high - low) else 1;

def BMP;
switch (averageType) {
case Simple:
BMP = Average(rawBMP, BoPlength);
case Exponential:
BMP = ExpAverage(rawBMP, BoPlength);
case Weighted:
BMP = WMA(rawBMP, BoPlength);
case Wilders:
BMP = WildersAverage(rawBMP, BoPlength);
case Hull:
BMP = HullMovingAvg(rawBMP, BoPlength);
case Disabled:
BMP = rawBMP;
}
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

def SMI = avgrel / (avgdiff / 2) * 100;

def AvgSMI = ExpAverage(SMI, percentDLength);

def bullish =  SMI > AvgSMI and BMP > 0 and fish > fish[1];
plot upArrow = bullish;
upArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
upArrow.setDefaultColor(color.GREEN);

def bearish =  SMI < AvgSMI and BMP < 0 and fish < fish[1];
plot dnArrow = bearish;
dnArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
dnArrow.setDefaultColor(color.RED);

#### irishgold

##### Active member
but it still pretty busy.

#### horserider

##### Well-known member
VIP
Inventive and interesting but only need this code.

Code:
##############################################
input Fishlength = 7;
def maxHigh = Highest(high, Fishlength);
def minLow = Lowest(low, Fishlength);

rec value = if maxHigh - minLow == 0 then 0 else 0.66 * ((HL2 - minLow) / (maxHigh - minLow) - 0.5) + 0.67 * value[1];

def truncValue = if value > 0.99 then 0.999 else if value < -0.99 then -0.999 else value;

rec fish = 0.5 * (Log((1 + truncValue) / (1 - truncValue)) + fish[1]);

#################################################
input averageType = {Simple, Exponential, default Weighted, Wilders, Hull, Disabled};
input BoPlength = 16;

def rawBMP = if high != low then (close - open) / (high - low) else 1;

def BMP;
switch (averageType) {
case Simple:
BMP = Average(rawBMP, BoPlength);
case Exponential:
BMP = ExpAverage(rawBMP, BoPlength);
case Weighted:
BMP = WMA(rawBMP, BoPlength);
case Wilders:
BMP = WildersAverage(rawBMP, BoPlength);
case Hull:
BMP = HullMovingAvg(rawBMP, BoPlength);
case Disabled:
BMP = rawBMP;
}
input percentDLength = 3;
input percentKLength = 5;

def min_low = Lowest(low, percentKLength);
def max_high = Highest(high, percentKLength);
def rel_diff = close - (max_high + min_low) / 2;
def diff = max_high - min_low;

def avgrel = ExpAverage(ExpAverage(rel_diff, percentDLength), percentDLength);
def avgdiff = ExpAverage(ExpAverage(diff, percentDLength), percentDLength);

def SMI = avgrel / (avgdiff / 2) * 100;

def AvgSMI = ExpAverage(SMI, percentDLength);

def bullish =  SMI > AvgSMI and BMP > 0 and fish > fish[1];
plot upArrow = bullish;
upArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
upArrow.setDefaultColor(color.GREEN);

def bearish =  SMI < AvgSMI and BMP < 0 and fish < fish[1];
plot dnArrow = bearish;
dnArrow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
dnArrow.setDefaultColor(color.RED);

#### J007RMC

##### Well-known member
2019 Donor
I am continually amazed by the great scripts you write.

#### HighBredCloud

##### Well-known member
I really like this study...but why is this Fisher Transform plotting differently than it should? I understand that its set to 7 instead of 10...but even if all settings are equal there is still a difference in the way that it plots...

Anyway to add StochRSI to this? I feel like the signal on higher timeframes would come on faster...

#### pk1729

##### Member
VIP
Quick question @horserider, you mentioned bottom 3 are your entry signal. Do you wait for all 3 to turn green/red or any 2 green/red works? Also, what about exit signal? Does it work on all time frames?

#### horserider

##### Well-known member
VIP
@pk1729 That was the comment of the original coder. Not using it but main idea is more green = buy and vice versa. I think you will need to observe it and decide what combo of green or red dots will be your buy and sell points. Should be fine for all time frames.

##### Member
VIP
@horserider The work done on this was amazing!!! Question... Is there a way to hide the white MA labels that are on the far right so that you can see the trends in real-time? Could the MA labels be moved to the left instead?

#### BenTen

Staff member
Staff
VIP
@andre.muhammad Look for anything that starts with AddChartBubble and uncomment it or exclude it from the script.

##### Member
VIP
I think I messed up the script

Edit: I fixed it, Thanks!

#### allnetbrett

##### New member
VIP
When I enter code, its giving me an error for "declare lower;". Can someone assist? It seems to be the only error in the script

## The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
• Exclusive indicators
• Proven strategies & setups
• Private Discord community
• Exclusive members-only content
• 1 full year of unlimited support

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?