if thodling = 0 and 开多 then begin
DEBUGFILE(...);
DEBUGFILE2(...);
end;
d2是输出历史值和当前值,也就是每个tick都会输出来,而d是输出当前的值。
那么问题是我为何在用d的时候也是每个tick都输出?首先不可能每个tick都满足开多条件。相关的背景如下:
①纯后台,没有一边用图表一边用后台;
②固定1秒扫描 + 分笔扫描
//代码如下:
INPUT: lots(1,1,10,1);
VARIABLE: signal := 0;
ss := signal;
h_1 := ref(h,1);
l_1 := ref(l,1);
zjj := (h_1 + l_1) / 2,NODRAW;
if ss = 0 and h >= (h_1 + l_1) / 2 then BEGIN
DEBUGFILE('C:\TEST1.TXT','ss=%.0f',ss);
DEBUGFILE('C:\TEST1.TXT','h=%.0f',h);
DEBUGFILE('C:\TEST1.TXT','zjj=%.0f',zjj);
signal := 1;
myprice := (h_1 + l_1) / 2;
end;
if ss > 0 and l <= l_1 then BEGIN
DEBUGFILE('C:\TEST1.TXT','ss=%.0f',ss);
DEBUGFILE('C:\TEST1.TXT','l=%.0f',l);
DEBUGFILE('C:\TEST1.TXT','l_1=%.0f',l_1);
signal := 0;
myprice := min(l_1,o);
end;
//后台部分
if ss < 0 and signal >= 0 then begin
tsellshort(workmode = 1, -ss * lots, MKT);
sellshort(workmode = 0, -ss * lots, LIMITR, myprice);
ss := 0;
end;
if ss > 0 and signal <= 0 then begin
tsell(workmode = 1, ss * lots, MKT);
sell(workmode = 0, ss * lots, LIMITR, myprice);
ss := 0;
end;
tbuy(workmode = 1 and ss < signal, (signal - ss) * lots, MKT);
buy(workmode = 0 and ss < signal, (signal - ss) * lots, LIMITR, myprice);
tbuyshort(workmode = 1 and ss > signal, (ss - signal) * lots, MKT);
buyshort(workmode = 0 and ss > signal, (ss - signal) * lots, LIMITR, myprice);
我贴出日志:
2015-01-14 14:35:49.687 ss=0 ---------687入场
2015-01-14 14:35:49.687 h=2478
2015-01-14 14:35:49.687 zjj=2476
2015-01-14 14:35:49.953 ss=0----------953此时按照代码应该ss大于0了,为何这个地方还是0?
2015-01-14 14:35:49.953 h=2478
2015-01-14 14:35:49.953 zjj=2476
2015-01-14 14:35:50.281 ss=0
2015-01-14 14:35:50.296 h=2478
2015-01-14 14:35:50.296 zjj=2476
2015-01-14 14:35:50.312 ss=0
2015-01-14 14:35:50.312 h=2478
2015-01-14 14:35:50.312 zjj=2476
2015-01-14 14:35:50.593 ss=0
2015-01-14 14:35:50.593 h=2478
2015-01-14 14:35:50.593 zjj=2476
VARIABLE
改成
GLOBALVARIABLE
公式改成序列计算
谢谢版主!
也就是后台固定轮询模式时需要把公式改为序列? 只有等k走完模式公式才为逐K计算?
DEBUGFILE,这里就说明你给了会在最后一周期输出,只要满足条件就输出
②固定1秒扫描 + 分笔扫描
那么基本上就是1秒左右,只要满足条件h >= (h_1 + l_1) / 2或l <= l_1,就会有输出
在最后一个周期输出指定的调试字符串到一个指定的文件中
用户可以在程式化交易中通过输出指定的字符串到文件来实现调试的目的.借此可以借助这个功能来完成监控程式化交易的各种细节参数
你不就是输出下面这6个值吗?
2015-01-15 10:21:59.321 ss=0
2015-01-15 10:21:59.337 h=3510
2015-01-15 10:21:59.337 zjj=3507
2015-01-15 10:22:06.618 ss=1
2015-01-15 10:22:06.633 l=3506
2015-01-15 10:22:06.633 l_1=3506
怎么还跟开仓平仓点位联系上了,
你的ss和signal联系的非常紧密,每次运算都会根据运算结果进行赋值的