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

[amibroker] Futures mode equity query.



PureBytes Links

Trading Reference Links

Hi,

    I'm trying out some money management back tests in Futures Mode
(using the latest version of AmiBroker).

    I have a basic system setup to test Fixed Ratio money management
method on the Australian SPI 200 Futures contract (which is the ticker
AO (old) and AP (new) merged together).

    Based on the URLs below I believe this contract requires a margin
deposit of $2200 and has a point value of $25.  I also believe the round
lot size is 1 and tick size is 1.

    http://www.sfe.com.au/content/clearing/operations/marginrates.pdf
    http://www.sfe.com.au/content/sfe/trading/con_specs.pdf

    I am running this system below and finding that Equity(0) function's
return value is growing way too fast in comparison to the Portfolio
Equity graphs (eg, Foreign("~~~EQUITY", "C")).

    Eventually this Equity(0) value overflows and starts causing the
contract size calculations to fail.

    I must be doing something wrong with setting the system up for
testing futures - can anyone see anything in the code below?

    I've also set the same information (RoundLotSize / TickSize /
PointValue / MarginDeposit) on the actual symbol itself
[Symbol->Information] and in the AA "Settings..." dialog.

Thanks for taking a look,

Dan.

SetTradeDelays(1, 1, 0, 0);

BuyPrice = SellPrice = Open; // Buy and Sell on market open for now

Buy = Cross(MACD(), Signal());  // Some basic system
Sell = Cross(Signal(), MACD());

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

// I think these are correct for SPI 200
RoundLotSize = 1;           // minimum unit is '1' contract for SPI (?)
TickSize = 1;               // minimum tick is '1' for SPI (?)
MarginDeposit = 2200;       // $2200 margin for SPI
PointValue = 25;            // $25 AUD per point in SPI

//
// This is where it gets crazy 
// Equity(0) seems to be getting too large too quickly...
//

// Get current trading capital (Equity(0) is No-Op function correct?)
CurrentCapital = Equity(0); 

// How much we started with
StartCapital = 50000;       

// Fixed ratio delta
Delta = 10000;

// The following lines calculate the number of contracts according 
// to fixed ratio money management method

GrowthCapital = CurrentCapital - StartCapital;
GrowthCapital = Max(0.01, GrowthCapital);

Contracts = 1 + floor(sqrt(0.5 + ((2 * GrowthCapital / Delta) + 0.25)));

Contracts = Max(Min(Contracts, 50), 1); // Keep value in range 1..50

printf("Contracts = %f\n", Contracts);  // Show on value on
interpretation window

PositionSize = Contracts * MarginDeposit; // If I allow a (C*MD)
position size it will buy "C" contracts right?




=======================================================
                                     IMPORTANT INFORMATION

This message and any files transmitted with it are confidential and should be read only by those persons to whom it is addressed.   
If you have received this message in error, please notify us immediately by way of reply. Please also destroy and delete the message from your computer. Any unauthorised form of reproduction of this message is strictly prohibited. 

It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system.  
SEALCORP does not warrant that the information is free of a virus or any other defect or error.

SEALCORP is not liable for the proper and complete transmission of the information contained in this communication, nor for any delay in its receipt.

Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of SEALCORP.

=======================================================





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/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 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/

<*> 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/