yinx:=(O-C)/C*1000;//阴线长 //风险控制一种,高开低走长阴,不开多;等待下一次交易信号。
if holding=0 and buycond and yinx<3 then begin
buy(1,1limitr,close);
end
yinx<3 现在不成立,可是下一个K线就成立,开仓了;我需要的是,不开多仓;等待下一次交易信号。
开多,是因为 buycond and yinx 这个条件成立了呀
下一次交易信号是什么,表述出来呀。
下一次交易信号也是;因为 buycond and yinx 这个条件成立。
也猜不透楼主想干什么
直接要求满足什么条件开仓,多省事
如果是非要满足第二次条件成立,才开仓,可考虑用全局变量记录条件成立的次数,来控制是否开仓.
全局变量的使用,请参考问题16http://www.weistock.com/bbs/dispbbs.asp?boardid=4&Id=332
if holding=0 and buycond and yinx>-0.3% then begin
buy(1,1limitr,close);
end
开盘第一条K线(5分钟)涨幅-0.32%,第二条K线(5分钟)涨幅-0.1%;这样第一条K线yinx>-0.3%条件不成立,第二条K线条件成立,开多仓。
我真正需要是,yinx>-0.3%不成立时;要等待下一次holding=0 and buycond and yinx>-0.3%成立;
这个是要使用全局变量,我不懂全局变量,所以
count(yinx>=3,3)=1;也不行。
VARIABLE:ated=0;
if buycond and yinx<3 then
ated:=ated+1;
if holding=0 and ated>=2 then begin
buy(1,1limitr,close);
ated := 0;
end
补充7楼
VARIABLE:ated=0;
if buycond and yinx>-0.3% then
ated:=ated+1;
if holding=0 and ated>=2 then begin
buy(1,1limitr,close);
ated := 0;
end
if yinx<=-0.3% then ated := 0;
非常感谢!三个老师的帮忙!
学习贴图