DD:barpos;
if pd then
Begin
SELL(1,0,LIMITR,ma10);
r1:barpos;
End
if pk then
Begin
SELLshort(1,0,LIMITR,ma10);
r2:barpos;
End
DD=r1=r2
ma10:ma(o,10);
PD:=l<ma10;
PK:=h>ma10 ;
if pd then
Begin
SELL(1,0,LIMITR,ma10);
r1:barpos;
End
if pk then
Begin
SELLshort(1,0,LIMITR,ma10);
r2:barpos;
End
r3:=max(r1,r2);
KD:= ma10>ref(ma10,1) and o>ma10 AND barpos>r1 ; //开多条件
//平多条件
KK:= ma10<ref(ma10,1) and o<ma10 AND barpos>r2; //开空条件
//SELLshort(Pk and holding<0,1,LIMITR,c);
//SELL(PD and holding>0,1,LIMITR,c);
buy(kd and holding=0 ,1,LIMITR,c);
buyshort(kk and holding=0 ,1,LIMITR,c);
平空时,我已将值赋给R1,r2,然后跟实时的值比较是否大于小于
以此来锁定开仓,因为HOLDING锁不住
怎么不明白?
if pd then
这样的思路来限定变量在平多是时候被赋值?
你需要加holding>0这个一个条件
同样pk 也需要加一个holding<0的条件
因为你的PD和PK能同时成立导致同时被赋值
你把鼠标放到平仓k线上,
放在平仓K上BArPOS是相等,放在别的K应不等,可是BArPOS数字还没有,要不就是数字相等