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

[amibroker] Re: MACD and EMA - Help



PureBytes Links

Trading Reference Links

Barry,

There is no need to go outside amibroker users guide.
See

AFL Scripting Host ->Iterating through arrays->Examples->a) Indicator 
example - Exponential moving average
Tutorial: Understanding how AFL works->New looping,

it is quite informative for EMA internal structure and aligned to the 
international references.
As for your trading question, we may anticipate an EMA cross, I have 
posted the related formulas, but not 100%. Sometimes the precentage 
is good, but it is not 100%.I have used MAcross prediction in recent 
LightCrudeOil futures, it was excellent [and profitable], but it is 
not a rule for any stock/any time.
For realistic backtesting studies it is better to use +1Open.
Dimitris Tsokakis



--- In amibroker@xxxxxxxxxxxxxxx, "Barry Scarborough" 
<RazzBarry1@xxxx> wrote:
> I ran a back test using EMA 5/20 on the R2K buying and shorting as 
> the averages crossed. I used a $50,000 initial investment, Stop set 
> at 15% loss and bought/sold on the open, delay 0. I am not sure 
> which day open value was used with a delay of 0. The results I got 
> was a 3.7 billion dollar profit since Dec of 1987. Is that for 
> real??? If so why aren't we all billionaires?
> 
> What really made me wonder is that if I use a delay of 1 day, 
trying 
> to point to the next day's open, the results were drastically 
> different. Ditto if I use a close and delay of 0. In some cases it 
> went from a huge profit to a loss just by changing the trading day. 
> What is going on? I am not sure how to use the delay option.
> 
> The formula I used is against index RUT, from 9/10/87 to 12/9/03, is
> 
> Buy = Cross( EMA(C,5), EMA(C, 20));
> Sell = Cross( EMA(C, 20), EMA(C, 5));
> Cover = Buy;
> Short = Sell;
> Filter = 1;
> 
> A friend does not believe these results either and wanted to run a 
> separate program it verify the results. Can anyone tell me the C 
> formula for EMA?
> 
> The EMA adds a percentage of the last close, or whatever, to the 
> current day. But what percentage does it add to each day when a lot 
> of days are used? This comes into play when you are using many 
days, 
> 5 and 20 or whatever number of days. MACD using the EMA but with 
> three different periods. 
> 
> If someone already has a function that calculates the EMA in C or 
> some other language that would be even better.
> 
> Thanks,
> Barry


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/