Twiggs Money Flow [Lazy Bear]

523 0
// @author LazyBear
// @credits
// If you use this code in its original/modified form, do drop me a note.
// Two Features Added by User ChrisMoody -
// TMF Line to be uses with Histogram(Easier to Spot Divergences)
// Thresh Hold lines showing extremes - adjustable.
study("Twiggs Money Flow ", shorttitle="LB_TMF")
length = input( 21, " TMF Period")
sh = input(true, title="Show Histogram?")
sl = input(true, title="Show TMF Line?")
//stl = input(true, title="Use Threshold Lines Color Change?")
sw = input(false, title="If Not Using Threshold Lines Color Change Change Below Values to 0")
upper_threshold = input(.1, minval=0, title="UpperThreshold ---- Default Value .1")
lower_threshold = input(-.1, minval=-1, title="Lower Threshold ---- Default Value -.1")

WiMA( src , length) =>
MA_s=( src + nz (MA_s * (length-1)))/length

adv=volume*((close-tr_l)-(tr_h-close))/ iff(tr_c==0,9999999,tr_c)
wmV= WiMA(wv,length)
wmA= WiMA( adv ,length)
tmf= iff(wmV==0,0,wmA/wmV)

c = tmf >= upper_threshold ? lime : tmf < lower_threshold ? red : yellow

plot(sh and tmf ? tmf : na, title="Twiggs Money Flow Histogram", style=histogram, linewidth=3, color=c)
plot(sl and sma ( tmf , 1) ? sma ( tmf , 1) : na, title="Twiggs Money Flow Line", style=line, linewidth=4, color=white)
hline(0, title="0 Line", color=silver, linestyle=solid, linewidth=3)
hline(upper_threshold, title="Upper Threshold", linewidth=3, color=gray)
hline(lower_threshold, title="Lower Threshold", linewidth=3, color=gray)
Remove from Favorite Scripts Add to Favorite Scripts
Home Stock Screener Forex Screener Crypto Screener Economic Calendar Shows How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Help Center Refer a friend Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Refer a friend My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out