if holding>0 and hhv(h,enterbars+1)>enterprice+n2 and c<(hhv(h,enterbars+1)-0.5*(hhv(h,enterbars+1)-enterprice)) then sell(1,0,market);
if holding<0 and llv(l,enterbars+1)<enterprice-n2 and c>(llv(l,enterbars+1)-0.5*(enterprice-llv(l,enterbars+1))) then sellshort(1,0,market);
BKHIGH>BKPRICE+N2&&C<BKHIGH-(BKHIGH-BKPRICE)*0.5,SP;//回撤5%转向 SKLOW<SKPRICE-N2&&C>SKLOW+(SKPRICE-SKLOW)*0.5,BP;//回撤5%转向 |
if holding>0 and hhv(h,enterbars+1)>enterprice+n2 and c<(hhv(h,enterbars+1)-0.5*(hhv(h,enterbars+1)-enterprice)) then sell(1,0,market);
if holding<0 and llv(l,enterbars+1)<enterprice-n2 and c>(llv(l,enterbars+1)-0.5*(enterprice-llv(l,enterbars+1))) then sellshort(1,0,market);