图片请点击
部分代码如下:开多仓后保存开仓k线前2周期最低点,开多后 逐k线进行保存该值,但出现问题,只能隔一个k线保存到该值(2348),见图片
variable:ll0=open;
ll0:=ref(ll0,1);
if holding<=0 and (buyopencon1 or buyopencon2) then
begin
sellshort(holding<0,lots,limitr,open);
buy(holding=0,lots,limitr,open);
binprice:=open;
ll0:=minlprice;
If Open-minlprice>=loss then
ll0:=binprice-loss;
end
variable:kclo2=0;//记录开仓前2根K线最低价
ma5:ma(c,5);
ma20:ma(c,20);
lo2:=ref(llv(low,2),1);//前2根K线最低价
if cross(ma5,ma20) then
begin
sellshort(holding<0,1,limitr,open);
if holding=0 then
begin
buy(1,1,limitr,open);
kclo2:=lo2;//记录开仓前2根K线最低价
end
end
if cross(ma20,ma5) then sell(holding>0,0,market);
你的代码,不太懂,4楼是照你的文字描述写的.
REF不要用在IF语句中.