空头信号没改变什么意思? 你意思是一直保持?
理论上来说每次开仓获取价格,然后被止损了, 接着检测你空头是否保持,然后检测是否持有仓位,无仓则上次开仓价格开仓?
做个标记好了
variable:bj=0;
if 止损条件 and holding<0 then begin
平空语句;
bj:=1;
end
if 开多条件 and holding=0 then begin
开多语句;
bj:=0;
end
if holding=0 and bj=1 and c<=enterprice and hhv(h,enterbars+1)>enterprice then 开空语句;
用bj来记录当前状态 ,止损过后bj置为1.并且之后行情下跌到开仓价附近时,就再开个空
hhv(h,enterbars+1)>enterprice这个用来判断出上升过,可以改成你的止损判断
多头是: holding>0 and c<enterprice-6*mindiff
空头是:holding<0 and c>enterprice+6*mindiff