Hello,

The following are the (debug) outputs of a tested position sizing algorithm.

I've attached a) part of the code , b) the output of the _TRACE() function from 
within the CBT code (the TRACE function had been placed within the most inner 
"if{}" code block), and c) the output of the AA Results window (Detailed Log).

Note that on the _TRACE() output, the equity on day 2 (21.01.2000) is still at 
its intial value (100000), so it hasn't been adjusted for price changes of the 
position taken at the close of day 1 (which did exist).

Since this equity value is used for calculation of the position size of 
subsequent signals, this is a problem.

On the other hand, the output of the AA Results windows on day 2 is correct 
(99823.2)

And - no - "Use previous bar equity for position sizing" is not activated.

Does anyone have an idea why bo.equity delivers incorrect values in this case?

Thanks in advance!

Part of CBT code in question:

                for ( sig = bo.GetFirstSignal( bar ); sig; sig = 
bo.GetNextSignal( bar ) )
                {
                    if ( sig.IsEntry() )
                    {
                        currEquity = bo.Equity;
                        pointVal = sig.PointValue;
                        cbtAtr = StaticVarGet( "statAtr" + sig.Symbol );
                        psUnits = int( currEquity * ( pctVolaRisk / 100 ) / ( 
cbtAtr[bar] * pointVal ) );
                        [_TRACE]                                
                        sig.PosSize = ( 2000 + psUnits ) * -1;
                    }
                }



DebugView Output:
[2856] Date: 20.01.2000 Symbol: FDRY Equity: 100000 Cash: 100000 ATR: 14.383258 
Units: 69
[2856] Date: 21.01.2000 Symbol: PCLN Equity: 100000 Cash: 89818.2 ATR: 
27.671930 Units: 36
[2856] Date: 21.01.2000 Symbol: TYC Equity: 100000 Cash: 89818.2 ATR: 14.318740 
Units: 69
[2856] Date: 25.01.2000 Symbol: AKAM Equity: 98382.8 Cash: 59163.1 ATR: 
27.247997 Units: 36
[2856] Date: 03.02.2000 Symbol: IBM Equity: 97308.7 Cash: 49107.9 ATR: 4.628230 
Units: 210
[2856] Date: 04.02.2000 Symbol: FDRY Equity: 97846.4 Cash: 42716.2 ATR: 
13.667122 Units: 71


AA Results Output:
20.01.2000
        Entry signals(score):FDRY=Buy(1), 
        Exit signals:
        Enter Long, FDRY, Price: 147.563, Shares: 69, Commission: 0, Rank: 1, 
Equity 100000, Margin Loan: 0, Fx rate: 1
        1 Open Positions: , FDRY (+69), Equity: 100000, Cash: 89818.2

21.01.2000
        Entry signals(score):PCLN=Buy(1), TYC=Buy(1), 
        Exit signals:
        Enter Long, PCLN, Price: 381, Shares: 36, Commission: 0, Rank: 1, 
Equity 100237, Margin Loan: 0, Fx rate: 1
        Enter Long, TYC, Price: 245.493, Shares: 69, Commission: 0, Rank: 1, 
Equity 100237, Margin Loan: 0, Fx rate: 1
        3 Open Positions: , FDRY (+69), , PCLN (+36), , TYC (+69), Equity: 
99823.2, Cash: 59163.1

24.01.2000
        Entry signals(score):
        Exit signals:
        3 Open Positions: , FDRY (+69), , PCLN (+36), , TYC (+69), Equity: 
98382.8, Cash: 59163.1

25.01.2000
        Entry signals(score):AKAM=Buy(1), 
        Exit signals:
        Enter Long, AKAM, Price: 279.313, Shares: 36, Commission: 0, Rank: 1, 
Equity 98825.1, Margin Loan: 0, Fx rate: 1
        4 Open Positions: , FDRY (+69), , PCLN (+36), , TYC (+69), , AKAM 
(+36), Equity: 98806.8, Cash: 49107.9

Reply via email to