Re: [amibroker] Can positionsize be different for Buy and Short?

2010-06-09 Thread Brenton Hill

You can use an IIf statement

PositionSize = IIf(Buy,LongPositionSize,ShortPositionSize);

or use it inside a SetPositionSize() call as follows:

SetPositionSize(IIf(Buy,LongPositionSize,ShortPositionSize),spsValue)

Brenton


David wrote:
 

I have a long/short strategy.  I calculate positionsize differently 
for the long an short entries.  Do I handle this be placing two 
positionsize statements in my code, one before the Buy and another 
before the Short?  Or does the backtester only use the last 
positionsize statement it sees in the code?


Warm regards,
David




__ Information from ESET Smart Security, version of virus 
signature database 5183 (20100608) __


The message was checked by ESET Smart Security.

http://www.eset.com




__ Information from ESET Smart Security, version of virus signature 
database 5183 (20100608) __

The message was checked by ESET Smart Security.

http://www.eset.com



Re: [amibroker] Can positionsize be different for Buy and Short?

2010-06-09 Thread David
Thanks, Brenton!

Warm regards,
David


On Tue, Jun 8, 2010 at 11:37 PM, Brenton Hill bphill0...@yahoo.com.auwrote:



 You can use an IIf statement

 PositionSize = IIf(Buy,LongPositionSize,ShortPositionSize);

 or use it inside a SetPositionSize() call as follows:

 SetPositionSize(IIf(Buy,LongPositionSize,ShortPositionSize),spsValue)

 Brenton


 David wrote:



 I have a long/short strategy.  I calculate positionsize differently for the
 long an short entries.  Do I handle this be placing two positionsize
 statements in my code, one before the Buy and another before the Short?  Or
 does the backtester only use the last positionsize statement it sees in the
 code?

 Warm regards,
 David


 __ Information from ESET Smart Security, version of virus signature
 database 5183 (20100608) __

 The message was checked by ESET Smart Security.

 http://www.eset.com



 __ Information from ESET Smart Security, version of virus signature
 database 5183 (20100608) __

 The message was checked by ESET Smart Security.

 http://www.eset.com