和风版海龟源码 支持多空(源码 金字塔 贴图)
**** Hidden Message ***** {:smile:} 感謝分享、版主辛苦了 xuexi 源码解析:输出INPUT:INB(20,1,500,1),OUTB(10,1,500,1),RISK(2,0,10,0.1)
输出 //和风版海龟源码 VARIABLE:TIMES=0,I=0,N=0
RN赋值:昨日真实波幅的20日指数移动平均
N赋值:VALUEWHEN(HOLDING=0,RN)
RH赋值:昨日最高价
RL赋值:昨日最低价
输出 H1:INB日内RH的最高值
输出 H2:OUTB日内RH的最高值,LINEDOT
输出 L1:INB日内RL的最低值
输出 L2:OUTB日内RL的最低值,LINEDOT
输出 LOTST:ASSET*RISK*0.01/(N*2*MULTIPLIER),线宽为0
LOTS赋值:如果RISK=0,返回1,否则返回LOTST
TBC赋值:H<>L
//判断是否停板 PARTLINE(HOLDING>0,ENTERPRICE-2*N)
逻辑判断 BARPOS<INB+1 THEN EXIT
BUYP赋值:开盘价和H1的较大值
BUY(1,LOTS,LIMITR,BUYP)
TIMES赋值:1
BUYP赋值:开盘价和ENTERPRICE+N*0.5的较大值
BUY(1,LOTS,LIMITR,BUYP)
TIMES赋值:TIMES+1
END
//连续开仓 END
SELLP赋值:开盘价和L1的较小值
BUYSHORT(1,LOTS,LIMITR,SELLP)
TIMES赋值:1
SELLP赋值:开盘价和ENTERPRICE-N*0.5的较小值
BUYSHORT(1,LOTS,LIMITR,SELLP)
TIMES赋值:TIMES+1
END
//连续开仓 END
END
EXITLONGP赋值:ENTERPRICE-2*N和L2的较大值
EXITP赋值:开盘价和EXITLONGP的较小值
SELL(1,0,LIMITR,EXITP)
TIMES赋值:0
END
BUYP赋值:开盘价和ENTERPRICE+N*0.5的较大值
BUY(1,LOTS,LIMITR,BUYP)
TIMES赋值:TIMES+1
END
//连续开仓 END
//ELSE END
EXITLONGP赋值:ENTERPRICE+2*N和H2的较小值
EXITP赋值:开盘价和EXITLONGP的较大值
SELLSHORT(1,0,LIMITR,EXITP)
TIMES赋值:0
END
SELLP赋值:开盘价和ENTERPRICE-N*0.5的较小值
BUYSHORT(1,LOTS,LIMITR,SELLP)
TIMES赋值:TIMES+1
END
//连续开仓 END
//ELSE END
//HOLDING<0 谢谢版主分享
页:
[1]