Limit applied as per settings, was: Position Sizing spsShares doesn't work

I am trying to buy 50 shares for 6B# using for simple formula below but it doesnt work.
I did my research in this forum to make sure the "allow position shrinking" is off and tried to lower "pointvalue" to buy small contract. But it doesnt work, it is not buying 50 shares, can anyone please help? Thanks in advance.

SetPositionSize( 50, spsShares );

KUn5 = StochK(8)>StochD(8) AND StochK(8)>20 OR StochK(8)>80; ;
KDn5 = StochK(8)<StochD(8) AND StochK(8)<80 OR StochK(8)<20; ;

Buy = ( KUn5 ) ; // Sell = KDn5 ; // //


@Jeras, I suggest examining the Detailed Log to understand better what happens.

IMO, it is the first tool to use when you see something that is not what you expect in the backtest results.

The reason could be insufficient funds, etc.

In your case this is probably due to the following setting:


that is in the Portfolio tab of the Analysis Settings dialog

1 Like

Thank you beppe, please see below the detailed log


It's because of this setting:

So decide yourself whether you want to set it to some other value other than 10%.

BTW you are trading forex/currency futures. So you have to apply futures modes.
Also look at your contract specification settings.

Read these articles

Here is the line that explains it:


@jeras, take care when saying "it" doesn't work. AmiBroker SetPositionSize functions correctly; your formula is what does not work.


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