Searching For Specific MACD Indicators

xiaoriver

New member
Looking for: FVO_MACD_with_RSI_Stochastic_cloud, looks interesting too. Tried to search and google for it, nothing came up. Anyone able to share this too?
 
Last edited by a moderator:
@xiaoriver this might be it:

#START OF RSI/Stochastic/MACD Confluence combo for ThinkOrSwim
#
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
# - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
# Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
# Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
#
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
# Stoch Slow 5(not14) and 3 WILDERS
# MACD 12,26,9 WEIGHTED
#
#
#CREDITS
# requesed by "@Joseph Patrick 18"
#
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#
#USAGE
#

declare lower;


################################################################
########## MACD #########
################################################################
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignalMACD = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignalMACD.SetHiding(!showBreakoutSignals);
DownSignalMACD.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(Color.GREEN);
Avg.SetDefaultColor(Color.RED);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(4);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignalMACD.SetDefaultColor(Color.UPTICK);
UpSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignalMACD.SetDefaultColor(Color.DOWNTICK);
DownSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


################################################################
########## RSI #########
################################################################
input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
#input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);


################################################################
########## Stochastic Slow #########
################################################################
input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;

################################################################
########## Check for signals > 50 and macd Value > Avg ########
################################################################
def rsiGreen = if RSI >= 50 then 1 else Double.NaN;
def rsiRed = if RSI < 50 then 1 else Double.NaN;
def stochGreen = if SlowK >= 50 then 1 else Double.NaN;
def stochRed = if SlowK < 50 then 1 else Double.NaN;
def macdGreen = if Value > Avg then 1 else Double.NaN;
def macdRed = if Value < Avg then 1 else Double.NaN;


#################################################################
############ Shade areas based on criteria; adjust as needed ##
#################################################################
AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);
 
@xiaoriver this might be it:

#START OF RSI/Stochastic/MACD Confluence combo for ThinkOrSwim
#
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
# - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
# Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
# Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
#
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
# Stoch Slow 5(not14) and 3 WILDERS
# MACD 12,26,9 WEIGHTED
#
#
#CREDITS
# requesed by "@Joseph Patrick 18"
#
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#
#USAGE
#

declare lower;


################################################################
########## MACD #########
################################################################
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.WEIGHTED;
input showBreakoutSignals = no;

plot Value = MovingAverage(averageTypeMACD, close, fastLengthMACD) - MovingAverage(averageTypeMACD, close, slowLengthMACD);
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot Diff = Value - Avg;
plot ZeroLine = 0;
plot UpSignalMACD = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignalMACD = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;

UpSignalMACD.SetHiding(!showBreakoutSignals);
DownSignalMACD.SetHiding(!showBreakoutSignals);

Value.SetDefaultColor(Color.GREEN);
Avg.SetDefaultColor(Color.RED);
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(4);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignalMACD.SetDefaultColor(Color.UPTICK);
UpSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignalMACD.SetDefaultColor(Color.DOWNTICK);
DownSignalMACD.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);


################################################################
########## RSI #########
################################################################
input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
#input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);


################################################################
########## Stochastic Slow #########
################################################################
input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;

################################################################
########## Check for signals > 50 and macd Value > Avg ########
################################################################
def rsiGreen = if RSI >= 50 then 1 else Double.NaN;
def rsiRed = if RSI < 50 then 1 else Double.NaN;
def stochGreen = if SlowK >= 50 then 1 else Double.NaN;
def stochRed = if SlowK < 50 then 1 else Double.NaN;
def macdGreen = if Value > Avg then 1 else Double.NaN;
def macdRed = if Value < Avg then 1 else Double.NaN;


#################################################################
############ Shade areas based on criteria; adjust as needed ##
#################################################################
AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);

Thanks, @Jack Sprat I loaded the script to TOS and got this. It is different from RedToGreen's cloud version. But looks very interesting. Definitely much better than the standard MACD. I am gonna play with it in next few days.

grPer2m.jpg
 
Added macd divergence line



