basil
18th December 2003, 12:51 PM
David - the example you provided below (from a previous post) in relation to volatility position sizing answered my questions about ATR trailing stops, however I can't work out how to apply that to an entry trigger.
For example I want to set an entry trigger which is;
moving average#1 > (moving average#2 + a specified ATR).
Using your example is this how it would be written?
Period:=50; { ATR period }
ARC:=3.0; { Average range constant }
Volatility:=ARC*ATR(Period);
Stop:=C-Volatility;
BandLong:=If(L<=PREV,Stop,If(Stop>PREV,Stop,PREV));
InitialStop:=ref(BandLong,-1);
EntryTrigger := Cross(Mov(C,20,S), Ref(Mov(C,20,S),-10) +3*ATR(50)); {my changes in red}
EntryPrice := OPEN;
ExitTrigger := (L <= InitialStop);
ExitPrice := CLOSE;
Column C:
Nshares:=Int($Risk/(EntryPrice-InitialStop));
Column D:
EntryPrice;
Column E:
InitialStop;
If I didn't want to use a volatility stop would I need to include those first few lines of code?
Your help would be appreciated.
Basil
For example I want to set an entry trigger which is;
moving average#1 > (moving average#2 + a specified ATR).
Using your example is this how it would be written?
Period:=50; { ATR period }
ARC:=3.0; { Average range constant }
Volatility:=ARC*ATR(Period);
Stop:=C-Volatility;
BandLong:=If(L<=PREV,Stop,If(Stop>PREV,Stop,PREV));
InitialStop:=ref(BandLong,-1);
EntryTrigger := Cross(Mov(C,20,S), Ref(Mov(C,20,S),-10) +3*ATR(50)); {my changes in red}
EntryPrice := OPEN;
ExitTrigger := (L <= InitialStop);
ExitPrice := CLOSE;
Column C:
Nshares:=Int($Risk/(EntryPrice-InitialStop));
Column D:
EntryPrice;
Column E:
InitialStop;
If I didn't want to use a volatility stop would I need to include those first few lines of code?
Your help would be appreciated.
Basil