請(qǐng)教編碼2
作者:金字塔 來源:cxh99.com 發(fā)布時(shí)間:2016年08月27日
- 咨詢內(nèi)容:
以下思路,請(qǐng)教怎么編碼實(shí)現(xiàn):
入場規(guī)則:RAVI=絕對(duì)值(100*(7天收盤價(jià)移動(dòng)平均-65天收盤價(jià)移動(dòng)平均)/ 65天收盤價(jià)移動(dòng)平均))1、RAVI>0.5%2、如連續(xù)3個(gè)收盤價(jià) > 65天收盤價(jià)移動(dòng)平均, 則開多頭,如連續(xù)3個(gè)收盤價(jià) < 65天收盤價(jià)移動(dòng)平均, 則開空頭
出場規(guī)則:初始止損1000元,14日新高退出空頭 或 14日新低退出多頭
以上在日線上運(yùn)行
請(qǐng)教,謝謝 !
- 金字塔客服:
RAVI>0.5%
ravi是上面公式里面算出來的,還是要除以100?
- 用戶回復(fù):
不好意思,有誤,
入場規(guī)則:RAVI=絕對(duì)值(7天收盤價(jià)移動(dòng)平均-65天收盤價(jià)移動(dòng)平均)/ 65天收盤價(jià)移動(dòng)平均)1、RAVI>0.5%
也就是要除以100
- 網(wǎng)友回復(fù):
ravi:abs((ma(c,7)-ma(c,65))/ma(c,65));
if ravi>0.005 and all(c>ma(c,65),3) then buy(holding=0,1,marketr);
if RAVI>0.005 and all(c<ma(c,65),3) then buyshort(holding=0,1,marketr);
if openprofit<-1000 and enterbars>0 then BEGIN
sell(1,0,marketr);
sellshort(1,0,marketr);
end
if h=hhv(h,14) and holding<0 then sellshort(1,0,MARKETr);
if l=llv(l,14) and holding>0 then sell(1,0,marketr);
- 網(wǎng)友回復(fù):
增加一條規(guī)則:
上次平倉后三個(gè)交易日內(nèi)不開倉
這樣怎么編?謝謝!