举例:开仓条件成立为kdj 金叉 并且持仓数<3,买入1手; 怎么编写?
构想1:
kd:=k>d
BUY(KD AND HOLDING<3,1,THISCLOSE);
构想2:
kd:=k>d and holding<3 ;
BUY(KD AND HOLDING<3,1,THISCLOSE);
请问这两个有没有对的? 请高手 回复正确的写法?
buy(cross(k,d) and holding<3 ,1,thisclose);
这样写
老师:
如果是空单要不要给holding 求绝对值 ?
buyshort (cross(d,k) and holding<3 ,1,thisclose);
buyshort (cross(d,k) and abs(holding)<3 ,1,thisclose);
是的
或者holding>-3
[此贴子已经被作者于2016-8-1 17:26:45编辑过]
谢谢!
我想测试日内交易 ,历史检测策略时发现 收益率超高。怎么过滤呢? 我的想法是加上收盘前清仓,怎么写? 下面代码怎么修改,还要加上晚盘时间.
//收盘前清仓
entertime:=time>=092500 and time<=145500;
exittime:=time>=150000;
if holding >0 and exittime then begin
sell(1,holding,limitr,close);
end
if holding <0 and exittime then begin
sellshort(1,holding,limitr,close);
end
金字塔显示的时间是处理过的,这个代码可以用吗? 本人现在行情还是金字塔的时间。
收盘清仓时间这样写:time>=closetime(0)