Topics
18 Sep 2024, 13:32
 1
 150
 0
13 Sep 2024, 10:40
 0
 181
 1
22 Aug 2024, 18:49
 216
 3
28 Nov 2022, 22:28
 0
 976
 3
04 Nov 2021, 01:28
 1
 1073
 1
09 Mar 2020, 17:26
 1
 989
 1
09 Mar 2020, 17:17
 5
 1102
 1
24 Jul 2018, 15:20
 1685
 3
Replies

scotpip
10 Jan 2023, 23:10 ( Updated at: 10 Jan 2023, 23:15 )

RE: RE: RE:

Hi

It's still in development, but nearly done.

For a developer, generating price bars from the runtime tickstream is trivial. 

If you want to speed things up by serialising completed bars and using them in your backtests you're in for a bigger project, because you'll have to simulate the cTrader exchange. cTrader itself will only know about the bar you specified in the bot instance, and will know nothing of your own bars.

The charting was fairly easy too. I strongly recommend the AnyChart javascript library, which is free for personal use. It is powerful performant and well documented - much the best of the bunch that I evaluated.

There is a feature to backtest against bars in CSV files, but here too they seem to have hard-coded for time-based aggregations.

Indicators are more of an issue. In my use-case accessing the cTrader indicators was more trouble than it's worth - especially as an API class I'd want to extend is sealed. I only use a couple of simple indicators so have built my own system. There are examples of indicator logic in C# and other languages all over github and on TradingView as well as here in the cTrader community if you need anything more exotic.

For me the main development effort has been elsewhere - for serious trading I'm having build a lot of functionality that's not available out of the box. The price-based bars have been a relatively minor part of the project. 


@scotpip

scotpip
30 Nov 2022, 22:12

RE:

Update - seems this was an issue at my end.

When I click on Edit With Visual Studio on a .Net Framework 4.x file, it now opens VS and displays a message that the file is incompatible with the version of VS, which is what I'd have expected.

Haven't changed anything, so this is just one of these mysterious MS issues...

 


@scotpip

scotpip
29 Nov 2022, 18:15

RE:

I have the same requirement.

I've given up on waiting for Spotware to implement this - it's many years overdue now. It will hopefully appear now they have completed their .Net upgrade, but I can't wait any longer.

So I think that the only solution is to backtest with ticks and create your own range bars. It's a simple bar so this is relatively trivial,

Tick resolution backtesting is slow, but has the advantage of accuracy.

Then you have the problem of visualising your bars, indicators and trades. I'm researching this right now.

I don't think you can create a new chart directly in the CTrader API like to can with MT4 or JForex - though I'm going to post a question to double-check this.

So the main options are to export to a JS or Python charting library. This will be tedious but not particularly difficult. The main issue is deciding which library to use.

For example Highstock has a C# wrapper, though it's pretty limited from what I can see.

For Python you might want to check out Mplfinance: https://medium.com/codex/creating-advanced-financial-charts-with-python-in-one-line-of-code-79f87ed482e8

Python may be the easiest way to go, because there are wrappers that enable you to call Python code directly.

Once I've got something up and running, I'll try to share it with the community.


@scotpip

scotpip
23 May 2022, 17:36

Now that the big upgrade to .Net Core is pretty much done, it would be great to see some progress here and a public commitment to a release date.

Hopefully you will also add the ability to backtest Range and Tick while you're at it? 

The addition of more Renko options would also be welcome - with Median Renko at the least as offered in JForex. Even better would be a configurable Renko, as offered by Sierra, TradingView and a number of MT plugins.


@scotpip

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

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

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

scotpip
04 Nov 2021, 01:34

Hi

Thanks for responding! I was hoping I'd missed something but it seems not...

I've posted a feature request as you suggested.

Yes, it's possible to make the bars from ticks. I actually have the code which I use to generate backtest data.

But it consumes a lot of CPU cycles and there's a risk of lag in newsy markets. My own system will be trading a wide range of symbols on a wide range of bar sizes to this is a concern.

An API bar feed would offer accurate bars in the most efficient way.

 


@scotpip

scotpip
17 Mar 2020, 18:51

PanagiotisCharalampous said:

Thanks, I managed to reproduce it. We will check

Any progress on this? Can't really commit to the platform while there's a bug that will limit my ability to backtest...


@scotpip

scotpip
10 Mar 2020, 16:41

RE:

Nope - crashed again at a similar but different date and time on EURUSD t1.

10/03/2020 14:39:28.082 | cBot crashed: Error #62081310
 


@scotpip

scotpip
10 Mar 2020, 16:05

Thanks for the quick response.

Clearing the cache made no difference I'm afraid. Crashing after around 20 months, as before on 3 runs. I'm running the test on an empty bot for GBPUSD t1.

10/03/2020 13:16:41.356 | cBot crashed: Error #62081310

But I've noticed on each case the crash was at 10/10/2016 00:00:00. Maybe a data glitch? I'll try a different pair and report back - but the ticks are VERY slow to download from ICM, so may take some time.

It's not an OS-level resource issue. I have 90% of CPU and 60% of memory unused.

 

 


@scotpip

scotpip
09 Mar 2020, 18:59

I was planning to do something like this myself so it's good to see a starting point. I'd be looking to add other Renko bar types and perhaps some JS charting.

If a community member can get this working, it does make you wonder why the promised native feature from the cTrader team has been delayed for so long...

I'm new to cTrader, so before I invest time with this, do people find it runs over a decent period of data? I've hit a crashing bug simply trying to backtest tick data against an empty algo, which has rather shaken my faith in the platform...

 


@scotpip

scotpip
24 Jul 2018, 16:56

RE:

Thanks for the quick reply.

The corporate website is misleading - it lists Renko and a number of other charting features are available - it would be more honest if they said they are forthcoming. Not helpful - cost me a fair bit of time.

https://www.spotware.com/ctrader/trading/ctrader-charting

Welcome news that it's on the way, though.

 

 


@scotpip