Triangular Moving Average (TMA) Slope Indicator For ThinkOrSwim

tophatkelly

New member
The TMA Slope oscillator is a simple slope of a Triangular Moving Average compared and normalized with the Average True Range of the last 100 periods (default setting).

I have looked high and low and can't seem to find this one indicator for TOS. I can easily get it for MT4 which I have been using for years. The code is available for tradingview as well. I can't possibly be the first to request this one...
 
@tophatkelly try this.

Ruby:
#TMASlopeOscillator
#Coverted by @SuryaKiranC
#Convered on 01/05/2022
#Requested by @tophatkelly
#Requested at https://usethinkscript.com/threads/triangular-moving-average-tma-slope-indicator-for-thinkorswim.9465
#Original Source https://www.tradingview.com/script/CHfAkivN-The-TMA-Slope-TMSlope-Oscillator/

declare lower;

DefineGlobalColor("gadblUp1",CreateColor(0,128,0));
DefineGlobalColor("gadblUp2",CreateColor(0,255,0));
DefineGlobalColor("gadblDn1",CreateColor(178,34,34));
DefineGlobalColor("gadblDn2",CreateColor(255,0,0));
DefineGlobalColor("gadblMid1",CreateColor(221,166,237));
DefineGlobalColor("gadblMid2",CreateColor(166,237,211));

input x = close;
input eintPeriod =    20;
input  edblHigh1 =  0.04;
input   edblLow1 = -0.04;
input  atrPeriod =   100;

def calcAtr = atr(atrPeriod);
def dblTma = SimpleMovingAvg(SimpleMovingAvg(x, eintPeriod), eintPeriod);
def dblPrev = dblTma[1];
def gadblSlope = ( dblTma - dblPrev ) / calcAtr;

plot  gadblUp1 = if(gadblSlope[0] > edblHigh1) and (gadblSlope[0] < gadblSlope[1]) then gadblSlope[0] else 0.0;
plot  gadblUp2 = if(gadblSlope[0] > edblHigh1) and (gadblSlope[0] > gadblSlope[1]) then gadblSlope[0] else 0.0;
plot  gadblDn1 = if(gadblSlope[0] < edblLow1)  and (gadblSlope[0] > gadblSlope[1]) then gadblSlope[0] else 0.0;
plot  gadblDn2 = if(gadblSlope[0] < edblLow1)  and (gadblSlope[0] < gadblSlope[1]) then gadblSlope[0] else 0.0;
plot gadblMid1 = if(gadblSlope[0] > gadblSlope[1]) then gadblSlope[0] else 0.0;
plot gadblMid2 = if(gadblSlope[0] < gadblSlope[1]) then gadblSlope[0] else 0.0;

gadblUp1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblUp1.SetDefaultColor(GlobalColor("gadblUp1"));
gadblUp1.SetLineWeight(4);
gadblUp2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblUp2.SetDefaultColor(GlobalColor("gadblUp2"));
gadblUp2.SetLineWeight(4);
gadblDn1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblDn1.SetDefaultColor(GlobalColor("gadblDn1"));
gadblDn1.SetLineWeight(4);
gadblDn2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblDn2.SetDefaultColor(GlobalColor("gadblDn2"));
gadblDn2.SetLineWeight(4);
gadblMid1.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblMid1.SetDefaultColor(GlobalColor("gadblMid1"));
gadblMid1.SetLineWeight(4);
gadblMid2.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
gadblMid2.SetDefaultColor(GlobalColor("gadblMid2"));
gadblMid2.SetLineWeight(4);
#End
 
Last edited:

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
304 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