RicardoSantos

[RS]Market Fractility Flow Oscillator V1

EXPERIMENTAL:
Improved Version :P.
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 đồ?
//@version=2
study(title='[RS]Market Fractility Flow Oscillator V1', shorttitle='MFFo', overlay=false)
tf00 = input(title='Timeframe 00:', type=string, defval='D', confirm=false)
tf01 = input(title='Timeframe 01:', type=string, defval='720', confirm=false)
tf02 = input(title='Timeframe 02:', type=string, defval='360', confirm=false)
tf03 = input(title='Timeframe 03:', type=string, defval='240', confirm=false)
tf04 = input(title='Timeframe 04:', type=string, defval='60', confirm=false)
tf05 = input(title='Timeframe 05:', type=string, defval='30', confirm=false)

f_query_sec(_tf)=>security(tickerid, _tf, open)

q00 = close >= f_query_sec(tf00) ? 32 : -32
q01 = close >= f_query_sec(tf01) ? 16 : -16
q02 = close >= f_query_sec(tf02) ? 8 : -8
q03 = close >= f_query_sec(tf03) ? 4 : -4
q04 = close >= f_query_sec(tf04) ? 2 : -2
q05 = close >= f_query_sec(tf05) ? 1 : -1

power = q00 + q01 + q02 + q03 + q04 + q05
//  ||-->
//  ||  General Market direction:
isbull = power > 48
isbullretrace = q00 < 0 and power > -48
isbear = power < -48
isbearretrace = q00 > 0 and power < 48
//  ||
plot(title='0', series=1, style=columns, color=isbull?green:isbear?maroon:isbullretrace?lime:isbearretrace?red:gray, histbase=0)
plot(title='1', series=2, style=columns, color=isbull and q01 > 0?green:isbear and q01 < 0?maroon:isbullretrace and q01 > 0 ?lime:isbearretrace and q01 < 0 ? red:gray, histbase=1)
plot(title='2', series=3, style=columns, color=isbull and q02 > 0?green:isbear and q02 > 0?maroon:isbullretrace and q02 > 0 ?lime:isbearretrace and q02 < 0 ? red:gray, histbase=2)
plot(title='3', series=4, style=columns, color=isbull and q03 > 0?green:isbear and q03 > 0?maroon:isbullretrace and q03 > 0 ?lime:isbearretrace and q03 < 0 ? red:gray, histbase=3)
plot(title='4', series=5, style=columns, color=isbull and q04 > 0?green:isbear and q04 > 0?maroon:isbullretrace and q04 > 0 ?lime:isbearretrace and q04 < 0 ? red:gray, histbase=4)
plot(title='5', series=6, style=columns, color=isbull and q05 > 0?green:isbear and q05 > 0?maroon:isbullretrace and q05 > 0 ?lime:isbearretrace and q05 < 0 ? red:gray, histbase=5)