ChrisMoody

CM_Twiggs Money Flow

Full Credit goes to LazyBear for publishing Original Code.
I added:
Threshold lines that changes the color of Histogram based on if it exceeds Threshold lines. Ability to turn off and on.
Ability to Turn Histogram Off/On
Ability to turn Twiggs Money Flow Line Off/On

Skript med en öppen källkod

I sann TradingView-anda har författaren publicerat detta skript med öppen källkod så att andra handlare kan förstå och verifiera det. Hatten av för författaren! Du kan använda det gratis men återanvändning av den här koden i en publikation regleras av våra ordningsregler. Du kan ange den som favorit för att använda den i ett diagram.

Frånsägelse av ansvar

Informationen och publikationerna är inte avsedda att vara, och utgör inte heller finansiella, investerings-, handels- eller andra typer av råd eller rekommendationer som tillhandahålls eller stöds av TradingView. Läs mer i Användarvillkoren.

Vill du använda det här skriptet i ett diagram?
// @author LazyBear
// @credits http://www.incrediblecharts.com/indicators/twiggs_money_flow.php
// 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, histogram changes color based on threshold lines.
study("CM_Twiggs Money Flow", shorttitle="CM_TMF", overlay=false)
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_thresh = input(1, minval=0, title="UpperThreshold -- X .1 so 1 = .1")
lower_thresh = input(-1, minval=-3, title="Lower Threshold -- X .1 so -1 = -.1")

WiMA(src, length) => 
    MA_s=(src + nz(MA_s[1] * (length-1)))/length
    MA_s
  
upper_threshold = upper_thresh * .1
lower_threshold = lower_thresh * .1

tr_h=max(close[1],high)
tr_l=min(close[1],low)
tr_c=tr_h-tr_l
adv=volume*((close-tr_l)-(tr_h-close))/ iff(tr_c==0,9999999,tr_c)
wv=volume+(volume[1]*0)
wmV= WiMA(wv,length)
wmA= WiMA(adv,length)
tmf= iff(wmV==0,0,wmA/wmV)

c = stl and tmf >= upper_threshold ? lime : stl and 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)
plot(stl and upper_threshold ? upper_threshold : na, title="Upper Threshold", style=line, linewidth=3, color=green)
plot(stl and lower_threshold ? lower_threshold : na, title="Lower Threshold", style=line, linewidth=3, color=maroon)