一个策略同时盯CU、ZN和AL,定义PD3为平多AL的条件,当PD3满足时,sell(PD3,0,market)这个操作是只平AL,还是所有多仓都会被平掉啦?
平掉策略加载的那个品种,平仓手数0是平掉该品种所有持仓,包括手工开的和其他策略开的仓。
那,想要实现盈利回撤20%这样的,该怎么做啦?
|
那,想要实现盈利回撤20%,然后自动平仓,这样的,该怎么做啦? |
if holding>0 and (h-enterprice)>=(hhv(h,enterbars+1)-enterprice)*0.2 then sell(1,holding,market);
if holding<0 and (enterprice-l)>=(enterprice-llv(h,enterbars+1))*0.2 then sellshort(1,holding,market);
if holding>0 and (h-enterprice)>=(hhv(h,enterbars+1)-enterprice)*0.2 then sell(1,holding,market);
if holding<0 and (enterprice-l)>=(enterprice-llv(h,enterbars+1))*0.2 then sellshort(1,holding,market);