Does Positionscore for ranking only work with Rotational Trading? I'm using Buy/Sell signals on a watchlist and I need a way to filter when more than one symbol triggers a Buy. Positionscore doesn't seem to work for this situation.
yes it works very well.
What exactly are you trying to achieve?
I Backtested the following code on 1 bar to test PositionScore. It buys the first symbol alphabetically in the Watchlist, not the one with the highest score.
Buy = 1;
Sell = 0;
PositionScore = 100 + ROC(C,1);
@burger I tested the code you posted with some additional exploration lines:
Buy = 1;
Sell = 0;
PositionScore = 100 + ROC(C,1);
Filter = 1;
AddColumn(ROC(C,1), "Roc(C,1)", 1.2);
AddColumn(PositionScore, "P.Score", 1.2);
SetSortColumns(-4);
Here it works as expected: the backtest will buy CVCO.
I added your code lines and here's my Exploration. The backtest buys AAPL.
PositionScore has some perks one needs to understand:
One good read is this:
Symbol selection when PositionScore is not defined
Another important point to note is the native PositionScore behavior:
- On a given bar, you get, i.e., 10 Entry Signals, ranked by PositionScore
- You buy the best Signal with highest PositionScore and are out of cash to buy the 2nd Symbol with PositionScore ranked 2
- Now, and that's important, Native Behavior of AB: Even though you could buy Signal 3 with 3rd highest PositionScore, AB will not enter it. This may or may not be required, but natively, you'd have only 1 position in your portfolio.
There is something wrong with your settings, most likely due to CASH issues / POSITIONSIZE.
Try setting PositionSize to
SetPostionSize(1,SpsShares); // buy 1 share only
@burger, assuming that all the tickers that are present in your filter have been updated at the same time for the last bar) I would try to enable the detailed log in the Backtester settings dialog (under the Report tab) to see if it offers some indications about the possible causes of this unexpected behavior.
SetOption( "MaxOpenPositions", 1 );
SetPositionSize( 1,SpsShares );
Buy = 1;
Sell = 0;
PositionScore = 100 + ROC(C,1);
Filter = 1;
AddColumn(ROC(C,1), "Roc(C,1)", 1.2);
AddColumn(PositionScore, "P.Score", 1.2);
SetSortColumns(-4);
Exploration looks like this...
Backtest looks like this...
It seems to be ignoring PositionScore and ranking alpha.
What does the exact code look like that you are running?
Crank up your starting equity to 100k, too, just to be sure.
You could upload your .apx file, that would make checking settings a lot easier.
I think I've discovered my problem. Unchecking this box seems to have fixed it.
yes, see my reply. You are trading consciously or unconsciously on CLOSE with DELAYS=0;
==> Do NOT add future bar in this case.
1st june is a friday. 4th a monday...(see you detailed report file.), definitely it will cause a difference in behavior.
I confirm it. I was able to replicate your issue with the "Add artificial future bar" checked.
Mark your last post as the solution so other forum users will easily ascertain the reason of the problem.
Kudos to @Dionysos to suggest the idea to post the .apx to diagnose it.
In addition, I discovered PositionScore ignored issues with redundant Buy signals until I checked this box....
Thank you Dionysos and beppe.