How to develop your own backtester in C/C++ or C# ? - IB Trader Workstation | futures io social day trading
futures io futures trading


How to develop your own backtester in C/C++ or C# ?
Updated: Views / Replies:171 / 5
Created: by pstrusi Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

How to develop your own backtester in C/C++ or C# ?

  #1 (permalink)
Trading Apprentice
Lalin Pontevedra Spain
 
Futures Experience: Advanced
Platform: Ninjatrader IB
Broker/Data: Interactive Brokers
Favorite Futures: FOREX, ES, NQ, CL, GC
 
Posts: 10 since Sep 2013
Thanks: 9 given, 5 received

How to develop your own backtester in C/C++ or C# ?

I use IB-API but still using NT7 as a trusted platform. Despite I'm satisfied with it, I'm interested to develop my own backtester in C or C#, along with other functional modules. Since I'm just an economist/trader, not a CS guy, I'm learning yet superior programming abilities. So, I'd like to speed my process up and was wondering if there are some : courses, tutorials specialized in these kind of development to learn from.

Thanks in advance for any idea or suggestion

Reply With Quote
 
  #2 (permalink)
Elite Member
Sydney, NSW, Australia
 
Futures Experience: Intermediate
Platform: Sierra Chart, Python, C#
Broker/Data: Interactive Brokers
Favorite Futures: MJNK, ASX, SPI
 
amoeba's Avatar
 
Posts: 132 since Jan 2014
Thanks: 72 given, 148 received

If you go down the c# path there are a couple of open source libraries available, one is used (or developed) by QuantConnect, which is also a c# online backtest engine;

https://www.quantconnect.com

or GitHub source at https://github.com/QuantConnect/Lean

Reply With Quote
The following 2 users say Thank You to amoeba for this post:
 
  #3 (permalink)
Elite Member
Africa
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 7 since Sep 2017
Thanks: 6 given, 5 received



pstrusi View Post
I use IB-API but still using NT7 as a trusted platform. Despite I'm satisfied with it, I'm interested to develop my own backtester in C or C#, along with other functional modules. Since I'm just an economist/trader, not a CS guy, I'm learning yet superior programming abilities. So, I'd like to speed my process up and was wondering if there are some : courses, tutorials specialized in these kind of development to learn from.

Thanks in advance for any idea or suggestion

Hi. Ive got quite a bit of experience doing this having done it myself.
All I can say its that it gets very cool having a backtester that does what you need to do,
and if you find anything interesting on the internet you can just add the functionality yourself.
Saying that though, the coding really took me more than a year and a half (part time).
Its also very mathematical, so you constantly have to test the values and make sure every calculation is right.

(TL;DR) Just saying it will take quite a long time and you need to be quite familiar with coding concepts
like object orientation, sorting algorithms, etc


Good luck.

Reply With Quote
The following 2 users say Thank You to bchip for this post:
 
  #4 (permalink)
Trading Apprentice
Lalin Pontevedra Spain
 
Futures Experience: Advanced
Platform: Ninjatrader IB
Broker/Data: Interactive Brokers
Favorite Futures: FOREX, ES, NQ, CL, GC
 
Posts: 10 since Sep 2013
Thanks: 9 given, 5 received


bchip View Post
Hi. Ive got quite a bit of experience doing this having done it myself.
All I can say its that it gets very cool having a backtester that does what you need to do,
and if you find anything interesting on the internet you can just add the functionality yourself.
Saying that though, the coding really took me more than a year and a half (part time).
Its also very mathematical, so you constantly have to test the values and make sure every calculation is right.

(TL;DR) Just saying it will take quite a long time and you need to be quite familiar with coding concepts
like object orientation, sorting algorithms, etc


Good luck.

By any chance would you remind some reference in the net to check it?
Thanks!!

Reply With Quote
 
  #5 (permalink)
Elite Member
Africa
 
Futures Experience: Advanced
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 7 since Sep 2017
Thanks: 6 given, 5 received


