Exploration / backtest / Positionscore problems

Hi
I am unable to understand the logic behind the exploration process, so I can not follow my own system.
I have a system that buy up to 10 stocks, and sometimes sells one or two, sometimes all.
I use
SetTradeDelays(1,1,0,0);

So the buying day is one day after the buy signal.
So, I understand that i have to explore i.e. 29 jan, and the backtesting should be 30 jan.

And I use
PositionScore=10-Ref(MACD(12,26),-1)
I understand that positionscore affects backtesting, not exploration.
But If I order the exploration results, the stocks should be the same as backtest bought stocks.

All this works fine if I have not portfolio.
i.e. in 31 jan, and the exploration was:
ej%203%20ami
These are 6 stocks, ordered by the same formula as Positionscore
The backtest one day later, 3 feb , supposed there were no stocks in the portfolio, is:
ej%204%20ami

So, everything is perfect: the stocks bought are the 6 first stocks of the exploration the previous day.
(trying other dates, if there are more than 10 stocks, the first ten ordered by the positionscore rank are chosen)

But, if I backtest from several months before to 30 jan, the portfolio is full bought, and should only buy a new stocks if there is a previous selling
Well, in 31 jan there is a sell signal: will be sold LPG, obviously next day 3Feb.
Then, in 3 feb should be bought one stock.
Wich one? Supposed to be the first stock in the 31 jan exploration, wich was TFSL.
But there is no buying on 3 feb. The portolio remain only with 9 stocks.
ej%205%20ami
And the next day, 4 Feb, at last is bought one stock.
But is not bought the first of the 3Feb exploration, but the last one: RVNC
ej%206%20ami

I can not understand this logic
Any help will be really appreciated

This has been already discussed, just read existing topics before posting:
https://forum.amibroker.com/search?q=exploration%20backtest

Exploration is explained in the manual http://www.amibroker.com/guide/h_exploration.html
Just read it. It is not rocket science. Exploration displays each line (bar) that has Filter condition met. That is all. There are no other constraints.

Backtest is NOT exploration. These two are DIFFERENT. By design. Backtest is subject to multiple portfolio constraints. And it is as everything explained in super detail in the manual http://www.amibroker.com/guide/h_portfolio.html

Again, EVERYTHING you should know is written in the manual.

Last but not least, you are NOT entitled to receive ANY support unless you validate your license.

Your user account isn't marked with License verified badge. Did you purchase AmiBroker license?

Only users with License verified badge are allowed to post on this forum.

So before posting, make sure you verify your license as explained here.

Thread closed until user validates license.