CRISIS

(CRISIS) BTC money flow oscilator V0.1

Modified version of Ricado Santos' money flow oscilator.

now featuring 3 oscilators. Makes it easier to obseerve when dumps/pumps are targeting OKC futures contracts or just looking for divergences.

1x Aggregate of OKcoin:BTCCNY, Houbi:BTCCNY & Bitfinex:BTCUSD (Orange)
1X OKcoin 1 Week futures (pink)
1x OKcoin 3 Month futures (purple)
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study(title="BTC MFO V0.1", shorttitle="MFO")
//Modification of Ricardo Santos Money flow osccilator (https://www.tradingview.com/script/1heGd4MD-RS-Money-Flow-Oscillator-V0/)
// Now 3 Oscicilators.
//First show combined MFO from 3 sources (Def. BITFINEX,OKC,HOUBI).
//Second and Third show single sources (Def. OKC 2M & 1W futures).

// ****Money flow oscillator 1 Inputs****

Indlength = input(title='MFO1(Agg.Ind) Length', type=integer, defval=20, minval=1)
//IndSHOW_BC = input(title='Show MFO1(Agg.Ind) Bar Colors', type=bool, defval=false)

// ****MFO Index Securities****

IndVol1Input = input(defval="BITFINEX:BTCUSD", title="MFO1(Agg.Ind): Primary Security?", type=symbol, confirm=true)
IndVol1 = security(IndVol1Input, period, volume)

UseIndVol2 = input(true, title="MFO1(Agg.Ind): Use Second security?")
IndVol2Input = input(defval="OKCOIN:BTCCNY", title="MFO1(Agg.Ind): Second security", type=symbol, confirm=true)
IndVol2Value = security(IndVol2Input, period, volume)
IndVol2 = UseIndVol2 ?  IndVol2Value : 0

UseIndVol3 = input(true, title="MFO1(Agg.Ind): Use Third security?")
IndVol3Input = input(defval="HUOBI:BTCCNY", title="MFO1(Agg.Ind): Third security", type=symbol, confirm=true)
IndVol3Value = security(IndVol3Input, period, volume)
IndVol3 = UseIndVol3 ?  IndVol3Value : 0
//IndMyVol = na(IndVol1+IndVol2+IndVol3) ? 0 : (IndVol1+IndVol2+IndVol3)
IndMyVol = IndVol1+IndVol2+IndVol3

// ****Money flow oscillator 2 Inputs****
length1w = input(title='MFO2: length', type=integer, defval=20, minval=1)
//SHOW_BC1w = input(title='Show MFO2 Bar Colors', type=bool, defval=false)
MFO2Input = input(defval="OKCOIN:BTCUSD1W", title="MFO2: Security", type=symbol, confirm=true)
Vol1w = security (MFO2Input, period, volume)

// ****Money flow oscillator 3 Inputs****
length3m = input(title='MFO3: Length', type=integer, defval=20, minval=1)
//SHOW_BC3m = input(title='Show MFO3 Bar Colors', type=bool, defval=false)
MFO3Input = input(defval="OKCOIN:BTCUSD3M", title="MFO3: Security", type=symbol, confirm=true)
Vol3m = security(MFO3Input, period, volume)

// ****Money flow oscillator (Agg) 1****

IndDvs = (high - low[1]) + (high[1] - low)
IndMLTP = na(IndDvs) ? 0 : IndDvs != 0 ? round(((high - low[1]) - (high[1] - low )) / IndDvs) : 0
IndDvsv = IndMyVol != 0 ? IndMyVol : 0
IndMFV = IndMLTP * IndMyVol
IndMFO = sum( IndMFV, Indlength ) / sum( IndDvsv, Indlength )
plot(IndMFO, title="MFO 1", linewidth=3, transp=0, color =orange)
//barcolor(not IndSHOW_BC? na : IndMFO>=0?lime:red)

// ****Money flow oscillator 2****

Dvs1w = (high - low[1]) + (high[1] - low)
MLTP1w = na(Dvs1w) ? 0 : Dvs1w != 0 ? round(((high - low[1]) - (high[1] - low )) / Dvs1w) : 0
MyVol1w = na(Vol1w) ? 0 : (Vol1w)
Dvsv1w = MyVol1w != 0 ? MyVol1w : 0
MFV1w = MLTP1w * MyVol1w
MFO1w = sum( MFV1w, length1w ) / sum( Dvsv1w, length1w )
plot(MFO1w, title="MFO2", linewidth=2, transp=0, color=#FF00FC)
//barcolor(not SHOW_BC1w? na : MFO1w>=0?lime:red)

// ****Money flow oscillator 3****

Dvs3m = (high - low[1]) + (high[1] - low)
MLTP3m = na(Dvs3m) ? 0 : Dvs3m != 0 ? round(((high - low[1]) - (high[1] - low )) / Dvs3m) : 0
MyVol3m = na(Vol3m) ? 0 : (Vol3m)
Dvsv3m = MyVol3m != 0 ? MyVol3m : 0
MFV3m = MLTP3m * MyVol3m
MFO3m = sum( MFV3m, length3m ) / sum( Dvsv1w, length3m )
plot(MFO3m, title="MFO3", linewidth=2, transp=0, color=#A600FF)
//barcolor(not SHOW_BC3m? na : MFO3m>=0?lime:red)

// Plotmmid line
plot(0, title = "Zero Line", color = white, linewidth = 1)