arpad_37
11th July 2006, 04:17 AM
Hi, I am trying to implement an R based shrinking trailing stop loss rule as per the code below. It essenmtially works that you set a large initial stop but once the trade starts to be profitable - defined by the high R value, you shrink the trailing stop.
This seems to work with others' tradesim but not with mine(??). I do not understand how that is possible.
Can someone help please?
Regards,
Arpad
Period1:=50;
Period2:=20;
Period3:=50;
Period4:=20;
EntryTrigger:= Ref(Cross(CLOSE, Ref(HHV(CLOSE,Period1),-1)),-1);
EntryPrice:= OPEN;
InitialStop:=LLV(CLOSE,Period2);
a:=(C-EntryPrice)/(EntryPrice-InitialStop);
ExitTrigger:=
If(a>3,C<Ref(LLV(C,5),-1),If(a>2 AND a<=3,C<Ref(LLV(C,10),-1),If(a>1 AND a<=2,C<Ref(LLV(C,20),-1),C<Ref(LLV(C,30),-1))));
ExitPrice:=OPEN;
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.RecordTrades",
"FOREX_shrinking_exit_long",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);
This seems to work with others' tradesim but not with mine(??). I do not understand how that is possible.
Can someone help please?
Regards,
Arpad
Period1:=50;
Period2:=20;
Period3:=50;
Period4:=20;
EntryTrigger:= Ref(Cross(CLOSE, Ref(HHV(CLOSE,Period1),-1)),-1);
EntryPrice:= OPEN;
InitialStop:=LLV(CLOSE,Period2);
a:=(C-EntryPrice)/(EntryPrice-InitialStop);
ExitTrigger:=
If(a>3,C<Ref(LLV(C,5),-1),If(a>2 AND a<=3,C<Ref(LLV(C,10),-1),If(a>1 AND a<=2,C<Ref(LLV(C,20),-1),C<Ref(LLV(C,30),-1))));
ExitPrice:=OPEN;
ExtFml("TradeSim.Initialize");
ExtFml("TradeSim.RecordTrades",
"FOREX_shrinking_exit_long",
LONG,
EntryTrigger,
EntryPrice,
InitialStop,
ExitTrigger,
ExitPrice,
START);