
等级: 新手上路
- 注册:
- 2024-6-15
- 曾用名:
|
老师,好,如下代码:新建公式A:
cond11:cross(close,ma(close,20);
cond22:cross(ma(close,20),close);
开多:
if stkindi('','A.cond11',0,5,0) and close>ma(close,20) then buy(holding=0,1,marketr);
if stkindi('','A.cond22',0,2,0) and close<ma(close,20) then sell(1,0,marketr);
开空:
if stkindi('','A.cond22',0,5,0) and close<ma(close,20) then buyshort(holding=0,1,marketr);
if stkindi('','A.cond11',0,2,0) and close>ma(close,20) then sellshort(1,0,marketr);
回测效果见附件,考虑到回测时是已经结束的状态,所以在实盘模拟时,把0改成了-1,但今天的棕榈一小时周期跌破20日均线时,依然没有触发开仓做空。不知道哪里出了问题。希望老师帮忙整理下公式,期望能达到回测的效果,谢谢
|
|