SeaSide420

M&H_v420b

173
// //////////////// Attempt to Reduce ReDraw version /////////////////////
//
// Microcana.com strategy by pilotgsms - version 4.20b <<<< Edited by Seaside420 >>>> special thanks to 55cosmicpineapple
// Hull_MA_cross added to script
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
//                   //////////////// Attempt to Reduced ReDraw version /////////////////////
//
//                         Microcana.com strategy by pilotgsms - version 4.20b <<<< Edited by Seaside420 >>>> special thanks to 55cosmicpineapple
//                            Hull_MA_cross added to script
strategy("M&H_v420b", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0)
dt = input(defval=0.0010, title="Decision Threshold", type=float, step=0.0001)
dd = input(defval=1, title="Post Signal Bar Delay", type=float, step=1)
df = input(defval=5, title="Close Position Bar Delay", type=float, step=1)
keh=input(title="Double HullMA Cross",type=integer,defval=7, minval=1)
confidence=(security(tickerid, 'D', close)-security(tickerid, 'D', close[1]))/security(tickerid, 'D', close[1])
prediction = confidence > dt ? true : confidence < -dt ? false : prediction[1]
n2ma=2*wma(close,round(keh/2))
nma=wma(close,keh)
diff=n2ma-nma,sqn=round(sqrt(keh))
n2ma1=2*wma(close[2],round(keh/2))
nma1=wma(close[2],keh)
diff1=n2ma1-nma1,sqn1=round(sqrt(keh))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
openlong=prediction[dd] and n1>n2 and strategy.opentrades<1
if (openlong)
    strategy.entry("Long", strategy.long)
openshort=not prediction[dd] and n2>n1 and strategy.opentrades<1
if (openshort)
    strategy.entry("Short", strategy.short)
closeshort=prediction and close<low[df]
if (closeshort)
    strategy.close("Short")
closelong=not prediction and close>high[df]  
if (closelong)
    strategy.close("Long")