Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 23:21:16 +0000



[Programming Help] - automated backtesting - tips, best practices

View Count: 1745

[2019-02-05 04:35:13]
Chad - Posts: 231
Question: if possible, could you offer some general tips or 'best practices' on what might be the most efficient configuration for backtesting in context of long-timeframe (e.g. 5 years), granular (e.g. 1-min OHLCV bars) data on ~100 instruments with several studies to test for each, and routines to vary the values used for study parameters and order logic while in backtesting mode?

E.g.
- run multiple instances of SC?
- work mostly/totally at ACSIL level (if possible)?
- only use bar-based backtesting?


I've been told by someone with substantial experience developing for SC that, at the application level, it can only perform ~150 backtest permutations per hour. Given the thousands of different combinations that I'll have for the *first* and largest backtest, that'd take several days. But, that may be assuming backtests within the Market Replay module.
I plan to run longer-timeframe and more intricate iterations of backtests each weekend between 17:00 Friday to 02:00 Monday, so a 57-hour window; then Mon-Thu, from 17:00-02:00, I simply run backtests on the prior trading session only, for each instrument. I could do most or all of the Market Replay backtests during the weekend, and limit to bar-based Mon-Thu night.


Additional background info, if interested: I'm looking to build a systematic, fully-automated trading system within SC as much as possible, which includes a backtesting routine to do 'limited optimization' of study parameters and order logic (sizes, limit prices, etc). An obvious, simple example would be a 'fast' SMA crossing above/below a 'slow' one - the backtest would vary the period of both SMAs within their own separate ranges and increment/step-size, as well as some price bar or indicator reference to use with limit prices of buy/sell orders.

I'll be testing across 80 different futures markets (most are outrights, some are spreads) and 30 US stocks. Price bar types (tick vs time) and intervals (1-min, 1-wk, 100-tick) will be set by-instrument in a config file of-sorts, as well as the allowed trading hours (Europe and US session only for most futures, US ETH for stocks). I figure setting this part up will be fairly simple.
Date Time Of Last Edit: 2019-02-06 00:40:54
[2019-02-06 18:20:48]
Chad - Posts: 231
As far as automating the running of backtests, would it be possible by setting a timer routine within the study/studies, or calling an external DLL from a study that has some sort of linkage to a Windows Task Scheduler entry? Sorry for the hasty idea, just thinking out loud.
[2019-02-07 04:33:54]
Sierra Chart Engineering - Posts: 104368

- run multiple instances of SC?
- work mostly/totally at ACSIL level (if possible)?
- only use bar-based backtesting?
Yes in general all of this would make sense. You certainly would want to work with ACSIL for your automated trading system. Multiple instances would be needed to run more than one back test at a time. And certainly using bar-based back testing for performance.

The back tests really have to be started manually.
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2019-02-07 17:04:34]
Chad - Posts: 231
Okay, thanks. Is there any notion among SCE staff to add a feature for automating the initiation of backtest cycles, in an upcoming release?

Is there any kind of work-around I might try, such as a timer function within an ACSIL script to execute a backtest routine every n hours? As for iterating the study parameters, what if I create a dummy variable then a conditional like:

if dummy variable = 1
{
variable 1 = x
variable 2 = b
[etc...]
}

else if dummy variable = 2
{
variable 1 = c
variable 2 = s
[etc...]
}
else if ....


Possible?

Sorry for asking you to repeat yourself, but this area is crucial to my attempts to go full-auto without working at the lower level of C++ or other language.
Date Time Of Last Edit: 2019-02-07 18:49:07

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account