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

[amibroker] Re: Custom Backtester Procedure



PureBytes Links

Trading Reference Links

 Thanks Keith

Will add it tomorrow.Have to out for lunch early.

Ray

--- In amibroker@xxxxxxxxxxxxxxx, "Keith McCombs" <kmccombs@xxx> 
wrote:
>
> Ray --Here is the code snippet that adds two columns to the AA trade
> list.  Hope this helps.Sorry for the double spacing.  I'm on 
vacation
> with a much to old laptop that is full of quirks I can't fix. I 
agree, we
> need a lot more, and dumbed down, info on CBT.  A larger variety of
> examples would be helpful.Maybe we could get Howard Bandy or Herman
> (Intro to ATC) to work on this??-- Keith
> 
> SetCustomBacktestProc
> 
> ("");
> 
> if
> 
> ( Status("action") == actionPortfolio )
> 
> {
> 
> bo =
> 
> GetBacktesterObject();
> 
> NoTradeList=True;
> 
> bo.Backtest(NoTradeList);
> 
> PosSumProfit =
> 
> 0;
> 
> NegSumProfit =
> 
> 0;
> 
> // iterate through closed trades first
> 
> for(trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade())
> 
> {
> 
> profit = trade.GetProfit();
> 
> if(profit >= 0)PosSumProfit = PosSumProfit + profit;
> 
> else NegSumProfit = NegSumProfit + profit;
> 
> trade.AddCustomMetric(
> 
> "Profit so far", PosSumProfit);
> 
> trade.AddCustomMetric(
> 
> "Loss so far", NegSumProfit);
> 
> }
> 
> // iterate through eventually still open positions
> 
> for(trade = bo.GetFirstOpenPos(); trade; trade = bo.GetNextOpenPos
())
> 
> {
> 
> profit = trade.GetProfit();
> 
> if(profit >= 0)PosSumProfit = PosSumProfit + profit;
> 
> else NegSumProfit = NegSumProfit + profit;
> 
> trade.AddCustomMetric(
> 
> "Profit so far", PosSumProfit);
> 
> trade.AddCustomMetric(
> 
> "Loss so far", NegSumProfit);
> 
> }
> 
> bo.ListTrades();
> 
> }
> 
> // Your system codes starts here
> 
> Sell
> 
> = Cross(MACD(), Signal());
> 
> Buy
> 
> = Cross(Signal(), MACD());
> 
>   -------------- Original message --------------
>   From: "me_rayme" <rayme9@xxx>
> 
>   Thanks Keith
>   Seems like we need more info on just how Custom BT works. So far I
>   believe it only affects the REPORT, not the AA view list.
> 
>   I also just found some data in Knowlodge Base Apr 4 2006 page 2.
> 
>   http://www.amibroker.com/kb/page/2/
> 
>   I will try using trade.AddCustomMetric.
> 
>   My main COMPLAINT is that the AA column listings have to be reset
>   each time to show the minutes. My main interest NOW is in the
>   Win/Loss ratio as I use ER2 one minute.
> 
>   Also the ALERT OUTPUT column width also have to be set each day to
>   show minutes. I use this in a Auto trading concept where the Time 
and
>   Text is tranfered to a macro, which the buys and sells using 
another
>   front end and IB. TJ promised a fix on this last year!
> 
>   I can see today TJ has put new info on "line thinner". Now TJ 
should
>   expand this further on "Custom Backtester".
> 
>   Ray
> 
>   --- In amibroker@xxxxxxxxxxxxxxx, "Keith McCombs" <kmccombs@>
>   wrote:
>   >
>   > Ray --I asked a very similar question two days ago, but
>   unfortunately
>   > have received no replies to it. I am repeating it below in hopes
>   that
>   > someone will be able to answer both our questions.==========
>   Original
>   > Questions =============1. Using custom backtester, high level, I
>   tried
>   > to add two columns to the AA view list. first column using:
>   > trade.AddCustomMetric("Profit so far", PosSumProfit); second 
column
>   > using: trade.AddCustomMetric("Loss so far", 
NegSumProfit);However,
>   what
>   > I get instead is one column with label for which ever happened
>   first. It
>   > contains both correct "Profit so far" and "Loss so far" values. 
2.
>   I do
>   > not want all of the default columns, just ones I specify. Can I 
do
>   this
>   > with high level custom backtester? If not, then with what?
>   ====================================Ray, I
>   > placed the trade.AddCustomMetric() statements inside the for()
>   loops.
>   > This places the column(s) on the AA tade list. Using
>   bo.AddCustomMetric()
>   > after the for() loops places the results on the Statistics page 
of
>   the
>   > Backtest Report (the backtest has completed). -- Keith
>   >
>   > -------------- Original message --------------
>   > From: "me_rayme" <rayme9@>
>   >
>   > I have been studying it at
>   > http://www.amibroker.com/guide/a_custombacktest.html
>   >
>   > I have put my software in it as shown in the example by Paul Ho.
>   It
>   > works BUT all it shows is 3 items in the REPORT, Ave Profit/loss
>   %,
>   > AveProfit %, AveLoss %.
>   >
>   > What I want is to revise columns in the AA columns like Date, Ex
>   date
>   > to change WIDTH to show minutes ,etc and delete columns that I 
do
>   not
>   > require.
>   >
>   > Can this be done? Does anybody have software to do this.
>   >
>   > Ray
>   >
>   > Messages in this topic (1) Reply (via web post) | Start a
>   > new topic Messages | Files | Photos | Links | Database |
>   CalendarPlease
>   > 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
>   > Change settings via the Web (Yahoo! ID required)
>   > Change settings via email: Switch delivery to Daily Digest |
>   Switch
>   > format to Traditional
>   > Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe
>   >
> 
>   Messages in this topic (6) Reply (via web post) | Start a
>   new topic Messages | Files | Photos | Links | Database | 
CalendarPlease
>   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
>   Change settings via the Web (Yahoo! ID required)
>   Change settings via email: Switch delivery to Daily Digest | 
Switch
>   format to Traditional
>   Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe Recent
>   Activity
> 
>     *  59New Members
> 
>     *  5New Files
> 
>   Visit Your Group SPONSORED LINKS
> 
>     * Investment management software
> 
>     * Investment property software
> 
>     * Investment software
> 
>     * Investment tracking software
> 
>     * Return on investment software
> 
>   Yahoo! News
> 
>   Science News
> 
>   Get the latest
> 
>   scientific news.
> 
>   Yahoo! TV
> 
>   Want the scoop?
> 
>   Check out today's
> 
>   news and gossip.
> 
>   Search Ads
> 
>   Get new customers.
> 
>   List your web site
> 
>   in Yahoo! Search.
> 
>   .[IMAGE]
>




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Transfer from your equities account.  
Receive up to $1,000 from GFT. Click here to learn more.
http://us.click.yahoo.com/aZttyC/X_xQAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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/