TradingView
Daveatt
29 มิถุนา 2019 เวลา 7 นาฬิกา 53 นาที

Dividing 2 symbols 

Bitcoin / USTBitfinex

คำอธิบาย

Hello Traders

This indicator is used to divide two assets between them. Why you would ask ?
For instance, in crypto trading, traders often look at the ratio Longs/Shorts or Shorts/Longs to figure out which side is leading the market and use this information as a powerful hedge for their next trade

Enjoy
Dave
ความคิดเห็น
Tyno
Thanks a lot. I was looking for such a script.
MarkBench
Thanks mate, exactly what I was looking for.
Daveatt
@MarkBench, Glad it's helping you out :)
dle7319
Hello Daveatt,
How can I add RSI indicator to this dividing 2 symbols combination? The reason is that I would like to see the relative strengh indication of these 2 symbols combination.
Thanks a lot.

dle7319
Daveatt
@dle7319, not sure if it will work with the option "Add indicator on ..."
This will require some pinescripting like this

//@version=4 study(title="Dividing 2 RSI", shorttitle="Dividing 2 RSI", overlay=false) i_a = input(defval=14, type=input.integer, title="RSI 1") i_b = input(defval=7, type=input.integer, title="RSI 2") symbol1 = input("MSFT", type=input.symbol title="Symbol 1") symbol2 = input("APPL", type=input.symbol title="Symbol 2") a = rsi(close, i_a) b = rsi(close, i_b) as = security(symbol1, timeframe.period, a) bs = security(symbol2, timeframe.period, b) plot(as / bs, title="DIV", color=blue)
dle7319
@Daveatt, thnks a lot, Daveatt. I really appriciated it.
IhorZenich
This is a good indicator to understand when it is worth selling one coin to buy another.
TremendousF
do you know how to make it negative if the shorts are grater than the longs? Something like this?

```
ratio= if (BTCUSDLONGS >= BTCUSDSHORTS) then (BTCUSDLONGS / BTCUSDSHORTS) else -(BTCUSDSHORTS / BTCUSDLONGS
not sure how to apply it to pine script

```
Thanks!
Daveatt
@TremendousF,

symbol1 = input("BTCUSDLONGS", type=input.symbol title="Symbol 1")
symbol2 = input("BTCUSDSHORTS", type=input.symbol title="Symbol 2")

as = security(symbol1, timeframe.period, close)
bs = security(symbol2, timeframe.period, close)

var float ratio = 0.

if (as >= bs)
ratio := as/bs
else
ratio := -1 * (bs / as)

plot(ratio)
เพิ่มเติม