Can Directory Structure be used in this format?

Directory Structure: All six generated files (four ⁠.cs⁠ files, two ⁠.py⁠ files) must be located in the same root staging directory on your local machine. The listed the directory outline above: Can python and C# exist inside the same Directory Structure in NinjaTrader and still function.

What is NinjaTraders Best Practices for incorporating C# modules along with Python modules that act as a single system; monitoring market Level 1 and tier 2 data, storing key data, processing data, entering trades, and evaluating data and trades.

The files can share a staging folder, but that does not make them one runtime. NinjaScript is C#; placing a .py file beside a .cs file does not tell NinjaTrader how to execute it.

For a first version, I would keep the NinjaScript component and Python worker separate, with an explicit local message contract between them. That is a design suggestion, not a requirement to use a particular bridge.

The NinjaScript side can collect the events, while the worker handles the separate processing. Define message identity, instrument, timestamps, schema version, acknowledgements and what happens if either process restarts. Start with read-only capture and replay before enabling any order path.

For L1 and L2, see OnMarketData and OnMarketDepth. The depth documentation explicitly warns against assuming an ordering between those two callbacks.

A useful first test is to stop the Python worker during capture: the NinjaTrader callback should not wait indefinitely, and a queue gap or dropped event should be reported rather than hidden.

The missing diagram matters: could you paste the six filenames and say which process starts each one? Also say whether you intend an external Python process or an embedded interpreter. Those are different deployment designs.

1 Like