PureBytes Links
Trading Reference Links
|
Hello,
I'm trying to translate a simple system from Wealth-lab (which I used
to use) to Amibroker. The system is very simple:
- Buy the SPY when the 11-day SMA crosses over the 11-day EMA.
- Sell the SPY when the 11-day EMA crosses over the 11-day SMA.
In AB, I have expressed this as:
EMA1 = EMA(C,11);
SMA1 = MA(C,11);
Buy = Cross(SMA1,EMA1);
Sell = Cross(EMA1,SMA1);
(I have the trade delays on: buy/sell 1 day after the signal at the
close - same as Wealth-lab).
Here's the WL script:
var Bar: integer;
for Bar := 11 to BarCount() - 1 do
begin
if (EMA(Bar - 0, #Close, 11) > SMA(Bar - 0, #Close, 11)) and
(EMA(Bar - 1, #Close, 11) < SMA(Bar - 1, #Close, 11)) then
begin
if (PositionLong(LastPosition)) then
begin
SellatClose(Bar + 1, LastPosition, '');
end;
end;
if (EMA(Bar - 0, #Close, 11) < SMA(Bar - 0, #Close, 11)) and
(EMA(Bar - 1, #Close, 11) > SMA(Bar - 1, #Close, 11)) then
begin
BuyatClose(Bar + 1, '');
end;
end;
Any idea why I get such different results? When I look at the trades
themselves, they are very different.
I'm wondering if the way WL does an EMA is different from the way AB
does it.
Any thoughts greatly appreciated!
------------------------------------
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|