#START OF RSI/Stochastic/MACD Confluence combo for ThinkOrSwim
#
#CHANGELOG
# 2020.10.27 V1.0 @cos251 - Added RSI, StochasticSlow and MACD to same indicator; this will plot only MACD but also
# - calculates RSI and Sotchasit; Will shade the lower plot area of the following conditions are met
# Shade GREEN = RSI > 50 and SlowK > 50 and (macd)Value > (macd)Avg
# Shade RED = RSI < 50 and SlowK < 50 and (macd)Value < (macd)Avg
#
#REQUIREMENTS - RSI Set to 7, EXPONENTIAL
# Stoch Slow 5(not14) and 3 WILDERS
# MACD 12,26,9 WEIGHTED
#
#
#CREDITS
# requesed by "@Joseph Patrick 18"
#
#LINK
# https://rockwell-files.s3.amazonaws.com/PXCompanionGuide2ndEd_cover.pdf
# Markus Heikoetter who is the author of the Power X Strategy
# https://usethinkscript.com/threads/mimicking-power-x-strategy-by-markus-heitkoetter.4283/
#
#USAGE
#

declare lower;


################################################################
########## MACD #########
################################################################
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input MACD_Type = {default "Standard", "Volume Weighted"};
input averageType = AverageType.EXPONENTIAL;

def fastAvg;
def slowAvg;

switch (MACD_Type) {
case "Standard":
fastAvg = MovingAverage(averageType, close, fastLength);
slowAvg = MovingAverage(averageType, close, slowLength);
case "Volume Weighted":
fastAvg = sum(volume * close, fastLength) / sum(volume, fastLength);
slowAvg = Sum(volume * close, slowLength) / Sum(volume, slowLength);
}

plot Value = fastAvg - slowAvg;
plot Avg = MovingAverage(averageType, Value, MACDLength);

plot Diff = Value - Avg;
plot ZeroLine = 0;

Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.color("Positive and Up") else Diff.color("Positive and Down") else if Diff < Diff[1] then Diff.color("Negative and Down") else Diff.color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));

def V = Diff < 0 and Diff < Diff[1] and Diff < Diff[-1];
def firstV = if Diff > 0 then 0 else if V then 1 else firstV[1];
def LD = if Diff crosses below 0 then Diff else if Diff < LD[1] then Diff else LD[1];
def vBar = if Diff == LD then BarNumber() else vBar[1];
def pvBar = if Diff crosses above 0 then vBar[1] else pvBar[1];
def bullV = (V and firstV[1] == 0 and Diff > GetValue(Diff, BarNumber() - pvBar)) and (low < GetValue(low, BarNumber() - pvBar));

def A = Diff > 0 and Diff > Diff[1] and Diff > Diff[-1];
def firstA = if Diff < 0 then 0 else if A then 1 else firstA[1];
def HD = if Diff crosses above 0 then Diff else if Diff > HD[1] then Diff else HD[1];
def aBar = if Diff == HD then BarNumber() else aBar[1];
def paBar = if Diff crosses below 0 then aBar[1] else paBar[1];
def bearA = (A and firstA[1] == 0 and Diff < GetValue(Diff, BarNumber() - paBar)) and (high > GetValue(high, BarNumber() - paBar));

def lastBar = HighestAll(if !IsNaN(close) then BarNumber() else 0);
# calculate bull div line
def cnV = fold i = 1 to lastBar with b = Double.NaN while IsNaN(b) do if GetValue(bullV, -i) == 1 then i else Double.NaN;
def startBullDiv = BarNumber() == GetValue(pvBar, -cnV);
def isBullDiv = if startBullDiv then 1 else if bullV[1] then 0 else isBullDiv[1];
def mBull = if startBullDiv then (GetValue(Diff, -cnV) - Diff) / cnV else mBull[1];
def line1 = if startBullDiv then Diff + (LowestAll(value) * 0.05) else line1[1] + mBull;
plot bullDivLine = if isBullDiv then line1 else Double.NaN;
bullDivLine.SetDefaultColor(Color.YELLOW);
bullDivLine.SetLineWeight(2);

