Backtesting solutions

Jun 01, 2013 at 20:30
3,184 Views
6 Replies
Member Since Mar 28, 2011   86 posts
Jun 01, 2013 at 20:30
I've been searching for good backtesting system a long time.
About a year ago I moved to C# and used 'MT4 API' for trade operations and to calculate indicator values.
MT4 API bridge itself does not introduce much overhead to MQL4 function calls but MT4 history tester is really slow and not very reliable either.
I soon got tired of slow test and unreliable data and wasn't very interested in to get into 99% backtesting accuracy with MT4 because I thought there must be better alternatives.

Then I found Forex Tester 2 (FT2) and they have option to write indicators in Delphi.
As FT2 indicators are plain Windows 32-bit stdcall DLLs it is 'very easy' to program a bridge DLL for example in C and make it accessible from C# or Java.
I don't know what accuracy FT2 has but its testing speed is about 10-100x faster compared to MT4 history tester (speed depends on how much open trades you have).

So now I have a system where programming and strategy development is done using Visual Studio (there is free express edition available) using C#.
Live trade execution is done via MT4 API bridge to any MT4 broker and backtesting is mainly done using Forex Tester 2. Of course MT4 history tester is available as well.

Strategies could be written in Visual Basic as well, or any .NET language.
My FT2 bridge uses very simple binary socket stream protocol that could be easily ported to Java.

Lately I found out about Asirikuy project that has been using MT4 for years but now have developed their own F4 platform for strategy development and history testing.
It is written in ANSI C so it is truly platform independent solution.
Trade execution is externalized and they have at least MT4 supported as broker interface.
I have plans to find out more about that, the Asirikuy project itself is commercial so you have pay relatively small fee to access their site.

cTrader/cAlgo platform seems promising but I learned that their history testing is currently quite limited.
At least concerning about availability and choice of tick/bar data.

It would be 'quite easy' to provide external backtesting environment for cTrader/cAlgo platform.
But one can't ride on two horses at the same time and deciding which platform's object model and API to use is most difficult decision.

I've been using my own abstract trading C# API that encapsulates core trading functionality and indicator access from MT4 and FT2 in uniform way.
That was quite straight forward to do because (luckily) FT2 model trading almost indentically with MT4. FT2 indicator access was modelled differently but easy to hide differences.

I have high hopes about Asirikuy project history testing capabilities but only time will tell if their approach and implementation satisfies my requirements for history testing.
And cTrader/cAlgo platform seems to be good candidate to add for trade execution (broker) support side.
I haven't published my source code as open source because this is my own private project and all related (required) software is commercial so potential audience is quite narrow.

There has been recently a lot of discussion about MetaQuotes attitude and actions towards brokers and their paying customers.
Most forex hobbyist like me prefer free tools if possible.
cTrader/cAlgo platform seems to be a good alternative to MT4/MQL4 and increases competition which is good.
Lets hope that Spotware will react and provide open/extensible history testing system for those who want to test using their own data.

BTW, there is dozens of good commercial trading platforms with all possible history testing options one can dream about.
But there is few problems for me using any them.
They are proprietary solutions mostly targeted to selected US brokers.
No MT4 support directly, some platforms provide extension points to hook with any broker.
No proper forex support, they model trading (programming) using stock trading concepts and terminology that is difficult for simple forex trader.

Because I didn't find any acceptable platform I decided to build my own and integrate those parts that I need on the way.
Just my random thoughts 😀
Being Bearish or Bullish Makes No Difference
Member Since Dec 10, 2009   25 posts
Jun 04, 2013 at 01:15
Hi Petays,

Disclaimer: I am the owner of Asirikuy, in charge of developing the F4 framework.

I just happened to come across this post by chance :) Let me say a few things about the characteristics of the F4 framework:

