Rank: Advanced Member
Groups: Registered, Registered Users, Unverified Users Joined: 1/13/2005(UTC) Posts: 87 Location: perth australia
|
Hi Roy,
I have been looking at one of your previous profit trailing stops:
EntryCost:=Input("Entry cost $",0,100,33); ExitCost:= Input(" Exit cost $",0,100,33); Profit:=Input("Profit goal %",1,50,10)/100; Loss:=Input(" Stop loss %" ,1,50,5)/100; Equity:=Input("Trade equity $",500,100000,10000); EntryPrice:=Input("Entry price option, 1=O 2=C 3=Stop",1,3,2); ExitOpt:=2; {Exit option, 1=O 2=C 3=Stop} n:=Fml("roy reversal entry(2)"); x:=Fml("roy reversal eXIT(2)"); i:=Cum(n<>-1 AND x<>-1)=1; EntryPrice:=If(EntryPrice=1,O,If(EntryPrice=2,C,n)); ExitPrice:=If(ExitOpt=1,O,If(ExitOpt=2,C,H)); pFactor:=((Equity*(1+Profit)+ExitCost)/ (Equity-EntryCost)); lFactor:=((Equity*(1-Loss)+ExitCost)/ (Equity-EntryCost)); EntryAmt:=If(BarsSince(i OR n>0)>=BarsSince(i OR x>0 OR ExitPrice>pFactor*(ValueWhen(1,i OR (n>0 AND Alert(If(BarsSince(i OR n>0)>=BarsSince(i OR x>0),0,1)=0,2)), EntryPrice)) OR If(ExitOpt<3, ExitPrice,L)<=lFactor*(ValueWhen(1,i OR (n>0 AND Alert(If(BarsSince(i OR n>0)>=BarsSince(i OR x>0),0,1)=0,2)), EntryPrice))),0, ValueWhen(1,i OR (n>0 AND Alert(If(BarsSince(i OR n>0)>= BarsSince(i OR x>0),0,1)=0,2)),EntryPrice)); y:=If(EntryAmt=0 AND Alert(EntryAmt>0,2) AND ExitPrice>= ValueWhen(1,i OR EntryAmt>0,EntryAmt)*pFactor,If(ExitOpt=1,O, If(ExitOpt=2,C,ValueWhen(1,i OR EntryAmt>0,EntryAmt)*pFactor)),0); z:=If(EntryAmt=0 AND Alert(EntryAmt>0,2) AND If(ExitOpt<3, ExitPrice,L)<ValueWhen(1,i OR EntryAmt>0,EntryAmt)*lFactor, If(ExitOpt=1,O,If(ExitOpt=2,C,ValueWhen(1,i OR EntryAmt>0, EntryAmt)*lFactor)),0); pTarget:=If(Y=0,0,If(Y>0.1 AND Y<=0.5, If(Int(Y*200)=Y*200,Y, Int((Y)*200)/200), If(Y<=0.1,If(Int(Y*1000)=Y*1000,Y, Int((Y)*1000)/1000),If(Int(Y*100)=Y*100,Y, Int((Y)*100)/100)))); lTarget:=If(Z=0,0,If(Z>0.1 AND Z<=0.5, If(Int(Z*200)=Z*200,Z, Int((Z)*200)/200), If(Z<=0.1,If(Int(Z*1000)=Z*1000,Z, Int((Z)*1000)/1000),If(Int(Z*100)=Z*100,Z, Int((Z)*100)/100)))); EntryAmt; {EntryAmt*pFactor; EntryAmt*lFactor; }
I wanted to convert it to this type of trailing stop but am finding difficulties doing it:
Use a $1500 money management stop. (Limits loss to $1500.00) When profit reaches $1,000, exit with a stop at entry price. When profit reaches $2,000, exit with a stop at entry plus $1,250. When profit reaches $3,500, exit with a stop at entry plus $2,500. When profit reaches $5,000, exit with a stop at entry plus $4500. When profit is greater than $7,500 exit with a stop at the previous day's low.
Could you help me out?
Cheers
Norman
|