RSI + MACD Confluence Indicator for ThinkorSwim

Shinthus

Active member
2019 Donor
Thanks to BenTen's assembling skills, I bring you this indicator. I haven't named it yet, but it revolves around the RSI coming up from O/S to 34 and coming down from O/B to 66.... while the MACD crosses at the same exact time. I got this idea from Chad Brinkman's Youtube channel. He is a day trader. Check out these 3 vids to get an idea of where this came from:


Here is what the indicator looks like

zAVUG4B.png

SMKKt8k.png

DxjuQPf.png


This works on all timeframes. You can edit the MACD lengths and RSI O/S and O/B levels as you please. The indicator came hot off the script plate from BenTen with standard MACD settings but as I backtested, I realized I needed something faster. I ended up using Chad's faster settings of 6,9,and13 for MACD. As for the RSI, it's my understanding that 34/66 or 35/65 levels are pretty much equal in terms of signal quality.

Please play around with this and post your thoughts here.

Indicator: https://tos.mx/wyPd1m

Code:
plot Data = close;
# MACD+RSI 34 Trading Indicator
# Assembled by BenTen at useThinkScript.com
# Concept shared by @Ohta via Discord
# You are free to use this code for personal use, and make derivative works from it. You are NOT GRANTED permission to use this code (or derivative works) for commercial purposes which includes and is not limited to selling, reselling, or packaging with other commercial indicators. Headers and attribution in this code should remain as provided, and any derivative works should extend the existing headers.

# RSI
input length = 14;
input price = close;
input over_Bought = 66;
input over_Sold = 34;
input RSIaverageType = AverageType.WILDERS;
def NetChgAvg = MovingAverage(RSIaverageType, price - price[1], length);
def TotChgAvg = MovingAverage(RSIaverageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
def RSI = 50 * (ChgRatio + 1);
def OverSold = over_Sold;
def OverBought = over_Bought;

def RSIup = RSI crosses above OverSold;
def RSIdwn = RSI crosses below OverBought;

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

def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def Avg = MovingAverage(averageType, Value, MACDLength);

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

def UpSignal = Diff crosses above ZeroLine;
def DwnSignal = Diff crosses below ZeroLine;

plot bullish = UpSignal and RSIup;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(3);

plot bearish = DwnSignal and RSIdwn;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.CYAN);
bearish.SetLineWeight(3);
 

Attachments

  • zAVUG4B.png
    zAVUG4B.png
    84 KB · Views: 189
  • SMKKt8k.png
    SMKKt8k.png
    154.2 KB · Views: 188
  • DxjuQPf.png
    DxjuQPf.png
    172.8 KB · Views: 180
Last edited by a moderator:

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

Ok sorry to be critical of this indicator. Good job putting it together. I do not think that guy in the video understands the RSI and MACD. He is putting together two indicators measuring the same thing. Just the calculations differ. So the AH HA moment is both align . Of course they will as RSI is a first derivative of price and MACD a second. As Markos has said many times you do not want to use indicators showing the same information. The gentleman in the video has also done the same thing with the BB and Ichimoku.
Ok back to this indicator, my opinion is you will have a difficult time making the arrows work well. I think there are better indicators to use in making arrows. I have put several on this site already.
 
Ok sorry to be critical of this indicator. Good job putting it together. I do not think that guy in the video understands the RSI and MACD. He is putting together two indicators measuring the same thing. Just the calculations differ. So the AH HA moment is both align . Of course they will as RSI is a first derivative of price and MACD a second. As Markos has said many times you do not want to use indicators showing the same information. The gentleman in the video has also done the same thing with the BB and Ichimoku.
Ok back to this indicator, my opinion is you will have a difficult time making the arrows work well. I think there are better indicators to use in making arrows. I have put several on this site already.
How are the BB and Ichimoku interpreted the same way?
 
@Shinthus I am going by what the guy describes in the video. If you notice where he picks support/resistance on ichi it is very close to the midline or outer band of BB. He picks that 9.35 level, so go count the ichi ahead and see when that level appears as to when he calls it. Looks like the ichi is still heading down. That level is also close to mid BB if I remember correctly. Easy to make a video after the fact but at least make sure what you describe has actually happened. Notice how he ignores the many arrows followed by a cross that go nowhere and sometimes trades before the cross. I guess my opinion is this is not a good strategy. As long as the RSI is below 50 the strength is weak and a bounce off the 50 is a possibility. If you can make it work then go for it.
 
Hello all. I'm trying to cut and paste together a code that will show an up arrow on the bar where the MACD value, average are above 0, and the RSI is above 50. Also a down arrow for the opposite. One problem (of many) I have is that I would like the MACD to be exponential, and the RSI to be Wilders. Here is what I have put together, but does not work:

