- UID
- 2
- 积分
- 2874674
- 威望
- 1387366 布
- 龙e币
- 1487308 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
[MC源码] 利用"两种不同的Rsi计算方法(RSI_With_RSI)"设计进出量化策略程式码
链接地址:http://www.qhlt.cn/thread-149735-1-1.html;
RSI_With_RSI (Strategy)- Input:slowrsilen(17),quickrsilen(5),slowmalen(40),quickmalen(10),rsibuylevel(60),rsiselllevel(40);
- var:oktotrade(False),slowrsi(0),quickrsi(0),slowma(0),quickma(0),slowrsitrenddir(0);
- slowrsi = RSI(close,slowrsilen);
- quickrsi = RSI(close,quickrsilen);
- slowma = Average(close,slowmalen);
- quickma = Average(close,quickmalen);
- if slowrsi crosses above rsibuylevel then slowrsitrenddir = 1
- else if slowrsi crosses below rsiselllevel then slowrsitrenddir = -1;
- once(currentbar = 1*slowrsilen) oktotrade =True;
- if oktotrade then begin
- {entries}
- if slowrsi crosses above rsibuylevel and Close > slowma then buy("srsi le") next bar at market;
- if quickrsi crosses above rsibuylevel and Close > quickma and slowrsitrenddir = -1 then buy("qrsi le") next bar at market;
- {exits}
- if slowrsi crosses below rsiselllevel or Close < slowma then sell("srsi lx") from entry("srsi le") next bar at market;
- if quickrsi crosses below rsiselllevel or Close < quickma then sell("qrsi lx") from entry("qrsi le") next bar at market;
- end;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|