* Developed in ANSI C and Open source (the code is fully available to you so you can modify it in anyway you want). You can always code any functionality you might need.
* Front-ends developed for MT4/MT5 (Available now). Oanda REST API (the free version they will release next year) and JForex front-ends in developments (not released yet)
* Trades natively in MT4/MT5 through an EA that calls a simple DLL.
* Tons of third party open source libraries implemented. Want to develop an automated system with machine learning (neural networks, Support vector machines, etc)? Walk forward analysis? Game theory money management? Need Genetic optimization libraries? Everything is easy to access within F4. We currently have many popular libraries added, such as Boost, GAUL, Shark, FANN, etc.
* ANSI C tester with a Python front-end to back-test trading strategies outside of MT4. Genetic optimization, multi-core support (open MP) and parallel computing support (MPICH2). You can run optimizations across large computer clusters (I haven't come across other software with this functionality). I regularly run optimizations across 20 computer cores now.
* Time corrections implemented so that you can reduce broker dependency and increase coherence between broker feeds. Is your broker GMT +1/+2/-5/etc ? The F4 framework will correct them to match your chosen reference back-testing feed (in back and live trading).

There are certainly many more things I could say but of course feel free to ask me any questions if you want to. I hope the above helps you with any doubts you might have had,

Best Regards,

Daniel
Member Since Aug 21, 2012   47 posts
Jun 05, 2013 at 05:12
I've been on this journey off and on over the last few years too. I started off developing EAs and realized how crappy the support network is for running an EA, i.e. backtesting, data quality, dealing with disconnections, etc. When MT5 came out, I built a distributed backtester network for it but then decided that MT5 wasn't the way to go after all. I moved on to other things in life for a year or two, and am now back in the forex world figuring out how to make something out of it.

Daniel, I've been going over some of your stuff over the last few days. $292 is enough to pay that I don't want it going to yet another person trying to scam subscription money from traders. I'm not saying this is you, but I don't want to be the guy paying $$$ for 'how to trade' and never actually making money trading. I wasn't planning on putting this here in this forum, but since I'm typing anyway here it goes. I understand you want to keep the project for serious people, but also I don't want to start paying for a yearly subscription until I'm ready to use it, as once I've paid, the clock is ticking. From this point of view, a 30 day free membership or 1 month paid trial before the 1 year membership or something like that would be useful.

I'm sure I could brush up on my C (I'm in Java these days) and learn Python, and get active in Asirikuy. I would hope the time it would take me to do that would be more than made up for by the project being far ahead of where I'd be if I started building the same thing from scratch. This had been my plan until last week when I started reading about Asirikuy. Plus, there are other options on the horizon from big players, but there will always be something else 'coming soon'.
Member Since Mar 28, 2011   86 posts
Jun 06, 2013 at 18:48
@beren you should read this thread: https://www.donnaforex.com/forum/index.php?topic=3714.0
There is few interesting tidbits and lot of boring stuff about Asirikuy that takes ages to scan through.
And believe me, @danielfppps has had hard times to get subscription price balanced and all subscribers happy for what they get.
Because most will be disappointed because they are waiting to get hands on holy grail kept by Asirikuy people. Which doesn't exist!

I'm most interested in the technology they have developed to see if it is useful to me and maybe even contribute something back.
If the technology is usable I will bridge it to C# or even port some parts to managed C# code if license allows that.

Asirikuy view of long term profitable trading is not aligned with my beliefs about algorithmic trading. But their tools can be used for 'good' or 'evil'. I don't believe in 10 year backtesting if markets are changing all the time and robots are not able to adapt to ever changing markets. fmonera's article in his blog (https://www.profitableautotrading.com/) opened my eyes, at least his evaluation criteria is too strict and narrow for my taste. Creating a robot with 2 indicators max and being profitable over 10 years period is impossible IMHO! In FOREX.
In commodities I believe there is robots that are profitable for 30 years and 'best' even 200 years period (for those commodities that has stats for so long time). I don't know what algorithms or indicators they use but they trade few trades a year! Just a few trades, typically less than once a month. OK, no more rants about that. And that's my personal view without any real evidence, just my subjectively opinion.

Back to the backtesting issues.
Writing a backtester is not very big task is you know all the required formulas.
I almost did one when I wrote Zulu simulation results analyzer. But without the formulas of course!

So my plans for the summer are to get acquainted with Asirikuy F4 platform and evaluate cAlgo.
And then make some decisions how to proceed with my own C# 'trading platform' and backtesting solution for it.

@beren: I've been using Java from 1999 (I'm a programmer) and C# for 2 years.
Switching from Java to C# goes almost without efforts (using google) because they are so alike.

