C# Math Library - Matlab, R project and Python | futures io social day trading
futures io futures trading

C# Math Library
Updated: Views / Replies:16,386 / 15
Created: by MXASJ Attachments:1

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 90,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

Thread Tools Search this Thread

C# Math Library

  #1 (permalink)
Elite Member
Futures Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 798 since Jun 2009
Thanks: 109 given, 786 received

C# Math Library

Not quite R or Matlab but...

Does anyone use any of the free or commercially available C# math libraries? On the free front DotNumerics came up in searches after hearing repeated references to LAPACK from some C++ guys.

Reply With Quote
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

  #3 (permalink)
Elite Member
Neubrandenburg, Germany
Futures Experience: Advanced
Platform: R
Favorite Futures: Stocks
wh's Avatar
Posts: 538 since Jun 2009
Thanks: 297 given, 482 received

look for dnanalytics ... you can also google:

2009.8 Features
* Linear algebra classes with support for sparse matrices and vectors (with a F# friendly interface).
* Dense and sparse solvers.
* Probability distributions.
* Random number generation (including Mersenne Twister MT19937).
* QR, LU, SVD, and Cholesky decomposition classes.
* Matrix IO classes that read and write matrices form/to Matlab, Matrix Market, and delimited files.
* Complex and “special” math routines.
* Markov Chain Monte Carlo (MCMC) sampler classes.
* Bayesian estimators.
* Descriptive Statistics, Histogram, and Pearson Correlation Coefficient.
* Overload mathematical operators to simplify complex expressions.
* Visual Studio visual debuggers for matrices and vectors
* Runs under Microsoft® Windows and platforms that support Mono.
* Optional support for Intel®Math Kernel Library (Microsoft® Windows and Linux)

NET Framework Languages C#, F# and VB.NET

  • dnAnalytics is an open-source numerical library for .NET written in C# and F#.
  • DotNumerics is a Numerical Library for .NET written in C#. It provides routines for: Linear Algebra (CSLapack, CSBlas, CSEispack), Differential Equations and Optimization.
  • ILNumerics.Net typesafe numerical array classes and functions for general math and linear algebra, aims .NET/mono, script-like syntax in C#, 2D & 3D plot controls
  • Math.NET is a mathematical open source (MIT/X11, LGPL & GPL) library written in C#/.Net, aiming to provide a self contained clean framework for symbolic algebraic and numerical / scientific computations.
  • Meta.Numerics is a library for advanced scientific computations using the .NET Framework. The Meta.Numerics library is fully object-oriented and optimized for speed of implementation and execution.
  • NMath by CenterSpace Software are numerical component libraries for the .NET platform. The libraries include high performance signal processing (FFT) classes, an extensive linear algebra (LAPACK & BLAS) framework, and a statistics package including descriptive statistics, distributions, ANOVA, and multivariate analysis (NMF, k-means, PCA). Most classes scale with the number of processor cores.[1]
  • SCINET is an object-based high performance Scientific Software Framework for the Microsoft .NET platform. It is purely written in C# programming language and fully compliant with the Microsoft's CLI specification.
  • TA-Lib is widely used by trading software developers requiring to perform technical analysis of financial market data.[2]

Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
The following 4 users say Thank You to wh for this post:
  #4 (permalink)
Elite Member
Neubrandenburg, Germany
Futures Experience: Advanced
Platform: R
Favorite Futures: Stocks
wh's Avatar
Posts: 538 since Jun 2009
Thanks: 297 given, 482 received

i know nothing, but like as henry ford

you need to know anything, just know where it stands

Causality is the relationship between an event (the cause) and a second event (the effect), where the second event is a consequence of the first.
Reply With Quote
  #5 (permalink)
Elite Member
Futures Experience: Beginner
Platform: MultiCharts
Posts: 232 since Nov 2010
Thanks: 10 given, 20 received

I use also open project of neural networks, they work well

Reply With Quote
  #6 (permalink)
Trading for Fun
Here, GA
Futures Experience: Intermediate
Platform: Ninja
Posts: 146 since Jun 2009
Thanks: 1 given, 74 received

Thanks wh. Good stuff I never knew existed. Just something else to learn.

Reply With Quote
  #7 (permalink)
Just starting out...
sacramento, ca
Futures Experience: Beginner
Platform: TWS
Favorite Futures: equity
Posts: 2 since Mar 2011
Thanks: 0 given, 0 received

Try using GSL in C#

If you are interested in robust implementation, I would suggest using GSL - it is one of the best open source numeric library that I know of in terms of functions and stability.
PS : it is pretty easy to use GSL dlls in C# with Pinvoke, ample tutorials in the internet

Reply With Quote
  #8 (permalink)
Elite Member
Seattle, WA
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: Interactive Brokers/IQFeed
Favorite Futures: Stocks
Posts: 27 since Nov 2009
Thanks: 10 given, 66 received

I've had very good results recently using ALGLIB (ALGLIB). I took their C# files, and merged them into a single file in its own namespace in a dummy NinjaTrader indicator file (in its own namespace so it can be called from strategies also). Easy to do (I didn't modify any alglib code) but I can post my file if anyone is interested, it's licensed under GPL.

