inputs:X(6),TRAILINGSTOPRATE(1),Fund(30000);;Vars:JO(0),HL(0),Band(0),TMP1(0),TMP2(0),HCAfterEntry(0),LCAfterEntry(0),PriceSY(0),PriceBY(0),lots(0);JO=openD(0);lots=maxlist(1,IntPortion(Fund/(O*bigpointvalue*0.1)));HL=maxlist(HighD(1)-closeD(1),closeD(1)-Lowd(1));Band=Maxlist(JO*0.01,HL);TMP1=JO+0.1*X*Band;TMP2=JO-0.1*X*Band;IfMarketPosition=0andclose>=TMP1andclose[1]TMP2thenSellShort("SK")lotssharesnextbarmarket;IfMarketPosition=1andclose<=TMP2thensell("SP")nextbarmarket;IfMarketPosition=-1andclose>=TMP1thenBuyToCover("BP")nextbarmarket;PriceSY=HCafterentry[1]-O*TRAILINGSTOPRATE*0.01;IfMarketPosition=1andbarssinceentry>1andL<=PriceSYthensell("SY")nextbarPriceSYstop;PriceBY=LCAfterEntry[1]+O*TRAILINGSTOPRATE*0.01;IfMarketPosition=-1andbarssinceentry>1andH>=PriceBYthenbuytocover("BY")nextbarPriceBYstop;If(BarsSinceentry=0)thenbeginHCafterentry=C;LCafterentry=C;endelsebeginHCafterentry=maxlist(HCafterentry,H);LCafterentry=Minlist(LCafterentry,L);End