NexusFi: Find Your Edge


Home Menu

 





Connecting Accord.NET to ninjatrader 8


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one rleplae with 4 posts (2 thanks)
    2. looks_two SydAlgoTrader with 4 posts (0 thanks)
    3. looks_3 iq200 with 3 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,962 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 0 attachments




 
Search this Thread

Connecting Accord.NET to ninjatrader 8

  #1 (permalink)
SydAlgoTrader
Sydney new south Wales
 
Posts: 15 since Sep 2018
Thanks Given: 0
Thanks Received: 10

Hi everyone,

New to the forum but I've used Ninjatrader 8 for about a year now and have some strategies/indicators.

I was looking online for solutions to connect Accord.NET to ninjatrader 8 so I can implement its functions to trading. I've previously done some machine learning on Matlab, not with C#. I I am new to visual studio and I am encountering some roadblocks.

I was hoping someone could help me troubleshoot my issued connecting NT8 to Accord.NET.
I've been able to successfully follow the "getting started"" instructions on github and generate the SVM chart from within Visual Studio.
Unfortunately I'm unsure how to successfully reference Accord.NET inside the ninjascript declarations, or reference the dlls, let alone where to save them within NT8.
Can someone please assist me (and others)?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Quant vue
Trading Reviews and Vendors
 
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


Why would you absolutely want the accord.net to run in the memory space of NT ?

I would suggest an alternative road and to make a stand-alone application, that runs next to NT
and call it from your indicators using a classic tcp/ip call or a http call on a higher level if you want.

Good luck

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
SydAlgoTrader
Sydney new south Wales
 
Posts: 15 since Sep 2018
Thanks Given: 0
Thanks Received: 10


rleplae View Post
Why would you absolutely want the accord.net to run in the memory space of NT ?

I would suggest an alternative road and to make a stand-alone application, that runs next to NT
and call it from your indicators using a classic tcp/ip call or a http call on a higher level if you want.

Good luck

Thank you for the recommendation. As I am a complete greenhorn around programming in visual studio, I take it you mean a .exe C# function like one you'd make in Matlab, which I would then call from within NT8 to do the heavy mathematical lifting?

Do you know any good resources on how to implement a tcp/ip call?

I greatly appreciate your help, thank you.

Reply With Quote
  #5 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863

i'll post an example later

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
SydAlgoTrader
Sydney new south Wales
 
Posts: 15 since Sep 2018
Thanks Given: 0
Thanks Received: 10

Thank you again, I appreciate it

Reply With Quote
  #7 (permalink)
 iq200 
London, UK
 
Experience: Intermediate
Platform: Ninjatrader, Tradestation
Broker: Kinetick, InteractiveBrokers
Trading: Equities, Futures
Posts: 408 since Jun 2010
Thanks Given: 145
Thanks Received: 278


SydAlgoTrader View Post
Hi everyone,

New to the forum but I've used Ninjatrader 8 for about a year now and have some strategies/indicators.

I was looking online for solutions to connect Accord.NET to ninjatrader 8 so I can implement its functions to trading. I've previously done some machine learning on Matlab, not with C#. I I am new to visual studio and I am encountering some roadblocks.

I was hoping someone could help me troubleshoot my issued connecting NT8 to Accord.NET.
I've been able to successfully follow the "getting started"" instructions on github and generate the SVM chart from within Visual Studio.
Unfortunately I'm unsure how to successfully reference Accord.NET inside the ninjascript declarations, or reference the dlls, let alone where to save them within NT8.
Can someone please assist me (and others)?

I'm not entirely sure how Accord.Net works but if you want to get up and running quickly and get connected to the external .Net libraries, do the following:
1) Open the Ninjascript editor
2) Right click and in the menu select References. Point to the external libraries you want to access.

This will at least allow you to quickly prototype the code you want.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863

The following could be a function in your indicator where you need information from your
standalone process that talks with accord.NET


 
Code
try
			{
				string url = "http://192.168.0.1:9000/api/YourAPI";
				System.Net.WebClient client = new WebClientWithTimeout ();
				client.Headers.Add("content-type","application/json");
				
				
				var response = client.DownloadString (url);

				// do something with repsonse

				TimeoutOnWebCount=0;
			}
			catch
			{
				Print("Can not connect to http://192.168.0.1:9000/api/YourAPI");
				TimeoutOnWebCount++;
			}
and the communication function can look something like :

 
Code
public class WebClientWithTimeout:WebClient
	{
		protected override WebRequest GetWebRequest(Uri address)
		{
			WebRequest wr = base.GetWebRequest(address);
			wr.Timeout = 500; // timeout in milliseconds (ms)
			return wr;
		}
	}

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


iq200 View Post
I'm not entirely sure how Accord.Net works but if you want to get up and running quickly and get connected to the external .Net libraries, do the following:
1) Open the Ninjascript editor
2) Right click and in the menu select References. Point to the external libraries you want to access.

This will at least allow you to quickly prototype the code you want.

If you go this route, make sure your accord.net version libraries are compiled for the same .net version
and that all dependencies are reachable in the path

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #10 (permalink)
SydAlgoTrader
Sydney new south Wales
 
Posts: 15 since Sep 2018
Thanks Given: 0
Thanks Received: 10



rleplae View Post
If you go this route, make sure your accord.net version libraries are compiled for the same .net version
and that all dependencies are reachable in the path

I did end up going with that path (least resistance). Seems to be in order and compatible with the .NET version I have.

Ive got linear and polynomial regression indicators functioning with accord in nt8 now. The resources online for the neural network and kpca libraries are quite sparse though. Does anyone know any good material to test and replicate in nt8?

Reply With Quote




Last Updated on November 21, 2018


© 2024 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 - Privacy Policy - Downloads - Top
no new posts