Steve, you need to move the ref to surround
the whole calc as you will only know yesterday's atr in advance.
Also when are you selling? on close or on next open.
Next open will be (with all delays set to
zero)
TriggerSell = Close > ref(Ma(C,2) +
a*ATR(2),-1);
Sell = ref(TriggerSell,-1);
SellPrice = open;
Dave
----- Original Message -----
Sent: Thursday, March 20, 2008 4:54
PM
Subject: [amibroker] Sell
Signal
Hi all
below is my code to "sell if the close today is above
yesterdays 2 day
moving average + x atr(2). x being a
variable.
Sell=C>Ref(MA(C,2),-1)+a*ATR(2)
Not
sure if its doing what I expect can abyone let me now if its
flawed...?
Cheers
Steve C