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
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.
Thanks for any advice,
Gary.