RSI DEMA For ThinkOrSwim

Cybersloth

Member
VIP
I recently read about a strategy utilizing RSI set at 14 with a 40 period double exponential moving average on the RSI as a crossover signal. I've studied the application of simple and other standard moving averages applied to RSI, and standard moving average crossovers, but can't figure out how to apply/plot a double exponential moving average. Can someone please show me how, if this is feasible in TOS?

Could somebody PLEASE help me with this? Is it not possible to put a DEMA on another lower indicator such as the RSI in TOS?

This puts DEMA on the RSI lower indicator. This will work for all your lower indicators.
Although, there is not a huge difference from the regular RSI; it is possible that this slight change will reduce false signals

Rich (BB code):
``````# RSI DEMA
# @MerryDay 5/1/2022
declare lower;

input length = 40;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;

# Original Average Calculations
#def NetChgAvg = MovingAverage(averageType, price - price[1], length);
#def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);

# DEMA Average Calculations
def NetChgAvg = DEMA(price - price[1], length);
def TotChgAvg = DEMA(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;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);``````

Last edited:

Not the exact question you're looking for?

87k+ Posts
138 Online

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?