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

סקריפט קוד פתוח

ברוח TradingView אמיתית, מחבר הסקריפט הזה פרסם אותו בקוד פתוח, כך שסוחרים יכולים להבין ולאמת אותו. כל הכבוד למחבר! אתה יכול להשתמש בו בחינם, אך שימוש חוזר בקוד זה בפרסום כפוף לכללי הבית. אתה יכול להכניס אותו למועדפים כדי להשתמש בו בגרף.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בסקריפ זה בגרף?
// @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)