Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Adding nuget packages to NT8?
Collapse
X
-
grimwm00 i got your message. i could not make it work due to dependency on the additional libraries.
-
bltdavid I didn't think about sockets. I suppose I could try something like that. Maybe I can at least use protobuf to help prevent me from having to design the structure itself, and then I can do a 3-layer set up: NT8 as a client, middleware (server to NT8 and client to the model), server (the model I really want to talk to). At the least, you have given me some ideas.
Leave a comment:
-
Sorry, no.Originally posted by grimwm00 View PostDo you know of any?
My needs have not been that elaborate.Originally posted by grimwm00 View PostOr, more pertinently, do you know of any patterns to enable 2-way comms between NT8 and a network-connected model I'm planning to make?
I have used sockets in NT8 to great effect with a relatively simple client-server
model using a text-based home-grown protocol. But that's about it.

Leave a comment:
-
bltdavid that is amazing. I would have never figured out that the DLLs had to exist in thedirectory itself.Code:bin\Custom
I was able to get grpc libs installed and referenced, but I cannot find a version that actually works with NT8. All of them seem to require some other library that ends up not being compatible, and I can't seem to figure out a set of dependencies that would work. Do you know of any?
Or, more pertinently, do you know of any patterns to enable 2-way comms between NT8 and a network-connected model I'm planning to make? I've considered a REST API, which I hate, but I'm sure I could get something to work with that. I also know how to use tech like redis and kafka, but those already sound like they'd be too advanced to import the DLLs into NT8 properly.
Leave a comment:
-
Do not add references to DLLs located in subfolders under bin/Custom.
All DLLs should be in bin/Custom, subfolders do not seem to be supported.
My advice?
NinjaTrader and nuget do not mix well.
Extract/build/install all nuget packages somewhere outside of NinjaTrader folders.
Copy desired DLLs to bin/Custom.
Moral of story:
When adding references using NinjaScript editor, try selecting only
DLL files that have already been relocated to bin/Custom.
If after this, things still seem wonky, try exiting/restarting NinjaTrader.
Good luck!
Last edited by bltdavid; 01-29-2025, 04:54 AM.
Leave a comment:
-
Adding nuget packages to NT8?
Outside of NT 8.1.4.1, I've created a simple hello-world grpc client and server. Back in NT8, I created a script whose only goal is to try and connect to the gRPC and do nothing else, but it keeps failing to load my script with errors described below.
First, there is a packages.config inside bin\Custom that includes the following contents:
When I use nuget.exe to install these, it places all of the folders locally in bin\Custom.Code:<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Google.Protobuf" version="3.29.3" targetFramework="net48" /> <package id="Grpc.Core.Api" version="2.67.0" targetFramework="net48" /> <package id="Grpc.Net.Client" version="2.67.0" targetFramework="net48" /> <package id="Grpc.Tools" version="2.69.0" targetFramework="net48" /> </packages>
Then I went into NinjaScript editor and added references to the Grpc.Core.Api and Grpc.Net.Client files, which looks like this:
Then I have code as simple as this indicator code, just to see if I can connect to my gRPC server.
When I try to add it as an indicator, well, for one, it just shows a row without a name. When I try to add it to a chart anyway, I get messages like these in the NT8 log window:Code:#region Using declarations using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Input; using System.Windows.Media; using System.Xml.Serialization; using NinjaTrader.Cbi; using NinjaTrader.Gui; using NinjaTrader.Gui.Chart; using NinjaTrader.Gui.SuperDom; using NinjaTrader.Gui.Tools; using NinjaTrader.Data; using NinjaTrader.NinjaScript; using NinjaTrader.Core.FloatingPoint; using NinjaTrader.NinjaScript.DrawingTools; using Grpc.Net.Client; #endregion //This namespace holds Indicators in this folder and is required. Do not change it. namespace NinjaTrader.NinjaScript.Indicators { public class gRPCTestClient : Indicator { private static GrpcChannel channel; protected override void OnStateChange() { if (State == State.SetDefaults) { Description = @"This code does nothing other than connect to a gRPC server and send a message to get an echoed response."; Name = "gRPCTestClient"; Calculate = Calculate.OnBarClose; IsOverlay = false; DisplayInDataBox = true; DrawOnPricePanel = true; DrawHorizontalGridLines = true; DrawVerticalGridLines = true; PaintPriceMarkers = true; ScaleJustification = NinjaTrader.Gui.Chart.ScaleJustification.Right; //Disable this property if your indicator requires custom values that cumulate with each new market data event. //See Help Guide for additional information. IsSuspendedWhileInactive = true; } else if (State == State.Configure) { channel = GrpcChannel.ForAddress("https://localhost:7257"); } } protected override void OnBarUpdate() { //Add your custom indicator logic here. } } } #region NinjaScript generated code. Neither change nor remove. namespace NinjaTrader.NinjaScript.Indicators { public partial class Indicator : NinjaTrader.Gui.NinjaScript.IndicatorRenderBase { private gRPCTestClient[] cachegRPCTestClient; public gRPCTestClient gRPCTestClient() { return gRPCTestClient(Input); } public gRPCTestClient gRPCTestClient(ISeries<double> input) { if (cachegRPCTestClient != null) for (int idx = 0; idx < cachegRPCTestClient.Length; idx++) if (cachegRPCTestClient[idx] != null && cachegRPCTestClient[idx].EqualsInput(input)) return cachegRPCTestClient[idx]; return CacheIndicator<gRPCTestClient>(new gRPCTestClient(), input, ref cachegRPCTestClient); } } } namespace NinjaTrader.NinjaScript.MarketAnalyzerColumns { public partial class MarketAnalyzerColumn : MarketAnalyzerColumnBase { public Indicators.gRPCTestClient gRPCTestClient() { return indicator.gRPCTestClient(Input); } public Indicators.gRPCTestClient gRPCTestClient(ISeries<double> input ) { return indicator.gRPCTestClient(input); } } } namespace NinjaTrader.NinjaScript.Strategies { public partial class Strategy : NinjaTrader.Gui.NinjaScript.StrategyRenderBase { public Indicators.gRPCTestClient gRPCTestClient() { return indicator.gRPCTestClient(Input); } public Indicators.gRPCTestClient gRPCTestClient(ISeries<double> input ) { return indicator.gRPCTestClient(input); } } } #endregion
which ultimately leads to a total failure that throws an exception box with the message:Indicator 'gRPCTestClient': Error on calling 'OnStateChange' method: Could not load file or assembly 'Grpc.Net.Client Version=2.0.0.0 Culture=neutral PublicKeyToken=d754f35622e28bad' or one of its dependencies. The system cannot find the file specified.
If someone has a solution, that would be so awesome! NT support, do you have any answers?Unhandled exception: Non-static method requires a target.Last edited by grimwm00; 01-29-2025, 02:01 AM.Tags: None
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by SalmaTrader, 07-07-2026, 10:26 PM
|
0 responses
54 views
0 likes
|
Last Post
by SalmaTrader
07-07-2026, 10:26 PM
|
||
|
Started by CarlTrading, 07-05-2026, 01:16 PM
|
0 responses
25 views
0 likes
|
Last Post
by CarlTrading
07-05-2026, 01:16 PM
|
||
|
Started by CaptainJack, 06-17-2026, 10:32 AM
|
0 responses
17 views
0 likes
|
Last Post
by CaptainJack
06-17-2026, 10:32 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:15 AM
|
0 responses
23 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:15 AM
|
||
|
Started by kinfxhk, 06-17-2026, 04:06 AM
|
0 responses
24 views
0 likes
|
Last Post
by kinfxhk
06-17-2026, 04:06 AM
|

Leave a comment: