如果我的第一目标,平多单是BP1,第二目标是BP2,bp2>bp1
sell( holding>0 and bp1,holding*50%,thisclose);
sell( holding>0 and bp2,holding*50%,thisclose);
这样肯定不对的。按照上述指令,行情如果继续的话,还是在不断地执行满足bp1的平仓指令。用什么函数可以做到50%仓位在BP1平,达到BP1目标后,其余在BP2平??
nb:=enterbars;
p1:=bp1*(sum(bp1,nb)=1);
sell( holding>0 and p1,holding*50%,thisclose);
sell( holding>0 and bp2,holding*50%,thisclose);
也可试试这个
sell( holding>0 and bp1 and NOT(TYPE(1)=2) ,holding*50%,thisclose);
sell( holding>0 and bp2,holding*50%,thisclose);