CryptoCurrency Short X-Ray
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EsIstTurnt

//@version=5
indicator("CryptoCurrency Short X-Ray")
tf        =input.timeframe('',title='TimeFrame')
btcshorts ='BTCUSDSHORTS'
ethshorts ='ETHUSDSHORTS'
solshorts ='SOLUSDSHORTS'
adashorts ='ADAUSDSHORTS'
xmrshorts ='XMRUSDSHORTS'
xrpshorts ='XRPUSDSHORTS'
allshorts ='BTCUSDSHORTS+ETHUSDSHORTS+SOLUSDSHORTS+ADAUSDSHORTS+XMRUSDSHORTS+XRPUSDSHORTS'
o_btc_short =request.security('BTCUSDSHORTS',tf,open )
h_btc_short =request.security('BTCUSDSHORTS',tf,high )
l_btc_short =request.security('BTCUSDSHORTS',tf,low  )
c_btc_short =request.security('BTCUSDSHORTS',tf,close)

o_eth_short =request.security('ETHUSDSHORTS',tf,open )
h_eth_short =request.security('ETHUSDSHORTS',tf,high )
l_eth_short =request.security('ETHUSDSHORTS',tf,low  )
c_eth_short =request.security('ETHUSDSHORTS',tf,close)

o_sol_short =request.security('SOLUSDSHORTS',tf,open )
h_sol_short =request.security('SOLUSDSHORTS',tf,high )
l_sol_short =request.security('SOLUSDSHORTS',tf,low  )
c_sol_short =request.security('SOLUSDSHORTS',tf,close)

o_ada_short =request.security('ADAUSDSHORTS',tf,open )
h_ada_short =request.security('ADAUSDSHORTS',tf,high )
l_ada_short =request.security('ADAUSDSHORTS',tf,low  )
c_ada_short =request.security('ADAUSDSHORTS',tf,close)

o_xmr_short =request.security('XMRUSDSHORTS',tf,open )
h_xmr_short =request.security('XMRUSDSHORTS',tf,high )
l_xmr_short =request.security('XMRUSDSHORTS',tf,low  )
c_xmr_short =request.security('XMRUSDSHORTS',tf,close)

o_xrp_short =request.security('XRPUSDSHORTS',tf,open )
h_xrp_short =request.security('XRPUSDSHORTS',tf,high )
l_xrp_short =request.security('XRPUSDSHORTS',tf,low  )
c_xrp_short =request.security('XRPUSDSHORTS',tf,close)
current   =request.security(syminfo.ticker ,tf,close)
all       =request.security('allshorts',tf,close)
combined  =math.avg(c_btc_short,c_eth_short,c_sol_short,c_ada_short,c_xmr_short,c_xrp_short)
shortdata =input.string(btcshorts,"Short Data Stream",options = [btcshorts,ethshorts,solshorts,adashorts,xmrshorts,xrpshorts,allshorts])


o_datastream=request.security(shortdata,tf,open )
h_datastream=request.security(shortdata,tf,high )
l_datastream=request.security(shortdata,tf,low  )
c_datastream=request.security(shortdata,tf,close)

shortsup  =(c_datastream>=c_datastream[1])
shortsdn  =(c_datastream<=c_datastream[1])
currentup =( current  >= current[1])
currentdn =(current   <=current[1])

shorting = shortsup and currentdn
covering = shortsdn and currentup

buying   = currentup and not covering  
selling  = currentdn and not shorting  


shortcolor=shorting?color.new(input.color(color.orange,title='Shorts Shorting'),0):selling?color.new(input.color(color.red,title='People are Selling'),0):covering?color.new(input.color(color.blue,title='Shorts are Covering'),0):buying?color.new(input.color(color.green,title='People are Buying'),0):color.gray
highshorts=ta.highest(h_datastream,1024)
lowshorts=ta.lowest(l_datastream  ,1024)
avshorts=math.avg(highshorts,lowshorts)
havshorts=math.avg(highshorts,avshorts)
lavshorts=math.avg(avshorts,lowshorts)

//plot(factorstream,color=currentchange>datachange?color.red:color.green)
plotcandle(o_datastream,h_datastream,l_datastream,c_datastream,color=shortcolor,wickcolor=shortcolor,bordercolor=shortcolor)
plot(highshorts,color=color.new(h_datastream>=highshorts?na:color.gray,20)  ,linewidth=1)
plot(lowshorts ,color=color.new(l_datastream<=lowshorts ?na:color.gray,20)  ,linewidth=1)
plot(avshorts ,color=color.new(color.white,50)  ,linewidth=1)
plot(havshorts ,color=color.new(color.black,20)  ,linewidth=1)
plot(lavshorts ,color=color.new(color.black,20)  ,linewidth=1)

//plot(formatted)



