固定时间间隔模式?
公式用的是TIME来判断的?
金字塔的TIME,也就是k线时间是这的
TIME=090100,对应的实际时间090000-090059,所以你要实际时间在14分平仓,那么time需要设定在XX15XX
//收盘平仓
if time=151500 then begin
收盘平多:sell(1,holding,market);
收盘平空:sellshort(1,holding,market);
end
不知我这样写的话是不是会平在14分呢?请老师指点。
图表的话是不是应该这样?
前略
。。。
t2:=time=151500;
//交易系统
。。。略
收盘平多:sell(t2,holding,market);
收盘平空:sellshort(t2,holding,market);
不过测试起来很麻烦啊,要重新写一套time在13分的market才可以测试出14分平仓的效果。
有没有更好的办法?麻烦老师了。
151500这个时间都收盘了,你一定要掐在15分操作这个能执行?
用thisclose替代market,价位就是对应当前周期了
对应的下单语句这样写
if a1>ref(a1,1) and p1 and p3<=xdd then
begin
sellshort(holding<0,abs(holding),limitr,c+hd1);
buy(holding<cx,tn,limitr,c+hd1);
end
if a1<ref(a1,1) and p1 and p3<=xdk then
begin
sell(holding>0,holding,limitr,c-hd1);
buyshort(abs(holding)<cx,tn,limitr,c-hd1);
end
这个是实现三秒钟的,你把时间改一下就行了
如果是K线走完,1分钟周期,改为以下即可
if time>=151400 then begin
收盘平多:sell(1,holding,market);
收盘平空:sellshort(1,holding,market);
end
如果是固定时间间隔,采用武田晴信