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
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
//@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")