PureBytes Links
Trading Reference Links
|
Hello,
Step ONE:
REMOVE the for loop. It is used incorrectly in your formula.
STEP TWO for starters:
Don't put array functions inside loop.
AFL is array processing language and you really NEED
to read "Understanding AFL" first:
http://www.amibroker.com/guide/h_understandafl.html
STEP THREE:
Buy needs to be ARRAY that has 1 (or true) for bars
when you are entering the trade. Your code actually
overwrote Buy array NumberOfBars-times with scalar zero or one.
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "davemabe2000" <davemabe@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Tuesday, January 01, 2008 2:22 PM
Subject: [amibroker] Backtesting Signals Generated from External Program
> I'm new to Amibroker and am trying to use it to backtest signals that
> come from an external program that get written to a CSV file.
>
> I'm able to use AFL to read the CSV file and create variable for each
> of the signals (using the symbol and the date and time of the entry).
> I'm also able to loop through the bars and compare current symbol and
> timestamp to see if it is a bar where an entry should occur.
>
> My AFL works fine in identifying the bars (executing the code in the
> IF block in the code below). However, the Buy and Sell variables
> aren't working as I
> thought they would. I'm getting far more entries in the backtest
> results than I should be.
>
> My question is: What should I be using for the Buy and Sell variables
> to initiate a buy for the current bar when it's identified an alert
> (but not otherwise)?
>
> for (i = 0; i < BarCount; i++) {
> Variable = Name() + DateTimeToStr(dt[i]);
> alert_now = VarGetText(Variable);
> if (alert_now != "") {
> // We've found an alert - try to generate a buy here.
> _TRACE("Found alert: " + Name() + " " + Variable);
> EOD = 0;
> EOD = IIf((Hour() == 15 AND Minute() == 59),1,0);
> Buy = 1;
> Sell = EOD;
> ApplyStop(1,1,1,1);
> }
> }
>
> Thanks and happy 2008.
>
>
>
> 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
>
>
>
>
>
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/
|