#### germanburrito

##### Active member

I seen people talk about the Twiggs Money Flow but I could not find it any where, so here is a version of it.

Code:

```
declare lower;
input periods = 21;
input over_Bought = .20;
input over_Sold = -.20;
def C = close;
def H = high;
def L = low;
def V = volume;
def TRH = Max(H,C[1]);
def TRL = Min(L, C[1]);
def TR = TRH - TRL;
def ADV =((C-TRL)-(TRH-C))/ (If TR == 0 then 999999 else TR) * V;
plot NewCMF = if WildersAverage(V,periods) == 0
then 0
else WildersAverage(ADV, periods) / WildersAverage(V, periods);
plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GetColor(5));
plot OverSold = over_Sold;
plot OverBought = over_Bought;
NewCMF.DefineColor("OverBought", GetColor(5));
NewCMF.DefineColor("Normal", GetColor(7));
NewCMF.DefineColor("OverSold", GetColor(1));
NewCMF.AssignValueColor(if NewCMF > over_Bought then NewCMF.color("OverBought") else if NewCMF < over_Sold then NewCMF.color("OverSold") else NewCMF.color("Normal"));
```

Last edited by a moderator: