Please see code below. What i am trying to do is to find and buy the top 4 stocks (where the gain/day is the highest) in my watchlist of 10 stocks (mainly to test if the backtest does what i want).
The funny thing is the backtest gives me AXXJ, DBA, DBC and GLD as tickers to buy whereas explorae gives me ITA, XLF, JETS and DBC as seen in the pict.
Why does that happen? AXXJ, DBA and GLD are ranked actually ranked 6, 9, 8 from their values.

SetOption("InitialEquity", 100000);
SetOption("MaxOpenPositions", 4); //25% equity a trade
SetTradeDelays(1,1,1,1); // Buy/Sell at next bar after signal
SetPositionSize(25, spsPercentOfEquity ); //set 25% as max equity for each position. so total can have 4 concurrent positions
BuyPrice=Open; // buy at mkt open
SellPrice=Open; // sell at market open
//Buy criteria (Highest % gain)
Gain=100*((Close-Open)/Open);
Buy = Gain;
Sell = 0 ; // DO NOT exit normally
// APPLY STOP DURING BACKTESTING !
ApplyStop(stopTypeTrailing, stopModePercent, 15, True, True );
Filter = 1;
SetSortColumns( -5 );
AddTextColumn(fullName(), "Company");
AddColumn( Gain, "Gain", 1.4 );