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

Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
// @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)