Question regarding position sizing


Is it possible, using the positionsize variable, to size the position based on the close of the previous day of the entrydate and not on the open of the entrydate?

Currently I use a % position size line:

PositionSize = -2;


Or by code

SetOption("UsePrevBarEquityForPosSizing", True);
1 Like

Somehow this is not working as expected. Maybe I'm missing something. Currently I have the positionsize based on 10% of the equity. When I look at my first trade and a starting capital of 10000. I would suspect the position size to be: ps= 10000*0.1/close(previous day) which is 5.13 = 194.9 --> 194. Amibroker displays 195 which is probably based on the opening of 5.12.



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?

Hints: use "Detailed log" report mode.


Fantastic suggestion Tomasz, thank you.


The positionsize variable indeed uses the opening price of the entrydatetime. The question then remains how to use the close of the previous day to calculate the correct position size (for this specific purpose of course).

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