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

Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?
// @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)