The reason I started using it was to speed up things I had been doing in Matlab. I've gone through a lot of work to get NinjaTrader to call compiled Matlab functions, so that I could use Matlab functionality under the NinjaTrader backtesting/datafeed/execution framework. I wanted to avoid porting Matlab code to C#. It worked, but the process was painful on 2 fronts. First problem was getting a particular Matlab routine to work; every routine seems to have different calling conventions, and correctly building the data structures that the Matlab routines want is a painful process.

Even after they work, they are kind of slow for several reasons. Plenty fast for indicators, but I wanted faster for strategy development. I don't know what "compiled matlab" compiles into (I think it's some kind of intermediate code with a C++ wrapper around it and some dotnet interface dlls) but it's not as fast as native code. The Matlab language encourages inefficient programming practices, which is understandable, because their goal is efficient development of algorithms more than efficient execution. And another problem was that I could never make it run multi-threaded (I didn't try really hard but it appears that the Matlab engine isn't thread-safe), so I couldn't use the NT7 optimizer with multiple threads.

So even though it worked, I wasn't terribly satisfied, and I started thinking: I've gone to a heck of a lot of work to avoid porting Matlab code to C#, maybe it would be better to just bite the bullet and port some Matlab code to C# and see how that goes. So I did that this week. I used Alglib mainly for its least squares fit and matrix inverse and multiply routines, but it includes a lot more. I had to write a lot of simple "helper" routines to mimic some matlab functionality (matrix transpose, concatenate, etc). I already had the Matlab routines callable from C#, so it was easy to verify that my transcoded routines worked the same.

I'm quite happy with the results so far. I haven't done a lot of benchmarking but one of my backtests runs almost 3x faster, and there's a lot more going on the just the numerics, so the speedup of the numeric routines must be a lot more than that. That gain is multiplied because I can now run multiple threads in the optimizer, which I couldn't do at all before. So running strategies that use numerics under the NT7 optimizer is now practical for me, where it wasn't before, and that's a big win for me.

I didn't look at the DotNumerics package before I started. DotNumerics includes a lot of the helper routines that I had to write. But you have to work under their class structure. Alglib works with standard C# arrays (although the calling conventions are strange and have a learning curve, you have to pass the array sizes as parameters). Also, Alglib is an active project, whereas DotNumerics hadn't had an update since 2009.


Reply With Quote
The following 6 users say Thank You to kevind for this post:
  #9 (permalink)
Elite Member
Futures Experience: Intermediate
Platform: Ninja Trader Tradestation
Broker/Data: Zenfire
Favorite Futures: EMINI
Posts: 34 since Feb 2010
Thanks: 0 given, 3 received

Can you post your Algib file, I would be keen to learn how you did it.

Reply With Quote
  #10 (permalink)
Elite Member
Leesburg, VA
Futures Experience: Advanced
Platform: NinjaTrader
Posts: 79 since Aug 2010
Thanks: 74 given, 31 received

I too would be interested to learn the approach. Please post so that we can all learn something new & you would benefit from the questions or suggestions.

Reply With Quote


futures io > > > > C# Math Library

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Wyckoff Hunting for Great Risk/Reward Ratio w/Gary Fullett

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

Similar Threads
Thread Thread Starter Forum Replies Last Post
Murrey Math Big Mike Traders Hideout 227 December 12th, 2017 06:05 PM
C# Charting Class/Library Dusty909 Platforms and Indicators 7 December 1st, 2011 06:08 PM
Technical Analysis Library with 200 indicators sigjanu Platforms and Indicators 1 March 17th, 2011 11:53 AM
C# Math.net and compiling tinkerz NinjaTrader Programming 1 April 6th, 2010 05:33 PM
School tosses out all books in library, goes high tech Big Mike Off-Topic 4 September 5th, 2009 10:24 PM

All times are GMT -4. The time now is 06:54 PM.

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-05-21 in 0.13 seconds with 20 queries on phoenix via your IP