TradingView
dman103
30 พฤศจิกา 2020 เวลา 12 นาฬิกา 14 นาที

Percentage Relative Strength 

Tesla, Inc.NASDAQ

คำอธิบาย

A relative strength indicator that compares your main symbol (one on your chart) strength to another symbol by percentage.
The result is plotted as a histogram showing which symbol is rising or falling more in percentage.
In case your chart symbol is TSLA (Tesla) and the indicator 'Symbol to compare' is SPX:

GREEN area (above zero) means TSLA is rising more than the SPX.
RED area (below zero) means TSLA is falling more than the SPX.

To these who wants to understand calculation, it's pretty straightforward.
For each asset we calculate everyday percentage change based on previous close and current close.
We take main asset (chart symbol) percentage and subtract it from percent of change of the symbol we want to compare to.
Result are smoothed by SMA (Simple Moving Average)
You can select different indexes or cfds such as S&P500 (SPX), NASDAQ 100 (NSX), RUSSELL 2000 (RUT) and NASDAQ (IXIC).
Default is S&P 500 (SPX).

Enjoy and Like if you like.

เอกสารเผยแพร่

NEW: Added option to add your own symbol! Just fill the input box with the symbol you want to compare to or use predefined presets.
Added more moving averages (EMA, RMA and WMA)

เอกสารเผยแพร่

Now it's easier than ever to compare chart to any symbol by just selecting any symbol from indicator settings.
Rearranged settings for easier use.
updated to pine script 5.0
ความคิดเห็น
epollen
Hi, shouldn't it be current_percent = (c - c[1]) / c[1] * 100 instead ? And likewise for other_percent. Like if yesterday was 50 and today is 100 then in % that would be 100%
WinnerCYI
amazing sir. can u add btc too? I want to use to alt coin chart with btc!!!!
dman103
@WinnerCYI, Hey, thanks for comment, please check latest update where it's now easier to change symbol.
Tech_Milind
Hi, this is good indicator to know the underline stock performance against its Index.
But why setting is restricted to S&P?
I am from India & we are trading in NSE Nifty50 Index.
NSE NIFTY50 index is not there to compare its stocks against the benchmark.
Can you please edit the setting & open it for all Market & their Indices?
It will be a great help to all the traders.
Thank you. 👍 👍👍
Tech_Milind
India.
dman103
@Tech_Milind, Hey, Thanks, i agree, relative strength indicators are useful, regarding S&P restriction, the initial indicator was design to compare assets (stocks) to US indexes which is useful for me and i shared with you all, note taken, Like Script/Follow me to get notified, will do a redesign or make new script in the near future and include an option to add any symbol + will add more moving averages varieties + more features.
Tech_Milind
@dman103, Thanks a lot. It will be great to all traders who are trading in different markets.
I know its really a painful job, but I appreciate your efforts for goodwill of community.
And yes, will following you.😊
Thanks. 👍👍👍
dman103
@Tech_Milind, Right, everything requires some job to get things done. i am happy to give and hopefully this will give you more winners, i have updated the script with option to add your own symbol to compare to + a few more moving averages.
Tech_Milind
@dman103, Thanks a lot. Have tested just now. And working fantastic.
Appreciated your efforts. 👍👍👍👍
Once again, thanks a lot for giving this indicator very fast.
Thank you.
manis12345
@Tech_Milind, hey i just modified for NIFTY & Banknifty index using this script, just copy it in Pine editor and save.
//@version=4
study("Percentage Relative Strength")
other_symbol = input(title="Compare To", defval="NIFTY", options=["NIFTY", "BANKNIFTY"])
enable_smoothing=input(title="Enable SMA smoothing",defval=true)
length=input(title="SMA Length",defval=7)
close_main_sec=security(other_symbol, timeframe.period, close)
c = close
current_percent = (c-c[1])/c * 100
other_percent = (close_main_sec-close_main_sec[1])/close_main_sec * 100
var val=0.0
if (enable_smoothing)
sec1=sma(current_percent,length)
sec2=sma(other_percent,length)
val:=sec1-sec2
else
val:=current_percent-other_percent
zero_line=plot(0,color=color.yellow,transp=70)
plot(val,color= val>=0 ? color.lime : color.red,style=plot.style_columns,linewidth=5)
Tech_Milind
@manis12345, Thank you Manis. For taking this pain. It is working absolutely fine.
Keep it up & thank you for helping. 👍👍👍
เพิ่มเติม