// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/ // © maruful_bd_yhoo //@version=5 indicator("~OI", "OI", overlay = true, format = format.volume) c14 = color.rgb(192,192,192, 30) c15 = color.rgb(211,211,211, 70) //++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Features of this script: OI //++++++++++++++++++++++++++++++++++++++++++++++++++++++ string openInterestTicker = syminfo.tickerid string timeframe = syminfo.type == "futures" and timeframe.isintraday ? "1D" : timeframe.period [oiOpen, oiHigh, oiLow, oiClose, oiColorCond] = request.security(openInterestTicker, timeframe, [open, high, low, close, close > close[1]], ignore_invalid_symbol = true) oiOpen := oiOpen ? oiOpen : na oiHigh := oiHigh ? oiHigh : na oiLow := oiLow ? oiLow : na if barstate.islastconfirmedhistory and na(oiClose) runtime.error(str.format("No Open Interest data found for the `{0}` symbol.", userSymbol)) hasOHLC = ta.cum(oiOpen) color openInterestColor = oiColorCond ? color.teal : color.red //plot(hasOHLC ? na : oiClose, "Futures Open Interest", openInterestColor, style = plot.style_stepline, linewidth = 4) //plotcandle(oiOpen, oiHigh, oiLow, hasOHLC ? oiClose : na, "Crypto Open Interest", color = openInterestColor, wickcolor = openInterestColor, bordercolor = openInterestColor) // OI normalized //oi_norm = (oiClose - oiLow) / (oiHigh - oiLow) //ma = ta.ema(oi_norm, 12) //plot( oi_norm, style = plot.style_areabr, color = color.rgb(242,243,244, 80)) //plot(oi_norm, color = color.white)