Max open positions 10, but it is taking only 9

I have an issue with a rotational backtest. I have specified max open positions as 10. But it is taking only 9 . What am I doing wrong please? I have the following codes:

SetOption("InitialEquity", 100000);
SetOption("MinShares", 1);
SetOption("MinPosValue", 0);
SetOption("FuturesMode", False);
SetOption("AllowPositionShrinking", False);

RoundLotSize = 0;
TickSize = 0;
MarginDeposit = 0;
PointValue = 1;

SetOption("AccountMargin", 100);
SetOption("MarginRequirement", 100);

Totalpositions = 10;
SetOption("MaxOpenPositions", Totalpositions );
OrigPositionSize = -100 / Totalpositions ;
PositionSize = IIF(BullMarket,OrigPositionSize, 0);

See How-to-use-this-site.



To get better understanding of what is happening in your code and how functions work, use advice given here: How do I debug my formula?

Use "DETAILED LOG" - it will give you the answers you seek. Most likely you switched off shrinking position and you are out of money to buy 10th position.

1 Like

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