(the longer the post, the less the replies - this must be so boooring :)
Being Bearish or Bullish Makes No Difference
Member Since Aug 21, 2012   47 posts
Jun 07, 2013 at 07:36
Thanks for the link. I read all that at DonnaForex yesterday, as it turns out. There are lots of opinions out there.

So, what ARE your views of long-term profitable algorithmic trading?

I've done a bit of C#, and some C back in the day. Of course MQL4 is suspiciously like a subset of C. Lately though it's been all JEE.

@danielfppps I re-read what I posted on here earlier. I want to clarify that I didn't mean anything I said as harsh or as a personal attack in any way. I just meant that there are a lot of scammers out there who will happily take a trader's money, so it pays to research a vendor of any sort very seriously, the moment they start asking for money for something.
Member Since Dec 10, 2009   25 posts
Jun 09, 2013 at 19:22
Hi Guys,

@beren: No problem :) I understand where you're coming from. There is no trial because it's very hard to give a 'trial' for something that you get open access to. If I had a free trial for 1 month then people could just 'get in' take the F4 source and then simply avoid joining the community. You should consider that all our trading framework solutions are completely open source (meaning that you have access to all the code), so it is impossible to give a free trial (as if you get it, you have it forever). This allows you to do whatever you want with the program. The price is what I would consider fair for all the effort and time that has gone into developing the F4 framework which is a very powerful tool for retail Forex trading.

That said, there are many other tools at Asirikuy, such as our statistical analysis tools (profit & drawdown analyser, Monte Carlo simulator, Database software, etc) and our system generation software (Kantu). For an experienced trader Asirikuy can be used as a 'tool box' where a lot of coding solutions have been developed to address common trading problems in retail forex trading. Certainly you can just join for the first year if you just want access to the F4 framework, once you have it you'll have it forever. The yearly subscription model ensures that all solutions can be continuously supported and updated, something that would be very difficult on a 'one time fee' model.

In any case, feel free to ask any questions you might have about our framework and I'll be glad to answer :)

Best Regards,

DAniel

Member Since Mar 28, 2011   86 posts
Jun 09, 2013 at 21:56
Thank you @danielfppps for the clarifications about F4 platform.
I'll definitely have to check it out if I ever have time to do that.
The subscription price is not issue for me and I'm looking forward to browse the code and see how easy it would be to integrate my C# trading systems for it.
And I believe that there is lot to learn about building robots 'your way'. I like your scientific and statistical attitude to trading and risk management. Analysis and theory is my weakest parts even though I'm proficient in programming it doesn't help much when I don't 'know' what to do in the first place.
I've been 'thought' to write robots the 'wrong' way and they have never been in the production (for long) because of the risk and you could never be sure if they blow your account some day even drawdown in backtesting was quite 'reasonable'.

Maybe Asirikuy think putting F4 into separate real open source project because this way it could gain some momentum from non Asirikuy traders/programmers as well and maybe become de-facto programming environment for many MQL4 coders.
Asirikuy 'philosophy' and tools doesn't be so tightly coupled and opening to F4 framework could give it nice boost in its popularity.
Of course this could be a burden because time is money and maintaining an open source project is not easy task (for fun) if you don't get paid for it.

And @beren , I'm constantly searching tools for long-term profitable algorithmic trading. I've build two robots, one in MQL4 and one in C#. The lesson learned is that currently my skill are not enough to make a robot that can do the job alone without considerable risk.
Initial specification for those robots was not mine and I've learned a lot during the process of writing and testing them.
After my last robot was put out of production I thought that semi-automated system where human takes ultimate responsibility and robot just does the mundane task of opening and closing trades would be next thing to try. Our last strategy was quite typical contra-trend and basket close with some twists that made is last a bit longer but not long enough to trust it because in the worst case it could blow your account totally.
I've got plenty of ideas but lack of time is so infuriating! Currently forex is more or less a hobby but I'm trying to allocate more time to it in a hope that someday I can get some income from it. This always seems to be so near but you can't quite reach it :)
Being Bearish or Bullish Makes No Difference
Sign In / Sign Up to comment
You must be connected to Myfxbook in order to leave a comment
*Commercial use and spam will not be tolerated, and may result in account termination.
Tip: Posting an image/youtube url will automatically embed it in your post!
Tip: Type the @ sign to auto complete a username participating in this discussion.