5-in 1 (rsi,aroon,stoch,macd,adx di) For ThinkOrSwim

Tradervic

Member
VIP
5 indicators in 1.
You can choose which one you want to see (rsi ,aroon,macd,stoch or adx di)
Useful to save space for other indicators

6TfHtsb.png


Hello everyone.....can someone convert this indicator 5 in 1 (rsi,aroon,stoch,macd,adx di) MarcoValente
https://www.tradingview.com/script/W9mKJhJF/
The 5 in 1 is quite useful.
 
Last edited by a moderator:

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

Hello everyone.....can someone convert this indicator that Silverblade asked about? The 5 in 1 is quite useful.
check the below.

CSS:
#study(title="5 in 1 ", shorttitle="5 in 1", overlay=false)
declare lower;


input showAroon = no; #e,title="AROON")
input aroonLength = 14; #, minval=1)
input showRsi = yes; #input(true,title="RSI");
input rsiSource = close;
input rsiLength = 14; #, minval=1, title="Length RSI")
input rsiSmoothing = 5; #, minval=1, title="Length sma RSI")
input showMacd = no; #input(false,title="MACD")
input macdSource = close;
input macdFastLength = 12; #, minval=1),
input macdSlowLength = 26; #,minval=1)
input macdSignalLength = 9; #,minval=1)
input showStochastic = no; #,title="STOCHASTIC")
input periodK = 14; #, title="K", minval=1)
input periodD = 3; #, title="D", minval=1)
input smoothK = 3; #, title="Smooth", minval=1)
input showAdx = no; #,title="ADX DI")
input diLength = 14; #, minval=1, title="DI Length")
input adxSmoothingLength = 14; #, title="ADX Smoothing", minval=1, maxval=50)
input adxThreshold = 25; #(title="threshold", type=integer, defval=25)

def na = Double.NaN;
def last = IsNaN(close);
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;

#-- color
DefineGlobalColor("line", CreateColor(59, 179, 228));
DefineGlobalColor("swa", CreateColor(255, 0, 0));
DefineGlobalColor("purple", Color.MAGENTA);
DefineGlobalColor("orange", Color.ORANGE);

# stoch(source, high, low, length) =>
script stoch {
input src = close;
input h = high;
input l = low;
input len = 14;
    def hh = highest(h, len);
    def ll = lowest(l, len);
    def stoch = 100 * (src - ll) / (hh - ll);
    plot return = stoch;
}

def upper = aroonLength - 100 * (GetMaxValueOffset(high, aroonLength + 1) + aroonLength) / aroonLength;
def lower = aroonLength - 100 * (GetMinValueOffset(low,  aroonLength + 1) + aroonLength) / aroonLength;

def oscillator = upper - lower;

plot osc = if showAroon then oscillator else na; #, color=red)
plot mp = if showAroon and !last then 0 else na;
plot top = if showAroon and !last then 85 else na;
plot bot = if showAroon and !last then -85 else na;
osc.SetDefaultColor(GlobalColor("swa"));
top.SetDefaultColor(GlobalColor("line"));
bot.SetDefaultColor(GlobalColor("line"));

def co = if oscillator >= 95 and oscillator[1] >= oscillator then -1 else
         if oscillator <= -88  then 1 else 0;
def bgswaUp = co > 0 or co[1] > 0;
def bgswaDn = co < 0 or co[1] < 0;

AddCloud(if showAroon and bgswaUp then pos else na, neg, Color.DARK_GREEN);
AddCloud(if showAroon and bgswaDn then pos else na, neg, Color.DARK_RED);

# //rsi
def nRSI = RSI(Price = rsiSource, length = rsiLength);
def mr = Average(nRSI, rsiSmoothing);

plot rsiLine = if showRsi then nRSI else na; #,title="RSI", color=purple,transp=0)
plot smoothRSi = if showRsi then mr else na; #,title="sma RSI", color=red,transp=0)
plot h00 = if !last and showRsi then 70 else na;
plot mid = if !last and showRsi then 50 else na;
plot h11 = if !last and showRsi then 30 else na;

rsiLine.SetDefaultColor(GlobalColor("purple"));
smoothRSi.SetDefaultColor(GlobalColor("orange"));
h00.SetDefaultColor(GlobalColor("line"));
mid.SetDefaultColor(Color.GRAY);
h11.SetDefaultColor(GlobalColor("line"));

#//macd
def fastMA = ExpAverage(macdSource, macdFastLength);
def slowMA = ExpAverage(macdSource, macdSlowLength);
def macd = fastMA - slowMA;
def signal = ExpAverage(macd, macdSignalLength);
def hist = macd - signal;

plot Diff = if showMacd then hist else na; #, color=red, style=histogram)
plot Value = if showMacd then macd else na; #, color=blue)
plot Avg = if showMacd then signal else na; #, color=orange)

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"));

#//stoc
def k = Average(stoch(close, high, low, periodK), smoothK);
def d = Average(k, periodD);

plot kLine = if showStochastic then k else na; #, title="%K", color=blue)
plot dLine = if showStochastic then d else na; #, title="%D", color=orange)

def h0 = if !last and (showStochastic) then 80 else na;
def h1 = if !last and (showStochastic) then 20 else na;

AddCloud(h0, h1, Color.PLUM, Color.PLUM, yes);

#//ADX
def hiDiff = high - high[1];
def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def trur = atr(Length = diLength);
def plus = 100 * WildersAverage(plusDM, diLength) / trur;
def minus = 100 * WildersAverage(minusDM, diLength) / trur;
def DX = if (plus + minus > 0) then 100 * AbsValue(plus - minus) / (plus + minus) else 0;
def ADX = WildersAverage(DX, adxSmoothingLength);

plot "+DI" = if showAdx then plus else na; #, color=blue, title="+DI")
plot "-DI" = if showAdx then minus else na; #, color=orange, title="-DI")
plot nADX = if showAdx then adx else na; #, color=red, title="ADX")
plot th = if !last and showAdx then adxThreshold else na; #, color=black, title="th")

"+DI".SetDefaultColor(Color.CYAN);
"-DI".SetDefaultColor(Color.DARK_ORANGE);
nADX.SetDefaultColor(Color.WHITE);
th.SetDefaultColor(Color.GRAY);
#-- END of CODE
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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