Login Page - Create Account

Support Board


Date/Time: Mon, 10 Mar 2025 10:26:42 +0000



Post From: Backtesting with sc.AllowOnlyOneTradePerBar = TRUE

[2022-03-20 02:07:05]
1+1=10 - Posts: 270
Sorry for the delay in my response. I actually work on the weekend. I can't answer your questions exactly, as while it is easy to predict how SC behaves in live/delayed ACSIL trading, the backtesting portion, especially bar-based backtesting has its quirks as it is a convenience to make backtesting quicker when you don't need a super accurate backtesting environment.

Having said that, here are some thoughts:

1. I think in some sense the idea of having multiple entries per bar and using bar based backtesting don't really fit together. Bar based backtesting only looks at a bar's prices when that bar has closed so you don't know anything about the state of the bar as it developed. Hence, your ACSIL strategy should also only be looking at the bars when they are closed, using sc.GetBarHasClosedStatus().

2. If you want to develop an ACSIL strategy that can enter multiple times on the same bar then you need to use Replay Backtesting -- Auto Trade System Back Testing: Replay Back Testing - Automatic -- which actually replays all the data feed updates that it took to build your bar and calls your strategy for every update -- this could be 100s or 1000s of times for the same bar. This is how an ACSIL strategy would work in live/delayed trading.

3. Once you choose option 1 or option 2, then you can see if sc.MaximumPostionAllowed work as it should and you can also get more clarity about how your trading system will function if you exclude the most recent bar added to the chart.

Hopefully this helps.
Date Time Of Last Edit: 2022-03-20 02:07:48