It's my first post, so I want say Hello, from Poland
I have a little question. Is possible set position size of 10% equity by not less than 1600? (damn high provision )
e.g
Initial Equity: 10000
max open positions: 5 or whatever
In my code I set:
SetPositionSize( 10, spsPercentOfEquity ); thats great but how set no less than 1600?
Remove SetPositionSize( 10, spsPercentOfEquity ); and add the following at the top of your code
Code:
SetCustomBacktestProc("");
if ( Status( "action" ) == actionPortfolio )
{
// retrieve the interface to portfolio backtester
bo = GetBacktesterObject();
bo.PreProcess();
for ( bar = 0; bar < BarCount; bar++ )
{
// this retrieves current value of portfolio-level equity
eq = bo.Equity;
// this for loop iterates through all trade signals and adjust pos size
for ( sig = bo.GetFirstSignal( bar ); sig; sig = bo.GetNextSignal( bar ) )
{
// set 10% of equity but minimum 1600
sig.PosSize = Max( 0.1 * eq, 1600 );
}
bo.ProcessTradeSignals( bar );
}
bo.PostProcess();
}