Values of position size after setPosition Size

Hi guys. I need an explanation of what is happening to the positionSize.

setSize = percOfEquity;
setMethod = spsPercentOfEquity;

confirmedBuy = cancelledBuy =  confirmedSell =  cancelledSell = false;

if( useFileOverride )
{
    getCompletedTrades( "buyTrades", Name() );

    Buy = IIf( confirmedBuy OR cancelledBuy, buy,
               IIf( NOT( bi  == lastBar ), False,
                    iif( Ref( Nz( BarsSince( Buy ), 0 ), -1 ) < daysBeforeSell, False, buy ) ) );

    setSize = IIf( confirmedBuy, buySetVolume, setSize );
    setMethod = IIf( confirmedBuy, spsShares, setMethod );
    _TRACE( "setSize  " + setSize );
    _TRACE( "setMethod  " + setMethod );
}
else
{
    sinceBuy = Nz( BarsSince( Buy ), 0 ) ;
    buy = IIf( Ref( sinceBuy, -1 ) < daysBeforeSell, False, Buy );
}

_TRACE( "PositionSize " + PositionSize );
SetPositionSize( setSize, spsShares );
_TRACE( "PositionSize " + PositionSize );

_trace statements from my code

image

setSize and setMethod appear correct.

What I don't understand is the value of positionSize after the setPosition statement and how that relates to the value on the result list after the backtest where its shows as 1250.. I was expecting the positionsize to be 1260 and be reflected in the result list.

There is only one setPostionSize in my code. With or without using a final backtester routine the result is the same.
image

Thanks for any advice,
Gary.

appear that my setting
image

was previously set to 50.

Should this have the effect I was getting?

Yes! But any reason you can't test the result of the adjusted setting...

Thanks, I have tested that but wanted to make sure that it was likely to be the only cause. For now, I will take it that it was.

Appreciate the response,
Gary

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.