Code:
input fastLength = 3;
input slowLength = 6;
input MACDLength = 20;
input averageType = AverageType.EXPONENTIAL;

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

input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
#input averageType = AverageType.Exponential;


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

plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;
plot MidLine = 50;

plot BUYSignal = (Value > 0) and (Avg > 0) and (RSI crosses above 50);
plot SELLSignal = (Value < 0) and (Avg < 0) and (RSI crosses below 50);

BUYSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
BUYSignal.SetDefaultColor(Color.Blue);

SELLSignal.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
SELLSignal.SetDefaultColor(Color.RED);
[CODE]

ANY help appreciated, thank you.
 
#input averageTypersi = AverageType.Wilders;
def NetChgAvg = MovingAverage(averageTypersi, price - price[1], length);
def TotChgAvg = MovingAverage(averageTypersi, AbsValue(price - price[1]), length);

That is the easy part.

RSI plots 0 to 100 and MACD above and below the zero line. So you need to solve that first. Try working out the plots as a lower study first.

That is all. Good luck.
 
What do you think are the best MACD and RSI settings for a one minute chart?

Bonus question: Can you think of any indicators that are better suited for one minute charts than these? I'm currently using SuperTrend, MACD, RSI, VWAP, 9 EMA and 180 SMA trading on a one minute chart. Comments on my setup are appreciated.
 
I usually watch 3 minute charts... The current setup I've been testing with candlesticks in place of Renko Bars consists of 34HMA, 55HMA, 200HMA, all with different trend color changes, my own custom Acrylic VWAP, ZigZagPercent, sometimes OR_Study_w_Twist, my own Zscore lower indicator, and have been testing HOTZONE_RSI lower indicator... And I do use RSI either as a lower indicator or as a top Label... The length of the HMA's gets some experimentation as well...
 
I'm looking for some help on making a custom indicator looking at the Simple Moving Average (10 period) and the MACD (8,17,9). I want to be able to plot a buy or sell signal when I get 2 green or 2 red arrows respectively.

It would be preferred that the 2 arrows align in the same time period but it would also be acceptable if they are off by maybe 1 or 2 time periods if that makes sense. For example, if the MA would trigger a green first and then a candle or 2 later the MACD would trigger.

Any help on this would be greatly appreciated! Thanks so much!

laukce01
 
@laukce01 Take a look at the code above. It's similar to what you're looking for. Just need to change the RSI portion to your desired moving average.
 
Thanks Ben,

I'm pretty new to Thinkscript. Do you have any code as it pertains to the Moving Avg from another thread? I searched and nothing jumped out at me.
 
@laukce01 SMA and EMA are available in your ThinkorSwim. You should be able to get access to the code directly inside the platform.
 
I really need some help with this and I'm having trouble.

I took the RSI code as you said from above and tried to replace with the the SMA code within TOS but am not having any luck.

I basically want it so when the SMA crosses above or below the 10 SMA And when the MACD crosses above or below the zero line to give me a single red or green arrow.

I got it to work for the MACD portion but when I added the SMA part it messed it up.

Code:
plot Data = close;


# SMA
input price = close;
input length = 10;
input displace = 0;

plot SMA = Average(price[-displace], length);
plot UpSignal2 = price crosses above SMA;
plot DwnSignal2 = price crosses below SMA;

SMA.SetDefaultColor(GetColor(1));


# MACD
input fastLength = 6;
input slowLength = 9;
input MACDLength = 12;
input averageType = AverageType.EXPONENTIAL;

def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
def Avg = MovingAverage(averageType, Value, MACDLength);

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

def UpSignal = Diff crosses above ZeroLine;
def DwnSignal = Diff crosses below ZeroLine;

plot bullish = UpSignal and UpSignal2;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bullish.SetDefaultColor(Color.CYAN);
bullish.SetLineWeight(3);

plot bearish = DwnSignal and DwnSignal2;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bearish.SetDefaultColor(Color.CYAN);
bearish.SetLineWeight(3);

CORRECTION: I basically want it so when the PRICE crosses above or below the 10 SMA And when the MACD crosses above or below the zero line to give me a single red or green arrow.
 
Last edited by a moderator:
How do you attach a screenshot?

There are instances where it happens with both candles but it's also ok if they are staggered or offset by a couple candles too. For example, the SMA triggers first and then the MACD maybe a candle or 2 later and vice versus.
 
Please see screen shot below. In middle to late Aug there is a Red and Green arrow on both candles. But like I said they can be offset by several or even multiple candles.

Ss8US6x.png
 
No disrespect, but why do you need more examples? Do you not understand the goal of what I am trying to accomplish? If you pull any company on TOS with a 10 period SMA and the MACD (8,17,9) and look at 10 years of history there are plenty of examples. Again, for my purpose they don't need to be aligned during the exact time period. Please let me know if you need more clarification. Thanks!
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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