How does the backtester handle orders that are triggered within bars?
How does the backtester handle orders that are triggered within bars?
01 Jan 2022, 22:21
Hi folks
Evaluating CAlgo for a new project and would appreciate some feedback on how the backtester works before I invest the time into learning it.
My question is about how the backtester handles orders that are triggered inside a bar.
Say that I'm backtesting 1 minute bars and the last close was at 1.00
I have a pending market order for a long entry sitting at 1.02
The next bar closes at 1.04, triggering the order.
Is the backtester smart enough to figure out that the trade was opened at 1.02, or will it open the trade at the close price of 1.04?
Thanks!
Replies
scotpip
03 Jan 2022, 12:40
RE:
amusleh said:
Hi,
If you use bars data then the back tester will only have access to each bar OHLC prices, and it will iterate over them one by one.
If you have a pending order at 1.02 and the next bar close/high price was above it then the order will be considered triggered at 1.02 not at the bar close/high price.
To get more accurate results you can use tick data for back testing instead of bars data.
Thanks - that's what I was hoping. It's surprising how many backtesters can't do this and only recognise pending orders at the price on bar close.
My preferred workflow is to do initial research with bars for speed, and verification at tick resolution for accuracy. But if you're ever tested a 20 pair algo with ticks you'll realise how glacially slow that can be!
So now I can put cTrader on the list, I have to decide whether to go with the nice CTrader API and live with the toy backtester, or go with the better backtester on MT5 and live with the horrible API and strange proprietary language...
Can I ask why you decided to go with CTrader?
@scotpip
amusleh
04 Jan 2022, 08:52
RE: RE:
scotpip said:
amusleh said:
Hi,
If you use bars data then the back tester will only have access to each bar OHLC prices, and it will iterate over them one by one.
If you have a pending order at 1.02 and the next bar close/high price was above it then the order will be considered triggered at 1.02 not at the bar close/high price.
To get more accurate results you can use tick data for back testing instead of bars data.
Thanks - that's what I was hoping. It's surprising how many backtesters can't do this and only recognise pending orders at the price on bar close.
My preferred workflow is to do initial research with bars for speed, and verification at tick resolution for accuracy. But if you're ever tested a 20 pair algo with ticks you'll realise how glacially slow that can be!
So now I can put cTrader on the list, I have to decide whether to go with the nice CTrader API and live with the toy backtester, or go with the better backtester on MT5 and live with the horrible API and strange proprietary language...
Can I ask why you decided to go with CTrader?
Hi,
Why do you think cTrader back tester is a toy back tester?
@amusleh
scotpip
04 Jan 2022, 17:10
( Updated at: 04 Jan 2022, 17:11 )
Backtesting features
Hi,
Why do you think cTrader back tester is a toy back tester?
Well - if I'm missing something please tell me, but on a first view:
- The reporting is minimal. Many important metrics missing. No analysis by month, day, hour, session-hour, for example - which is vital stuff.
- There is an optimiser, but it's very hard to review the results for robustness and there's no export, so I'd have to hack something.
- No Monte Carlo robustness testing.
- No walk-forward testing - which is extremely important for avoiding over-fitting
- Doesn't work with Renko and Range bars
- Pretty cludgy to test multiple pairs on the same strategy
- Looks virtually impossible to do real portfolio testing and optimisation
Etc.
Not anywhere approaching a professional backtesting tool, IMHO. Or am I wrong?
@scotpip
amusleh
05 Jan 2022, 08:14
RE: Backtesting features
scotpip said:
Hi,
Why do you think cTrader back tester is a toy back tester?
Well - if I'm missing something please tell me, but on a first view:
- The reporting is minimal. Many important metrics missing. No analysis by month, day, hour, session-hour, for example - which is vital stuff.
- There is an optimiser, but it's very hard to review the results for robustness and there's no export, so I'd have to hack something.
- No Monte Carlo robustness testing.
- No walk-forward testing - which is extremely important for avoiding over-fitting
- Doesn't work with Renko and Range bars
- Pretty cludgy to test multiple pairs on the same strategy
- Looks virtually impossible to do real portfolio testing and optimisation
Etc.
Not anywhere approaching a professional backtesting tool, IMHO. Or am I wrong?
Hi,
The Renko/Range back testing will be added in next upcoming versions.
You can calculate any metric programmatically by using the cBot history and generate a report based on your needs, then you can write it on a CSV or Excel file on your disk.
Regarding your other mentioned points, please open a thread under suggestions section of forum, if your suggested features got enough vote from community then we will consider adding them.
@amusleh
scotpip
06 Jan 2022, 02:14
( Updated at: 06 Jan 2022, 02:16 )
RE: RE: Backtesting features
amusleh said:,
The Renko/Range back testing will be added in next upcoming versions.
You can calculate any metric programmatically by using the cBot history and generate a report based on your needs, then you can write it on a CSV or Excel file on your disk.
Regarding your other mentioned points, please open a thread under suggestions section of forum, if your suggested features got enough vote from community then we will consider adding them.
Thanks.
I'll wait till the port to .Net Core is released - I know that's what's been tying up the development team. Then I'll push for you guys to add full-featured backtesting.
I think it's a genuine commercial opportunity for Spotware. You already have the best FX trading venue and the best API for automated execution. But the backtesting is lacking.
I know from painful experience that there is a HUGE gap in the market for a modern, professional-level end-to-end development environment for retail FX traders. MT5 has major weaknesses as you will know better than most, and the smaller players are little better and offer a very limited choice of brokers. If you need leverage, none of them integrate with offshore operations like IC Markets in the Seychelles. And no-one offers a good solution for Renko and Range. It's all very frustrating.
My current idea is to use AmiBroker for idea exploration and testing, then port the whole thing over to CTrader for execution. Hardly ideal, to put it mildly, but after some pretty active research it seems to be the least bad solution.
Fill the gap with full-featured backtesting and robustness testing and many of the most serious and committed retail traders would find the platform irresistible. You would beat MT5 on every point. And the sophisticated algo traders are often the most serious independents with he highest volumes, generating income for your brokers.
That's the question really. Do you want the casual traders playing around manually on their phones - generating high customer churn and low trading volume? Or do you want the serious systematic traders looking to build big accounts and develop long-term relationships with their brokers?
My proposal will never get many votes in a popularity contest, because few casual traders are prepared to put in the hard yards to develop pro-level algo skills. But it is a big deal for the traders that you really want to attract.
The foundation is there - but you need to fill the gaps first!
@scotpip
amusleh
03 Jan 2022, 09:11
Hi,
If you use bars data then the back tester will only have access to each bar OHLC prices, and it will iterate over them one by one.
If you have a pending order at 1.02 and the next bar close/high price was above it then the order will be considered triggered at 1.02 not at the bar close/high price.
To get more accurate results you can use tick data for back testing instead of bars data.
@amusleh