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

Re: [amibroker] Help - Portfolio Backtester Issues



PureBytes Links

Trading Reference Links

Oops, my bad.
Chuck did write the convert.exe posted on Oct 1, 2004 and not a dll.
 
-CS
----- Original Message -----
From: Corey Saxe
Sent: Friday, September 16, 2005 4:51 PM
Subject: Re: [amibroker] Help - Portfolio Backtester Issues

Chuck Rademacher is the guy to contact. He used to be on this list, but haven't heard from him for some time.
He came up with a utility for AB to communicate with TradeSim. It probably needs to be updated by now.
 
TradeSim is at least as important to me as AB, if not more. AB picks the buys and sells while the analysis in TradeSim helps decide me decide if I'm on the right track.
 
It would be an incredible leap forward to get them integrated. If we could just convince David Samborsky to stop wasting time on MetaStock and write a dll for AB...
 
-CS
----- Original Message -----
From: dpweir
Sent: Friday, September 16, 2005 4:14 AM
Subject: [amibroker] Help - Portfolio Backtester Issues

Hello

 

I have been working on code to produce output from the backtester which meets a third party tool format, Tradesim’s Universal text Trade Database. Unable to produce this format so far, is the only reason why I have not ditched Metastock all together (I understand there is an exe available to do this but it does not look at an initialstop variable and requires a few too many button clicks for lazy me), so I am anxious to get this working.

 

Also I think this may be a another good example of using the PBI (hint hint Thomas)

 

I have posted the code below. The issues I have, are listed below and any input on how to resolve or work around these would be very much appreciated. Thomas any input appreciated =)

 

  1. Trade List

 

1.1    If I run the individual backtest, I only get the last symbols results.  Can the script be altered so all symbols are listed with their results ?

 

1.2    Portfolio backtest.  If we are unable to get the individual backtester working, what configuration would be required to get all possible trades using the portfolio backtester ?

 

  1. Date

 

I have changed my regional settings so the date is now in the format of yyyy/mm/dd, however there appears to be no option in my regional settings to have the date in the format of yyyymmdd , which is the format requirement.

 

  1. Initial stop value. 

 

I was going to leave this for a separate post,  but I feel like we are on a roll.  Is there also anyway to get the value of atr(period) at the first bar (or bar before) the entry signal ? This value is used for position sizing within Tradesim.

 

Many, many thanks.

 

Now the code,

 

/* Tradesim - Universal text Trade Database Version 1.0

Original sample code from PBI Collected Documentation, 'How to create a Trade List By ShortFox'

 

Requirements:  To generate YYYYMMDD output, declare it in your regional settings */

 

Buy = 0; Sell = 0; Short = 1; Cover = 0;

 

SetCustomBacktestProc("");

 

if ( Status( "action" ) == actionPortfolio )

{

    fh = fopen( "C:\\TestFile.trt", "w" );

 

    bo = GetBacktesterObject();

    bo.BackTest(); // High-Level backtest

    dt = DateTime();

 

    Initial_Stop = "0";

    // if Initial Stop data is not available then 0 placeholder should be used.

 

    for ( trade = bo.GetFirstTrade(); trade; trade = bo.GetNextTrade() )

    { // iterate through closed trades

        if ( trade.IsLong )

        {

            Long_Short = "L";

        }

        else

        {

            Long_Short = "S";

        }

        String =  trade.Symbol + " " + Long_Short + " " + NumToStr(trade.EntryDateTime,formatDateTime) + " " + NumToStr( trade.ExitDateTime, formatDateTime )

        + " " + Initial_Stop + " " + trade.EntryPrice + " " + trade.ExitPrice;

       if ( fh )

          fputs( string + "\n", fh );

    }

 

    fclose( fh );

}

 

// Your trading system here...

Buy = C > EMA(C,20);

Sell = C < EMA(C,20);

 

 

 





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 other support material please check also:
http://www.amibroker.com/support.html





YAHOO! GROUPS LINKS