# calculate bear div line
def cnA = fold j = 1 to lastBar with c = Double.NaN while IsNaN(c) do if GetValue(bearA, -j) == 1 then j else Double.NaN;
def startBearDiv = BarNumber() == GetValue(paBar, -cnA);
def isBearDiv = if startBearDiv then 1 else if bearA[1] then 0 else isBearDiv[1];
def mBear = if startBearDiv then (GetValue(Diff, -cnA) - Diff) / cnA else mBear[1];
def line2 = if startBearDiv then Diff + (HighestAll(value) * 0.05) else line2[1] + mBear;
plot bearDivLine = if isBearDiv then line2 else Double.NaN;
bearDivLine.SetDefaultColor(Color.DARK_ORANGE);
bearDivLine.SetLineWeight(2);


################################################################
########## RSI #########
################################################################
input lengthRSI = 7;
input over_BoughtRSI = 70;
input over_SoldRSI = 30;
input price = close;
input averageTypeRSI = AverageType.EXPONENTIAL;
#input showBreakoutSignals = no;

def NetChgAvg = MovingAverage(averageTypeRSI, price - price[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(price - price[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;

def RSI = 50 * (ChgRatio + 1);


################################################################
########## Stochastic Slow #########
################################################################
input over_boughtSt = 80;
input over_soldSt = 20;
input KPeriod = 5;
input DPeriod = 3;
input priceH = high;
input priceL = low;
input priceC = close;
input averageTypeStoch = AverageType.WILDERS;
input showBreakoutSignalsStoch = {default "No", "On SlowK", "On SlowD", "On SlowK & SlowD"};

def SlowK = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullK;
def SlowD = reference StochasticFull(over_boughtSt, over_soldSt, KPeriod, DPeriod, priceH, priceL, priceC, 3, averageTypeStoch).FullD;

################################################################
########## Check for signals > 50 and macd Value > Avg ########
################################################################
def rsiGreen = if RSI >= 50 then 1 else Double.NaN;
def rsiRed = if RSI < 50 then 1 else Double.NaN;
def stochGreen = if SlowK >= 50 then 1 else Double.NaN;
def stochRed = if SlowK < 50 then 1 else Double.NaN;
def macdGreen = if Value > Avg then 1 else Double.NaN;
def macdRed = if Value < Avg then 1 else Double.NaN;


#################################################################
############ Shade areas based on criteria; adjust as needed ##
#################################################################
AddCloud(if rsiGreen and stochGreen and macdGreen then Double.POSITIVE_INFINITY else Double.NaN, if rsiGreen and stochGreen then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_Green);
AddCloud(if rsiRed and stochRed and macdRed then Double.POSITIVE_INFINITY else Double.NaN, if rsiRed and stochRed then Double.NEGATIVE_INFINITY else Double.NaN, Color.LIGHT_RED);
 
I am new to the forum and I'm having a little trouble finding a couple of indicators I've seen in pictures on various threads. Specifically, I am looking for the thinkscript code for the FVO_MACD_WITH_RSI_STOCHASTIC_CLOUD as well as the thinkscript code for the AA_MACD_COLORED_TRACKS. I originally located these on pictures shared by @J007RMC on a thread that can no longer be commented on. Any assistance would be greatly appreciated. Thanks in advance!
 
# MAC
# MACD with colored slope
# 04_2019

declare lower;

input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;

plot Value = MACD(fastLength, slowLength, MACDLength, averageType).Value;
plot Avg = MACD(fastLength, slowLength, MACDLength, averageType).Avg;
plot ZeroLine = 0;

Value.setpaintingStrategy(paintingStrategy.HISTOGRAM);
Value.assignValueColor(if Value > Value[1] then Color.GREEN else Color.RED);
Avg.assignValueColor(if Avg > Avg[1] then Color.YELLOW else Color.RED);
ZeroLine.SetDefaultColor(GetColor(0));
 

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
509 Online
Create Post

Similar threads

Similar threads

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