Chaiken Money Flow (CMF), RSI and MACD For ThinkOrSwim

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
Chaiken Money Flow (CMF), RSI and MACD as a combined trading signal.
Ruby:
# Chaikin Money Flow, RSI and MACD Combined Signal Mobius 08.22.2021

declare lower;

input longLengthCMF = 10;
input shortLengthCMF = 3;
input lengthRSI = 14;
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.EXPONENTIAL;
input averageTypeRSI = AverageType.WILDERS;

script S
    {
     input c = close;
     def Min = -100;
     def Max = 100;
     def hh = highestAll(c);
     def ll = lowestAll(c);
     plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
    }
def c = close;
def h = high;
def l = low;
def v = volume;
def NetChgAvg = MovingAverage(averageTypeRSI, c - c[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(c - c[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def CLV = if h != l then ((c - l) - (h - c)) / (h - l) else 1;
def AccDist = (TotalSum(v * CLV));
plot Value = S(MovingAverage(averageTypeMACD, close, fastLengthMACD) -
               MovingAverage(averageTypeMACD, close, slowLengthMACD));
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot RSI = S(50 * (ChgRatio + 1));
plot COSC = s(ExpAverage(accDist, shortLengthCMF) - ExpAverage(accDist, longLengthCMF));
plot zero = if isNaN(c) then double.nan else 0;
     Value.AssignValueColor(if Value > Avg then color.green else color.red);
     Avg.AssignValueColor(if Value > Avg then color.green else color.red);
     RSI.AssignValueColor(if RSI > 0 then color.green else color.red);
     COSC.AssignValueColor(if COSC > 0 then color.green else color.red);
     zero.SetDefaultColor(Color.Light_Gray);
def up = Value > Avg and RSI > 0 and COSC > 0;
def dn = Value < Avg and RSI < 0 and COSC < 0;
addCloud(Value, Avg, color.green, color.red);
addCloud(if up then 100 else double.nan, -100, color.green);
addCloud(if dn then 100 else double.nan, -100, color.red);
 
Last edited:

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

Chaiken Money Flow (CMF), RSI and MACD as a combined trading signal.
Ruby:
# Chaikin Money Flow, RSI and MACD Combined Signal
# Mobius
# ThinkOrSwim Reddit Group Request 08.22.2021

declare lower;

input longLengthCMF = 10;
input shortLengthCMF = 3;
input lengthRSI = 14;
input fastLengthMACD = 12;
input slowLengthMACD = 26;
input MACDLength = 9;
input averageTypeMACD = AverageType.EXPONENTIAL;
input averageTypeRSI = AverageType.WILDERS;

script S
    {
     input c = close;
     def Min = -100;
     def Max = 100;
     def hh = highestAll(c);
     def ll = lowestAll(c);
     plot Range = (((Max - Min) * (c - ll)) /  (hh - ll)) + Min;
    }
def c = close;
def h = high;
def l = low;
def v = volume;
def NetChgAvg = MovingAverage(averageTypeRSI, c - c[1], lengthRSI);
def TotChgAvg = MovingAverage(averageTypeRSI, AbsValue(c - c[1]), lengthRSI);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def CLV = if h != l then ((c - l) - (h - c)) / (h - l) else 1;
def AccDist = (TotalSum(v * CLV));
plot Value = S(MovingAverage(averageTypeMACD, close, fastLengthMACD) -
               MovingAverage(averageTypeMACD, close, slowLengthMACD));
plot Avg = MovingAverage(averageTypeMACD, Value, MACDLength);
plot RSI = S(50 * (ChgRatio + 1));
plot COSC = s(ExpAverage(accDist, shortLengthCMF) - ExpAverage(accDist, longLengthCMF));
plot zero = if isNaN(c) then double.nan else 0;
     Value.AssignValueColor(if Value > Avg then color.green else color.red);
     Avg.AssignValueColor(if Value > Avg then color.green else color.red);
     RSI.AssignValueColor(if RSI > 0 then color.green else color.red);
     COSC.AssignValueColor(if COSC > 0 then color.green else color.red);
     zero.SetDefaultColor(Color.Light_Gray);
def up = Value > Avg and RSI > 0 and COSC > 0;
def dn = Value < Avg and RSI < 0 and COSC < 0;
addCloud(Value, Avg, color.green, color.red);
addCloud(if up then 100 else double.nan, -100, color.green);
addCloud(if dn then 100 else double.nan, -100, color.red);
@MerryDay this is an amazing indicator.. Needs adoption from all TOS / Usethinkscipt users... many thanks!!!!
 
and how to use?
Cycle, trend and momentum are the 3 types of indicators recommended for standard chart setups. RSI & MACD are the standards of technical analysis. When they are combined with a Money Flow and Support and Resistance, they illustrate where a stock is within its trending cycle and provide viable trading zones.

Use with your favorite strategy: When all lines are green. Your trade is going well. As lines turn red, use your favorite exit indicator to look to end your trade.

Pros: As with all oscillators, when trending, this provides profitable entry / exit zones with significant success.
Cons: When a stock is ranging, oscillators are rife with false signals.
There is no way to know at time of signal whether you are going to range or trend.
 
Last edited:
I would recommend adding the Wilder ADX as an important trend indicator. I have found that properly calibrated RSI and ADX together are very valuable for trading. I also don't use MACD, but choice of indicators is always a personal one, whatever works for the trader is all that is important. ☺
 
Cycle, trend and momentum are the 3 types of indicators recommended for standard chart setups. RSI & MACD are the standards of technical analysis. When they are combined with a Money Flow and Support and Resistance, they illustrate where a stock is within its trending cycle and provide viable trading zones.

Use with your favorite strategy: When all lines are green. Your trade is going well. As lines turn red, use your favorite exit indicator to look to end your trade.

Pros: As with all oscillators, when trending, this provides profitable entry / exit zones with significant success.
Cons: When a stock is ranging, oscillators are rife with false signals.
There is no way to know at time of signal whether you are going to range or trend.
What time zones do you find this works best on? I am watching this morning and on my 1, 5, and 15 minute charts it seems very productive.

I may be breaking from the pack by scalping stocks but I find that being very controlled with my strategy it has been very successful for me. I am centered around the 5 minute chart but also reference 1 minute and 15 minute. Target only stocks positive on the day supported by high volume. I utilize the opening 30 minute range as a baseline and watch for pullbacks and momentum type action. This indicator, although I have only experimented with this morning, seems to help capture the strength of the movement.
 
Last edited by a moderator:
What time zones do you find this works best on? I am watching this morning and on my 1, 5, and 15 minute charts it seems very productive.
Cycle, Trend, Momentum indicators work on all the timeframes of both the swing and the day trader.
Scalping with these on the 1minute can be problematic as the Chaiken and the MACD are lagging indicators.
Read more about scalping on the one minute on the VIP forum: https://usethinkscript.com/threads/scalping-basics-for-thinkorswim.10900/

I may be breaking from the pack by scalping stocks but I find that being very controlled with my strategy it has been very successful for me. I am centered around the 5 minute chart but also reference 1 minute and 15 minute. Target only stocks positive on the day supported by high volume. I utilize the opening 30 minute range as a baseline and watch for pullbacks and momentum type action. This indicator, although I have only experimented with this morning, seems to help capture the strength of the movement.

Not breaking with the pack at all. You have a textbook setup for daytrading:
  • The use of non-collinear indicators on multi-timeframes.
  • Centered around the 5 minute chart.
  • Looking at the overall picture and finding impetus on the 30 minute chart.
  • Finding entry on the one minute chart.

Excellent job! Great post! Thanks for sharing!
 
Last edited:
I would recommend adding the Wilder ADX as an important trend indicator. I have found that properly calibrated RSI and ADX together are very valuable for trading. I also don't use MACD, but choice of indicators is always a personal one, whatever works for the trader is all that is important. ☺
@scott69 is the ADX more of a leading indicator or is it more of a lagging indicator? Never used it, what are your calibration settings and what timeframe do you trade on with it?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
577 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