PDA

View Full Version : ATR and moving average entry trigger


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

David Samborsky
19th December 2003, 01:39 AM
Do you want to use a protective stop?

basil
22nd December 2003, 02:18 PM
David
Yes I do want a protective stop and understand I need to include the phrase
ExtFml( "TradeSim.EnableProtectiveStop", 0)

In answering my previous question can you also explain for me how that is influenced by whether or not you have a protective stop? In fact one thing I found wasn't explained adequately for me in the manual is the difference between an initial stop and a protective stop.

Thanks

Chris

David Samborsky
23rd December 2003, 03:04 AM
The InitialStop is the value of the InitialStop data array at the time of entry into a trade. You can specify an InitialStop without it acting as a protective stop. It's only when you enable protective stops then the InitialStop will be used as a protective stop.

You might ask why you would have an InitialStop without it being used as a protective stop. This is because you may just want to use the InitialStop as a volatility factor when using the risked based position size models without engaging a protective stop.

If you are using a trailing stop then there is really no need to have a protective stop. This is because the start of the trailing stop acts as an protective stop. When using the risked based PS models you would also have to assign a value to the InitialStop.

Please refer to document AN-2 for more details.