Determining trade signals in a trend following system

Hello, I'm looking for help with a problem that I feel is rather basic, but is stumping me. I've been trading either single issue or mean reversion systems and to try and expand my skills I've been trying to code and learn trend following systems.

I've coded a simple 52 week breakout system, but I can't determine how I would actually take the signals to trade it. When I run a backtest it gives me a trade list with entry and exit dates. However when I run a scan I receive many buy/sell signals. Due to position limits they are not all going to be entered.

How do you determine when to place a buy or sell order in a trade system? Is there a simple way to do this with scan or explore I'm just not aware of? Any help or ideas would be appreciated.

Happy to include code if necessary, but I think this is more of a knowledge gap than a code issue.

If it helps, here are a few images/examples.

When I do a 1 day backtest it gives me open positions, but not signals if anything needs to be entered/closed:

If I do from the beginning there is a completely different set of trades to be in:

If running a scan signals are generated and displayed, but due to position size constraints and ranking these are not all actionable:

Am I not using scan/explore correctly or is there something missing in my code? What I think I'm after is just some way to determine when an open trade that shows up on the from the beginning backtest is supposed to be entered into:

The simplest way is:

  1. Run backtest (if you trade with 1-bar delay, make sure you use "Add artificial future bar in the settings)
  2. Scroll down to the very end of result list, observe result list and check if there are any trades with "Exit Date" being today. These are your sell/cover (exit) orders.
  3. Observe if there are any Open Long/Short positions at the end with Entry date of today. These are your buy/short (entry) orders.

Hi Tomasz,

Thank you very much, this is exactly what I was missing. I thought that there was just some setting or command I wasn't aware of! Now to just find the time to play around with this.

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