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

[amibroker] Re: Setup for Forex backtesting



PureBytes Links

Trading Reference Links

Thank you very much for your reply. I think this can help me in many 
ways.

Also after reading more carefully the AFL manual I found the function 
BarsSince(). I think that by this function I can see the status (is 
it long or short) of my latest position but I cannot get it work 
correctly (maybe I am missing the nature of this function?!). 

Could you possible (or somebody else) check what is wrong with my 
following formulas in my backtesting script,

--- start of clip ---

// Initialize the trade commands
Buy = Sell = Short = Cover = 0;

// Count the bars since last command
Bu = BarsSince(Buy = 1);
Se = BarsSince(Sell = 1);
Sh = BarsSince(Short = 1);
Co = BarsSince(Cover = 1);

// Find out the status of latest position
LongOpen = (Bu < Se) AND (Bu < Sh) AND (Bu < Co);
ShortOpen = (Sh < Se) AND (Sh < Bu) AND (Sh < Co);
NoOpenPos = IIf(LongOpen + ShortOpen, 0, 1);

--- end of clip ---
Jan

--- In amibroker@xxxxxxxxxxxxxxx, "Pal Anand" <palsanand@xxxx> wrote:
> /* in Indicator Builder after running the back-test to see the 
chart 
>  of the number of Open long and short positions of your system. Use 
> the following code: */
> 
> Graph1 = Foreign( "~OpenLongPosCount", "V"); 
> //Plot(Graph1,"OpenLongPosCount",1,style=1,0,20);
> Graph2 = Foreign( "~OpenShortPosCount", "V"); 
> //Plot(Graph2,"OpenShortPosCount",2,style=1,0,20);
> //Plot(5,"MaxOpenPos",colorYellow);
> 
> rgds Pal



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 

------------------------ 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
---------------------------------------------------------------------~->

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/amibroker/

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/