Australian (ASX) Stock Market Forum

Maximum Position Value

Joined
7 June 2007
Posts
28
Reactions
0
Hi all,
I am using a pretty standard position size setup as follows:
maxpos = 4; // maximum number of open positions
SetOption("InitialEquity", 100000 ); // set initial equity = 100K
SetOption( "MaxOpenPositions", maxpos );
SetPositionSize( 100 / maxpos, spsPercentOfEquity );

What I want to do is control trade size so that each trade is no more than 8% of daily volume. I know this can be done in the back test settings and saved in an .apx. Can it be done in the AFL though?
So something like this:
MaxPosValue = C * V * (8/ 100);

but how to incorporate that into the position sizing is the question?

TIA.
Steve c
 
Try this mate, seems to work but have a play.

MaxPosValue = C * V * (.08);
PositionSize = SetPositionSize ( MaxPosValue, 1);

SYNTAX SetPositionSize( size, method )
RETURNS ARRAY
FUNCTION This function allows to control trade (position) size in four different ways, depending on 'method' parameter.
Parameters:

size (ARRAY) defines desired trade size

method (ARRAY) defines how 'size' is interpreted

  • spsValue (=1) - dollar value of size (as in previous versions)
 
Try this mate, seems to work but have a play.

MaxPosValue = C * V * (.08);
PositionSize = SetPositionSize ( MaxPosValue, 1);

SYNTAX SetPositionSize( size, method )
RETURNS ARRAY
FUNCTION This function allows to control trade (position) size in four different ways, depending on 'method' parameter.
Parameters:

size (ARRAY) defines desired trade size

method (ARRAY) defines how 'size' is interpreted

  • spsValue (=1) - dollar value of size (as in previous versions)
Awesome, will give it a try.
 
Top