pstrusi View Post
By any chance would you remind some reference in the net to check it?
Thanks!!

Hi

Not sure which part you need references on.
One of the other traders on this forum posted this link:
https://github.com/rediar/InteractiveBrokers-Algo-System

Which is their Java project connecting to IB.

Other than that indicators have many websites that help on calculations,
I found this book also to be quite useful:
https://www.amazon.com/Technical-Analysis-2nd-Steven-Achelis/dp/0071826297

Reply With Quote
The following user says Thank You to bchip for this post:
 
  #6 (permalink)
Elite Member
charlotte nc
 
Futures Experience: Master
Platform: ninjatrader
Broker/Data: NinjaTrader
Favorite Futures: Emini (ES, YM, NQ, ect.)
 
Posts: 319 since Jan 2015
Thanks: 58 given, 677 received

Not sure if it will be much help but....

I have build several backtesting tools in SQL. I also develop in C#. The key concepts are largely the same in terms of what you are trying to solve for.

You can hack together a basic HLOC testing system really easily, but if you want to get into the nuances of "would you have realistically gotten filled or not" there are more things to consider.

1. Market Orders: Despite the common misconception that these fill instantly, there is a queue for market orders as well. So you would need to consider this into your logic to have accurate slippage..

2. Execution time relative to realistic latency: This is a huge design consideration if you want to make your system have value. If you mess this part up, the whole project may be worthless. The thing you need to do is built a latency trigger into your system so once you get your alpha signal that tells you to "get in, get out, or cancel", you need to then have a wait period of X before you mark your position in the queue. X = your latency. If you don't know this yet, I can show you how to test this.

3. Limit Orders: This is a big one... Depending on how well you handle this part, your system may be good or completely worthless. When I say completely worthless here is an example. Check the box in NinjaTrader 7 to fill limit orders on touch and then run a simple strategy with random entries (flip a coin on direction / when to get in) and set a profit target and stop loss at 3 ticks. Then watch your account run up millions of fake dollars.... Unless you want your custom testing platform to make the same mistake you will have to do better here.


You will be solving for both level 2 and level 1 data feeds and using volume to define if and when orders get filled. So conceptually you will need to be able to compute lots of running totals in different columns. In SQL, I just have a 5 - 10 different columns calculating different things cumulatively, or one column / another column and if that > 100% then do this.... or that.... etc.

If you are going at this in C# or just application code without a database, your best shot is to use a list. in C# you can use a list object from the Linq class I believe. Here you would just insert specific variables into your list, run your calculations and after you determine the outcome of a trade, clear your list and then repeat.

Keep us posted on how it goes.

Best of luck!

Ian

In the analytical world there is no such thing as art, there is only the science you know and the science you don't know. Characterizing the science you don't know as "art" is a fools game.
Reply With Quote

Reply



futures io > > > > How to develop your own backtester in C/C++ or C# ?

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

September Journal Challenge (sponsored by TopstepTrader)

September

Free Elite Membership: Twitter Tuesday and Facebook Friday!

Tue & Fri
 

Trading with Python: Using Machine Learning w/Ran Aroussi [12:30PM ET]

Elite only

TopstepTrader (TBD)

Sep 25

RandBots (TBD)

Sep 27

Anthony Drager (TBD)

Oct 4
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Very bad Annual Return from Backtester Jacare AmiBroker 3 November 26th, 2014 12:03 PM
Multicharts Portfolio Backtester toddma MultiCharts 1 June 28th, 2014 08:18 AM
MC Portfolio Backtester - DD no erocla MultiCharts 1 May 28th, 2014 05:15 AM
Multicharts portfolio backtester Sector lists sweed73 MultiCharts 2 October 14th, 2013 02:57 AM
Portfolio backtester - instructions for all symbols moses MultiCharts 0 March 23rd, 2013 02:38 AM


All times are GMT -4. The time now is 12:40 AM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2018-09-20 in 0.09 seconds with 25 queries on phoenix