Peter,
I don’t have back-adjusted futures
contracts, but I put your code in, used two ETFs and added some plot
statements. It works fine. I have an EMA formula in Excel and put in some
negative prices and it doesn’t blow-up. Must be something to do with your
data? I know the different lengths aren’t a problem as Amibroker automatically
starts with the shortest one (plus 10 days in your example).
SetForeign("IWM");
fcA = C;
RestorePriceArrays();
SetForeign("SMH");
fcB = C;
RestorePriceArrays();
Spread = fcA/fcB;
EMASpread = EMA(Spread ,10 );
Plot(spread,"spread",colorBlue);
Plot(EMASpread,"EMA",colorRed);
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Peter
Sent: Monday, September 05, 2005
17:17
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] EMA returning
{INF}
Hi
I want to calculate the EMA of the spread between two foreign
tickers but find the EMA function returns {INF} (infinite).
The code below calculates the spread OK but when included into EMA
function it returns {INF} (infinite).
The two foreign Tickers are back adjusted futures contracts with
some of the early data negative and also they have different data
lengths, if that makes any difference?
I assume the spread array supplied to the EMA function is
incompatible?
Any help would be appreciated.
Thanks
Peter
SetForeign(tickerA);
fcA = C;
RestorePriceArrays();
SetForeign(tickerB);
fcB = C;
RestorePriceArrays();
Spread = fcA/fcB;
EMASpread = EMA(Spread ,10 );
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 other support material please check also:
http://www.amibroker.com/support.html
YAHOO! GROUPS LINKS