...
后台 tbuy(开多),tsell(平多),tbuyshort(开空),tsellshort(平空),可在序列或逐k模式运行。
buy(开多),sell(平多),buyshort(开空),sellshort(平空) 都是图表程序化交易函数
variable定义的全局变量,也是图表程序化交易的函数,且必须在逐K线模式下运行.
这是你在策略编写区看到的一个代码吧
一般的策略,逐K模式就可以的,推荐您先从图表程序化交易学起
buycond:ref(count(c>o,2)=2,1);
sellcond:ref(count(c<o,2)=2,1);
if tholding>0 and sellcond then tsell(1,1,mkt);
if tholding<0 and buycond then tsellshort(1,1,mkt);
if buycond and tholding=0 then
begin
tbuy(1,1,mkt);
end
if tholding=0 and sellcond then tbuyshort(1,1,mkt);
是的,图表程序化BUY的下单语句,只能用逐K模式运行
以下简单图表程序化交易,可运行在序列模式
ma5:ma(close,5);
ma15:ma(close,15);
{平空}EXITSHORT:CROSS(ma5,ma15) OR time>=151400 ,TFILTER;
{开多}ENTERLONG:CROSS(ma5,ma15) AND time>091500 and time<151400 ,TFILTER;
{平多}EXITLONG:CROSS(ma15,ma5) OR time>=151400 ,TFILTER;
{开空}ENTERSHORT:CROSS(ma15,ma5) AND time>091500 and time<151400 ,TFILTER ;