上穿20日線虛擬做多,下穿20日線虛擬做空
作者:金字塔 來(lái)源:cxh99.com 發(fā)布時(shí)間:2016年03月12日
- 咨詢內(nèi)容:
請(qǐng)教:以rb為例,1w塊錢(qián)交易一手螺紋,上穿20日線虛擬做多,下穿20日線虛擬做空,這樣會(huì)產(chǎn)生一條虛擬資金曲線,然后取虛擬資金曲線的5日均值,虛擬曲線上穿5日線and k線>20日線做多,虛擬曲線上穿5日線and k線<20日均線做空,這個(gè)系統(tǒng)如何寫(xiě)?
- 金字塔客服:
這個(gè)思路不錯(cuò)。
- 用戶回復(fù):
ma20:=ma(c,20);
a5:=ma(asset,5);
if cross(close,ma20) then begin
sellshort(1,0,market);
buy(holding=0,1,market);
end
if cross(ma20,close) then begin
sell(1,0,market);
buyshort(holding=0,1,market);
end
if cross(asset,a5) and h>ma20 then begin
sellshort(1,0,market);
buy(holding=0,1,market);
end
if cross(asset,a5) and l<ma20 then begin
sell(1,0,market);
buyshort(holding=0,1,market);
end
- 網(wǎng)友回復(fù):
出場(chǎng)點(diǎn)我沒(méi)說(shuō)明白k線下穿20日線平多倉(cāng)k線上穿20日平空倉(cāng)。jinzhe能不能給代碼加個(gè)注解?光要4個(gè)if的意思
- 網(wǎng)友回復(fù):
打算根據(jù)虛擬資金曲線交易的,沒(méi)交易asset是怎么出來(lái)的?