PureBytes Links
Trading Reference Links
|
Hello All,
My first purpose is to understand better the AA functions
(scan-exploration-backtesting).
I read the user's guide and I also searched into the Amibroker mailing list
Collection.
I found useful the code posted with the message 30344, so I have used a part
of it for testing.
Well, starting an exploration it give me a right buy and sell price in the
"results" window.
But the backtesting don't give the same results: the dates and prices don't
correspond.
This is the code I used (tested on one single stock [BRCM], from 01/01/2003
to 31/01/2003):
Filter = Buy=1 OR Sell=1;// condition TRUE (1) or FALSE (0)
AddColumn(O,"Open",1.2);
AddColumn(C,"Close",1.2);
AddColumn(O,"Buy",1.2);
AddColumn(C,"Sell",1.2);
//DELAY manual setting
Buy_Delay = 1;
Sell_Delay = 2;
Short_Delay = 1;
Cover_Delay = 1;
SetTradeDelays(Buy_Delay, Sell_Delay, Short_Delay, Cover_Delay);
//Buy=Cross(C,EMA(C,10));
//Sell=Cross(EMA(C,10),C);
Buy=1;
Sell=1;
BuyPrice = Ref(O,Buy_Delay);
SellPrice = Ref(C,Sell_Delay);
AddColumn(Buy_Delay,"Buy Delay",1.0);
AddColumn(IIf(Buy==1,BuyPrice,0),"Delayed Buy Price",1.2);
AddColumn(Sell_Delay,"Sell Delay",1.0);
AddColumn(IIf(Sell==1,SellPrice,0),"Delayed Sell Price",1.2);
Then, if I change
Buy=1;
Sell=1;
With
Buy=Cross(C,EMA(C,10));
Sell=Cross(EMA(C,10),C);
Both the exploration and the backtesting seem to work.
What I'm a doing wrong ?
Thanks for your valuable help.
Best Regards
Antonio
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/
|