My formula generates a lot of signals every day, and my max position is set to
10. So I use a PositionScore to rank the stocks that have a buy signal and buy
at the open the next day. On the first day of backtesting, the top ten stocks
ranked by PositionScore are picked and bought. This is exactly what I want it
to happen. At the closing of first day, three stocks meet the exit criteria and
get sold. On the second day backtesting, there are total seven old positions
and three new stocks are bought. However the three new stocks get selected are
not the highest ranking stocks in the PositionScore list. The three stocks are
ranked No. 3rd, 18th and 25th in the PositionScore list. This is very puzzling
to me. My formula is very simple and is like this:
BUY = condition1 and condition2 and condition3;
PosQty = 10;
SetOption("MaxOpenPositions", PosQty );
PositionSize = -100/PosQty;
SetTradeDelays(1,0,0,0);
BuyPrice = Open;
Sell = sell_condition;
SellPrice = Close;
PositionScore=100-RSI(14);
My question is why PositionScore works perfectly on the first day of
backtesting, but not the days thereafter? I have been working on this question
for quite a few days, but I just couldn't find an answer. Can anyone here help
me on this?
Thanks,
Tony