序列运行模式下的 买卖函数分别是什么?
作者:金字塔 来源:cxh99.com 发布时间:2014年11月29日
- 咨询内容:
请教:序列运行模式下的 买卖函数分别是什么?
- 金字塔客服:
...
[此贴子已经被作者于2013/11/25 14:36:20编辑过]
- 用户回复:
后台 tbuy(开多),tsell(平多),tbuyshort(开空),tsellshort(平空),可在序列或逐k模式运行。
- 网友回复:
//用固定时间间隔 variable:maxprofit=0;//有仓位时最大获利 buycond:=ref(count(c>o,2)=2,1); if buycond and holding=0 then begin buy(1,1,limitr,o+2*mindiff); maxprofit:=0; end //止损平仓 if holding>0 and low<enterprice-10 then sell(1,1,market);win:=0;win2:=0;if holding > 0 and enterbars > 0 thenbegin win:=(high-enterprice); //记录最大盈利 if win > maxprofit then maxprofit:=win; win2:=maxprofit-win; //最大盈利后的回调幅度end //如果开仓均价盈利大于50点但小于100点时,跌破盈利段的一半止盈if maxprofit>50 and maxprofit<100 and holding>0 then 止赢1:SELL(win2<0.5*maxprofit,1,market); //如果开仓均价盈利大于100点时,以盈利100点的位置为低点,100+N点为高点,这段距离回落一半止盈if maxprofit>=100 and holding>0 then 止赢2:SELL(win2<100+0.5*(maxprofit-100),1,market);
这个程序中哪些是图表交易函数,怎么修改才可以运行在序列模式
- 网友回复:
buy(开多),sell(平多),buyshort(开空),sellshort(平空) 都是图表程序化交易函数
variable定义的全局变量,也是图表程序化交易的函数,且必须在逐K线模式下运行.
这是你在策略编写区看到的一个代码吧
一般的策略,逐K模式就可以的,推荐您先从图表程序化交易学起