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

RE: [amibroker] Work in Progress - Tradesim - Universal text Trade Database Version 1.1



PureBytes Links

Trading Reference Links

Hi Thomas

 

This thread is more relevant to those that went down the path of Metastock/Tradesim, before using Amibroker. I am not sure of the number of users out there, but I would not be surprised if there are a few.

 

There is no point me rubbishing metastock (I am sure that there are many happy users and it probably has it strengths) but migrating completely away from Metastock is something I have always wanted to do, but the only thing holding me back is Tradesim … while an expensive product (A cost I have already borne), I find it excellent for Monte Carlo testing.

 

Now that I have your attention Thomas (sorry for the cheek), can you help me with the last issue, of an initial stop value which is used for position sizing.  While this value could be anything, I commonly use the volatility percent risk, so I would need to calculate (in this example, atr(periods)) at the beginning of the trade. This value is actually the demoninator which is used by tradesim in the equation for percent risk, such as risk * capital/(initial stop)

  

Thank you

 

Best regards

 

Dave

 

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of Tomasz Janeczko
Sent: Saturday, 17 September 2005 7:42 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: Re: [amibroker] Work in Progress - Tradesim - Universal text Trade Database Version 1.1

 

Hello,

 

Sorry to say but these things you are doing make no sense to me.

 

Tradesim was written for Metastock

to address its inability to perform portfolio backtests.

 

But AmiBroker performs full portfolio backtesting, with position sizing, ranking/scoring, rotational and all other

kinds of bells and whistles that other tools are not capable of and there is no reason to use external tools at all.

 

If you are after monte carlo simulation part - you can achieve the same result with FREE MC tools out there

without spending heaps of dollars on Tradesim.


Best regards,
Tomasz Janeczko
amibroker.com

----- Original Message -----

From: dpweir

Sent: Saturday, September 17, 2005 10:59 AM

Subject: RE: [amibroker] Work in Progress - Tradesim - Universal text Trade Database Version 1.1

 

Dealing with issue 1, one workaround which is testing well compared to Metastock output is adding this to the beginning of the trading system part when running the Portfolio backter, this is on a watch list of the ASX300, over 1500 periods.

 

Over 26 000 trades are recorded using a simple system of buy c>ema(c,20) and sell c<ema(c,20).

 

SetOption("InitialEquity", 10000000000000000 );

SetPositionSize( 1, spsShares );

SetOption("MaxOpenPositions", 1000 );

 

Regards

 

Dave

 

 

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of dpweir
Sent: Saturday, 17 September 2005 5:15 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Work in Progress - Tradesim - Universal text Trade Database Version 1.1

 

Just an update, of the 3 issues I posted earlier, I have managed to resolve issue 2, which was the date format, following an example of code posted by Stephane Carrasset.  Tradesim will now load successfully the file produced just by double clicking the file. Note that you must change your regional date settings to the format, YYYY/MM/DD. Cheers.

 

The two issues which remain are,

 

 

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

 

I would appreciate any help as I am a complete novice with Amibroker.  Here is the updated code,

 

 

 

/* Tradesim - Universal text Trade Database Version 1.1 - Work in Progress

 

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

 

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

 

Revisions 1.1 Remove separators / from date format

 

Current Issues

- does NOT produce full trade list - all individual trades

- Initial stop value not yet used. Currently set to 0

 */

 

 

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";

        }

 

// Revision 1.1 Fixup date format for Tradesim - remove date separators

EntryDate =  NumToStr(trade.EntryDateTime,formatDateTime);

entryyyyy=StrLeft(EntryDate,4);

entrymm=StrMid(EntryDate,5,2);

entrydd=StrRight(EntryDate,2);

TSEntryDate = entryyyyy+entrymm+entrydd;

 

ExitDate =  NumToStr(trade.ExitDateTime,formatDateTime);

Exityyyy=StrLeft(ExitDate,4);

Exitmm=StrMid(ExitDate,5,2);

Exitdd=StrRight(ExitDate,2);

TSExitDate = exityyyy+exitmm+exitdd;

 

 

 

        String =  trade.Symbol + " " + Long_Short + " " + TSEntryDate + " " + TSExitDate

        + " " + 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





SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS