vitvlkv

Advance Decline Ratio (Custom)

3779 views
166
Built-in indicator ADR shows only NYSE data. This script allows you select the exchange to use.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
study(title="Advance Decline Ratio (Custom)", shorttitle="ADR_Custom")
src = input(close)
exch = input(0, "Exchange to use: 0-Total, 1-NYSE, 2-AMEX, 3-OTC, 4-ETFS, 5-NASD, 6-TSX", minval=0, maxval=6)
pr = "INDEX"
suffix = exch == 1 ? "N" : 
    exch == 2 ? "A" : 
    exch == 3 ? "D" :
    exch == 4 ? "E" : 
    exch == 5 ? "Q" :
    exch == 6 ? "S" :
    exch == 0 ? "T" : 
    ""
adv = security(tickerid(pr, "ADV" + suffix), period, src)
dec = security(tickerid(pr, "DEC" + suffix), period, src)
plot(adv / dec)

Comments

Hi

thank you. I copied your scrip and obtained the following error message:-

Processing script...
line 6: syntax error at input 'end of line without line continuation'
Script 'My ADR(vitvlkv)' has been saved
Script text is not modified, nothing to save

Code was:-
suffix = exch == 1 ? "N" : (This is line 6 - as per your script)

fyi, I tried compiling with versions 3 and 4 - same error

I would appreciate your advise. Kind Regards.
+8 Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter