I would like to apply the below to several securities.
The end product would display 3 lines showing percentage change from 1700 to 2100 using a baseline of midpoint from 1500 to 1700 using lowest and highest candle from that period.
For example I would like to monitor these 3 securities:
BINANCE:NEBLUSD
BINANCE:RSRUSD
BINANCE:TRXUSD
study("Baseline", overlay=false)
Coin01 = input(title = "Coin Selection", defval="BINANCE:NEBLUSD")
Coin02 = input(title = "Coin Selection", defval="BINANCE:RSRUSD")
Coin03 = input(title = "Coin Selection", defval="BINANCE:TRXUSD")
baselinetime = input('1500-1700:1234567', title="Baseline")
blt = time(timeframe.period, baselinetime)
analysisrange = input('1700-2100:1234567', title="analysisrange")
ar = time(timeframe.period, analysisrange)
var highe_01 = 0.0
var lowe_01 = 10e10
if blt
if not blt[1]
highe_01 := high
lowe_01 := low
else
highe_01 := max(high, highe_01)
lowe_01 := min(low, lowe_01)
midpoint = (highe_01+lowe_01)/2
inc = (close - midpoint)//change(close, length)
p = (inc/close)*100
//This enables me to view the chosen coin on the chart
plot(ar ? p : na, title="Percentage Change", color=color.blue, linewidth=2, style=plot.style_linebr)
//How do I apply the above formula to several coins? The below doesn't work, but can't get my head around how to apply it
plot(Coin01 : p : na, title="Coin01", color=color.red, linewidth=2, style=plot.stle_linebr)
plot(Coin02 : p : na, title="Coin01", color=color.green, linewidth=2, style=plot.stle_linebr)
plot(Coin03 : p : na, title="Coin01", color=color.blue, linewidth=2, style=plot.stle_linebr)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…