NexusFi: Find Your Edge


Home Menu

 





Coding NinjaTrader with F#


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one gomi with 2 posts (6 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 MrYou with 1 posts (0 thanks)
    4. looks_4 Fat Tails with 1 posts (0 thanks)
    1. trending_up 3,553 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
AstralTrader's Avatar
 AstralTrader 
Charlotte, NC
 
Experience: Beginner
Platform: NinjaTrader
Trading: ES
Posts: 7 since Aug 2012
Thanks Given: 2
Thanks Received: 0

I'm trying to get into NinjaTrader programming and I see it uses C# which is programmed in MS Visual Studio. I find F# to be more friendly to my programming background, so I was wondering if I could use a combination of C# and F# (or just F#) since Visual Studio supports both.


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
Day 97: Israel-Lebanon Ceasefire Struck Overnight -- WTI …
Traders Hideout
CME Cuts Precious Metals Margins Up to 21% Starting Toda …
Commodities
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
Day 96 Missiles Hit Kuwait and Bahrain: June 15 Peace at …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #3 (permalink)
 
MrYou's Avatar
 MrYou 
NC, USA
 
Experience: None
Platform: None Yet
Trading: Guitar
Posts: 402 since Jun 2011
Thanks Given: 618
Thanks Received: 196


Hi Neighbor!

I think it is possible though I have not jumped into it yet. But keep in mind NinjaScript (C#) does not require MS Visual Studio. It has its own builtin IDE.

Someone correct me if I'm wrong, but until NinjaTrader supports F# directly you may have to do something like this...

Build a .Net library in F# that is called from inside your strategy which is written in C#. Meaning, within your OnBarUpdate you might use a switch(Position.MarketPosition) block and for each Position case you would make a call to your F# code. Or if you wanted your entire code in F# you could just have your OnBarUpdate block call that.

Any thoughts?


Reply With Quote
  #4 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


ShrewdBiz View Post
I'm trying to get into NinjaTrader programming and I see it uses C# which is programmed in MS Visual Studio. I find F# to be more friendly to my programming background, so I was wondering if I could use a combination of C# and F# (or just F#) since Visual Studio supports both.


Let us assume that you are American and that you go for a holiday in France. You will definitely find the English language to be more friendly to your cultural background, and you will wonder whether you can use a combination of English and French to communicate to French citizens.

I am afraid that you will be ignored.


Reply With Quote
  #5 (permalink)
 gomi 
Paris
Legendary Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,507

You can build and test a F# class in Visual Studio, then you add it as a reference in Ninja IDE so you can use it.

But it doesn't seem that simple to call F# objects and methods from C#:
Consuming/Calling F# from C# - Anton Andreev's blog
interop - Call F# code from C# - Stack Overflow


Reply With Quote
  #6 (permalink)
 gomi 
Paris
Legendary Market Wizard
 
Experience: None
Platform: NinjaTrader
Posts: 1,270 since Oct 2009
Thanks Given: 282
Thanks Received: 4,507

If you're into F# and numerical computation, you might take a look at latest "Cloud Numerics" library from MS.
Microsoft Codename "Cloud Numerics" | SQL Azure Labs
OakLeaf Systems: Introducing Microsoft Codename “Cloud Numerics” from SQL Azure Labs

What's cool is that once it runs on your desktop, you can put on azure and have the job done on 20 (or more) cores for a few bucks/hour....


Of course since it's supposed to be massively parrallel, so it's most matrix/vector computations



From what I understand it's also usable in c#
Microsoft Codename "Cloud Numerics" - TechNet Articles - United States (English) - TechNet Wiki

Need to test this one day.... ;-)


Reply With Quote
Thanked by:




Last Updated on October 22, 2012


© 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