TotalCap RSI and Pressure Candle
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CuerpoTiempoEspacio
study(title = "TotalCap RSI and Pressure Candle", overlay=false)
//@version=4

TotalCapHigh= security('CRYPTOCAP:TOTAL', resolution= timeframe.period, expression=high)
TotalCapLow= security('CRYPTOCAP:TOTAL', resolution= timeframe.period, expression=low)
TotalCapOpen= security('CRYPTOCAP:TOTAL', resolution= timeframe.period, expression=open)
TotalCapClose= security('CRYPTOCAP:TOTAL', resolution= timeframe.period, expression=close)
Bearich= TotalCapOpen>TotalCapClose?1:na
Bullish= TotalCapOpen<TotalCapClose?1:na

Pressure= Bullish? TotalCapHigh : Bearich? TotalCapLow : TotalCapClose
RSIperiod= input(title="RSI Period", type=input.integer, defval=7)
ShowCandle= input(title="Show Pressure Candles", type=input.bool, defval=true)
RSI=rsi(Pressure,RSIperiod)

plot(RSI, color= RSI>=65 or RSI<=35? color.black : color.silver, linewidth=2, editable=true)
fill(hline(70),hline(80), color=color.red, transp=80)
fill(hline(30),hline(20), color=color.green, transp=80)

//Liquidations Leves
fill(hline(80),hline(100), color=color.yellow, transp=80)
fill(hline(20),hline(0), color=color.yellow, transp=80)
plot(50, color=color.black, transp=90)

barcolor(ShowCandle and pivotlow(close,10,0) and low[1]>close and open>close and RSI<=30? color.red :na, editable=true)
barcolor(ShowCandle and pivothigh(close,10,0) and high[1]<close and close>open and RSI>=70? color.green :na, editable=true)
