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

Re: [amibroker] varying PositionSize daily



PureBytes Links

Trading Reference Links

Sorry to reply to my own question, but apparently, and to my own
amazement, I have been able to come up with a solution.

First I created a composite that contains the integer I need, which
is the net number of surviving setups on any particular trading day.

>From there, it's fairly easy to define capital as another integer,
then write a PositionSize statement using conditional IIF.

PositionSize = IIF(PositionNumber <= X, Y, Capital / PositionNumber);

PositionNumber is obtained by using Foreign of course.

It seems to work just fine.  PositionSize is reduced only when
necessary, and I can get a fine backtest showing pretty much how this
should work in real time, rather than backtesting simply with a
constantly reduced position size.

Sorry for the intrusion, but gosh is this stuff ever sticky for me.

Yuki

YT> I need to get an integer returned that would be the number of
YT> conditional orders I would need to enter on any given day, so that I
YT> can use that integer to dynamically set PositionSize every day.

YT> My question is, how do I get my backtest to count the number of
YT> setups each day, and store that number as the integer I need to set
YT> PositionSize.

YT> I can handle the setting of PositionSize without any problem, I am
YT> pretty sure.  But I don't know how to make my setup exploration
YT> (which I would incorporate into the backtest for this purpose) count
YT> the number of setups and store that as a dynamic variable (if that is
YT> the right terminology).

YT> Anyone?

YT> Yuki




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.6/617 - Release Date: 1/5/2007 11:11 AM