NexusFi: Find Your Edge


Home Menu

 





correlation matrix in C# for use in NT?


Discussion in NinjaTrader

Updated
    1. trending_up 3,459 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 2 attachments




 
Search this Thread
  #1 (permalink)
 drolles 
London, UK
 
Experience: Beginner
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39

All,

Could someone help?

Has anyone seen a simple implementation of a linear correlation matrix for C# to use in NT?

I’ve found this so far: Linear correlation and statistical functions - CodeProject

I thought the c# implementation of QuantLib might help, but I can’t seem to track it down (https://quantlib.org/docs.shtml)?

Cheers,

drolles


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Irans Answer Due Today: Peace Surges to 33.5%, Invasion …
Prediction Markets & Event Contracts
Victory Day Delivers: Russia-Ukraine Ceasefire Market Cl …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
Prediction Markets Expiry Day: Trump Eyes War Exit, $230 …
Prediction Markets & Event Contracts
MyForexFunds Begins Returning Frozen Funds After CFTC Ca …
Funded Trading Evaluation Firms
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 artemiso 
New York, NY
Vendor shill
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,687


drolles View Post
All,

Could someone help?

Has anyone seen a simple implementation of a linear correlation matrix for C# to use in NT?

I’ve found this so far: Linear correlation and statistical functions - CodeProject

I thought the c# implementation of QuantLib might help, but I can’t seem to track it down (https://quantlib.org/docs.shtml)?

Cheers,

drolles

The answer is already in the link that you found. Are you trying to take a 2D array as argument instead?


Reply With Quote
  #3 (permalink)
 drolles 
London, UK
 
Experience: Beginner
Platform: TradeLink, OpenQuant, considering anything that works...
Trading: if it trades...
Posts: 94 since Oct 2010
Thanks Given: 24
Thanks Received: 39


Hi,

I’ve managed to craft something using the link above.

It is a simple case of looking at the correlation of 2 instruments. But it is a starter. Code attached here.

It prints the correlations on the necessary timeframe.

I’ve also done an little bit of initial analysis on Gold (GC) vs. ES. Excel attached.

Cheers,

drolles


Attached Files
Elite Membership required to download: Correl.zip
Elite Membership required to download: ES and GC Analysis v1.zip
Started this thread Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

Just a note that I posted some R code for calculating and displaying correlation matrices here:



If you want to use via R from a bridge.

Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on November 26, 2013


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts