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

Re: [amibroker] Re: Amibroker to TradeSim Code - Help Required Please!!



PureBytes Links

Trading Reference Links

I wonder why you insist on using TradeSim while AB has way superior portfolio backtester with
features that Tradesim users can only dream about.

Tradesim is for Metastock that does not have portfolio optimizer.

Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "chorlton_c_hardy" <chorlton-c-hardy@xxxxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Thursday, February 14, 2008 11:38 AM
Subject: [amibroker] Re: Amibroker to TradeSim Code - Help Required Please!!


> Hi All,
> 
> Just wanted to bump up this message to the top again just in case 
> anyone can help me out with it. I've tried to resolve the issue 
> myself but am getting strange results and consequently seem unable to 
> find a solution.
> 
> Any help or advice would be most welcome....
> 
> Thanks all,
> 
> Chorlton
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "chorlton_c_hardy" <chorlton-c-
> hardy@xxx> wrote:
>>
>> 
>> Hello All,
>> 
>> I've managed to find some code which allows me to export an 
> Amibroker
>> Exploration File to TradeSim for further analysis. This code is 
> posted
>> below:
>> 
>> 
>> 
>> Buy = Ref(Buy,-1); Sell = Ref(Sell, -1);
>> 
>> Cover = 0; Short = 0;
>> 
>> TradeStop = LLV(Low,10); // Initial stop for TradeSim
>> 
>> Equity( 1 ); // evaluates trades and stops
>> 
>> Filter = Sell;// OR Cover;
>> 
>> IsLong = Sell;
>> 
>> dt = DateTime();
>> 
>> // Determine values for Explorer
>> 
>> EntryDate = IIf( IsLong, ValueWhen( Buy, dt ), ValueWhen( Short, 
> dt ) );
>> 
>> ExitDate = dt;
>> 
>> EntryPrice = IIf( IsLong, ValueWhen( Buy, BuyPrice ), ValueWhen( 
> Short,
>> ShortPrice ) ); // Set buy and sell prices to Open for TradeSim
>> 
>> ExitPrice = IIf( IsLong, SellPrice, CoverPrice );
>> 
>> EntryLow = IIf( IsLong, ValueWhen( Buy, L ), ValueWhen( Short, 
> L ) );
>> 
>> EntryHigh = IIf( IsLong, ValueWhen( Buy, H ), ValueWhen( Short, 
> H ) );
>> 
>> EntryVolume = IIf( IsLong, ValueWhen( Buy, Ref(V,-1) ), ValueWhen(
>> Short, Ref(V, -1) ) );
>> 
>> InitialStop = IIf( IsLong, ValueWhen( Buy, TradeStop ), ValueWhen(
>> Short, TradeStop ) );
>> 
>> ExitLow = L;
>> 
>> ExitHigh = H;
>> 
>> SetOption("NoDefaultColumns", True );
>> 
>> AddTextColumn( Name(), "Symbol" );
>> 
>> AddColumn( IIf( IsLong, 76, 83 ), "Long/Short", formatChar ); // L 
> or S
>> letter
>> 
>> AddColumn( EntryDate, "EntryDate", formatDateTime);
>> 
>> AddColumn( ExitDate, "ExitDate", formatDateTime);
>> 
>> AddColumn( InitialStop, "Initial Stop", 1.3 );
>> 
>> AddColumn( EntryPrice, "EntryPrice", 1.3 );
>> 
>> AddColumn( ExitPrice, "ExitPrice", 1.3 );
>> 
>> AddColumn( EntryLow, "EntryLow", 1.3 );
>> 
>> AddColumn( EntryHigh, "EntryHigh", 1.3 );
>> 
>> AddColumn( L, "ExitLow", 1.3 );
>> 
>> AddColumn( H, "ExitHigh", 1.3 );
>> 
>> AddColumn( EntryVolume, "EntryVolume", 0.0);
>> 
>> 
>> 
>> Unfortunately, this code seems to work for LONG trades only.
>> Consequently, does anyone know how I can modify it to include SHORT
>> trades?
>> 
>> I have tried to modify it myself but have run into all kinds of 
> problems
>> such as incorrect price data, missing price data, etc, etc.
>> 
>> So far I have made the following changes (which may or may not be
>> right):
>> 
>> Cover = Ref(Cover , -1); Short = Ref(Short,-1);       (2nd line of 
> code)
>> 
>> Filter = Sell OR Cover ;    (5th line of code)
>> 
>> In addition, does anyone know how I can incorporate TWO Initial 
> Stops
>> into the same system (1 Stop for LONG Trades and 1Stop for SHORT 
> Trades)
>> so that AB & TradeSim know which stop to use depending on whether 
> the
>> trade is LONG or SHORT??
>> 
>> For the system above, the initial stop for Short trades would 
> be:    
>> TradeStop = HHV(High,10);
>> 
>> 
>> 
>> Any help much appreciated as I'm not sure how to proceed,
>> 
>> 
>> 
>> Thanks
>> 
>> Chorlton
>>
> 
> 
> 
> 
> 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/