Inflow Outflow Money Flow Indicator
NOTE: This is a approximate notional value that should be close/near to the official records
Code:
declare lower;
##### Inflow Outflow Money Flow Indicator
##### Coded By XeoNoX
##### Version 1.3
##### July 12, 2023
##### All rights reserved
##### This software is inteded for OpenSource and for individual use only.
input show_label =yes;
def O = open;
def H = high;
def C = close;
def L = low;
def V = volume;
def Buying = V * (C - L) / (H - L);
def Selling = V * (H - C) / (H - L);
# Selling Volume
def SV = (Selling) * (-1);
# Buying Volume
def BV = Buying;
# Note that Selling + Buying Volume = Total Volume.
def moneyflow = absValue(BV + SV);
def buysell= if close >open then AbsValue(moneyflow) else if close<open then AbsValue(moneyflow)*-1 else if close==close then 0 else 0;
plot mfdollars = (buysell * close);
mfdollars.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
mfdollars.SetLineWeight(2);
mfdollars.DefineColor("Positive and Up", Color.GREEN);
mfdollars.DefineColor("Positive and Down", Color.YELLOW);
mfdollars.DefineColor("Negative and Down", Color.RED);
mfdollars.DefineColor("Negative and Up", Color.ORANGE);
mfdollars.AssignValueColor(if mfdollars >= 0 then if mfdollars > mfdollars[1] then mfdollars.color("Positive and Up") else mfdollars.color("Positive and Down") else if mfdollars < mfdollars[1] then mfdollars.color("Negative and Down") else mfdollars.color("Negative and Up"));
plot ZeroLine = 0;
ZeroLine.SetLineWeight(2);
ZeroLine.SetDefaultColor(CreateColor(204, 0, 51));
plot priceLine = highestAll(if isNaN(close[-1]) then if high >= close then mfdollars else double.nan else Double.NaN);
priceline.SetPaintingStrategy(PaintingStrategy.line);
priceLine.SetLineWeight(1);
priceLine.SetDefaultColor(CreateColor(50,250,150));
priceline.HideTitle();
def roundedbillions = round((mfdollars/1000000000),2);
AddLabel(show_label, if AbsValue(mfdollars) > 999999999.999 then "Inflow/Outflow: $" + roundedbillions + " Billion" else "Inflow/Outflow: $" + round(mfdollars,-4)/ 1000000 + " Million",if mfdollars >= .001 then color.uptick else if mfdollars <= .001 then color.downTICK else color.gray);
Last edited: