[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculating an Initial Stop with ATR



PureBytes Links

Trading Reference Links

Hi,

I would like to be able to calculate an initial stop using the ATR function
and plot it or alternatively have the value shown via a messagebox etc. The
formula I use is:

Day1 := Input("Day of Trade",1,31,1);
Month1 := Input("Month of Trade",1,12,1);
Year1 := Input("Year of Trade",1900,2400,2001);

ATRDays:=Input("ATR Days",1,30,10);
ATREntryMult:=Input("ATR Multiplier From Entry",1,5,2.0);
EntryPrice:= Input("Entry Price",0.1,30,1);
PdsTrade:=BarsSince(DayOfMonth()=Day1 AND Month()= Month1 AND Year()=
Year1);
{The stop from the Entry}
InitialStop:= EntryPrice - ATREntryMult*ATR(ATRDays);
If(PdsTrade>=0,InitialStop,InitialStop);

The problem is that if you buy today, and plot it on your chart, nothing
plots. If you buy days before, then it plots. As this is an entry
calculation, then it should plot today and then if all goes well, you can
plot a trailing stop.

Any suggestions would be appreciated,

Andrew