Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Here's a WebSocket client for NinjaTrader 8 to facilitate communication between programming languages that support the WebSocket protocol. I've attached the indicator and a Python example .
I created this indicator to integrate with Ninjatrader and leverage AI tools such as Langchain, Microsoft Semantic Kernel, Autogen, and more.
This is for developers and individuals interested in bi-directional data communication using WebSocket in their preferred programming language. You can utilize the NinjaSocket source code in your own indicators or strategies. For instance, if you wish to send OHLC data from NinjaTrader to Python for analysis
Here's a short code snippet
NinjaScript
string data = "";
for (int i = 0; i < Bars.Count; i++)
{
double open = Bars.GetOpen(i);
double high = Bars.GetHigh(i);
double low = Bars.GetLow(i);
double close = Bars.GetClose(i);
double volume = Bars.GetVolume(i);
DateTime time = Bars.GetTime(i);
data += string.Format("{0}|{1}|{2}|{3}|{4}|{5};", open, high, low, close, volume, time);
}
// Send the data
SendDataAsync(data);
Python
data = await websocket.receive_text()
bars = data.decode('utf-8').split(';')
for bar in bars: