Fractional shares with RoundLotSize = 0

I use Amibroker 6.40.4. I've been trying to backtest fractional shares filling the field General settings "Round Lot Size" with zero, but I couldn't make it work. I always obtain an integer number of shares. I tried for futures and stocks and I tried changing other parameters like "min shares".

However, with code it works fine:

// entry and exit signals
Buy = Cross(MACD(),0);
Sell = Cross(0,MACD());
Short = Cover = 0;

// if I comment this I cannot get fractional shares with settings
RoundLotSize = 0;

// set position size
SetPositionSize( 1000/3, spsShares);

The documentation assumes that it doesn't matter if you set up RounLotSize with code or settings, but that is not my case. What I am doing wrong?

Maybe you have RoundLotSize set to 1 in the SYMBOL itself. Symbols can define their own settings (see Symbol Information window)

3 Likes

Yes! that was the cause, automatically filled RoundLotSize = 1 by Norgate.
Thank you very much!

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