//@version=4
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("0930-1130", "Baseline", input.session)
blt = time(timeframe.period, baselinetime+":1234567")
analysisrange = input("1130-1730", "analysisrange", input.session)
ar = time(timeframe.period, analysisrange+":1234567")
p (_blt, _ar) =>
highe_01 = 0.0
lowe_01 = 10e10
p=0.
var midpoint=0.
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
if _ar
p:=((close - midpoint)/midpoint)*100
else
p:=na
p
//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
//p0 = p(blt, ar) // for the current ticker
p1 = security(Coin01, timeframe.period, p(blt, ar))
p2 = security(Coin02, timeframe.period, p(blt, ar))
p3 = security(Coin03, timeframe.period, p(blt, ar))
plot(p1, title="Coin01", color=color.red, linewidth=2, style=plot.style_linebr)
plot(p2, title="Coin02", color=color.green, linewidth=2, style=plot.style_linebr)
plot(p3, title="Coin03", color=color.blue, linewidth=2, style=plot.style_linebr)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…