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

Re: [amibroker] Idiosyncrasy of AmiBroker and Holy Grail



PureBytes Links

Trading Reference Links

First of all - if you use todays CLOSE price in ANY of calculations
you must set trading delays to ONE.

SetTradeDelays( 1, 1, 1, 1 );

Second rule: one trade (either short or long, not both) per single bar per symbol.
Third rule: If you want to simulate day trading use intraday data. 

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "buandbe" <buandbe@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, May 12, 2008 10:51 PM
Subject: [amibroker] Idiosyncrasy of AmiBroker and Holy Grail


> 
> I found a Holy Grail... till I found the error, that is.
> 
> ------------------------------------------------------
> 
> Buy_Open = Ref( Open, -1 ) > Ref( Close, -1 ); // Previous Bar is Down
> Short_Open = Ref( Open, -1 ) < Ref( Close, -1 ); // Previous Bar is Up
> Buy_Close = Open < Close; // This Bar is Up
> Short_Close = Open > Close; // This Bar is Down
> 
> Buy = Buy_Open OR Buy_Close;
> Short = Short_Open OR Short_Close;
> Sell = Short;
> Cover = Buy;
> 
> BuyPrice = IIf( Buy_Open, Open, IIf( Buy_Close, Close, 999999 ) );
> ShortPrice = IIf( Short_Open, Open, IIf( Short_Close, Close, -999999 ) );
> SellPrice = ShortPrice;
> CoverPrice = BuyPrice;
> 
> // "ALLOW SAME BAR EXIT (SINGLE BAR TRADE)" is on
> 
> ------------------------------------------------------
> 
> AmiBroker does not show some losers and significantly overstates profits.
> 
> ex.
> 
> Open Close 
> Day 0 Down 
> Day1 Up Long Still Long
> Day2 Up reverse to Short reverse to Long
> 
> The Short trade on Day2 from Open to Close is not accounted for.
> 
> Could anyone correct the code so that it shows more realistic results ?
> 
> TS
> 
> 
> 
> ------------------------------------
> 
> 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/