Capture
On every exit, the strategy uploads the chart image with instrument, account, entry and exit times in local and UTC, prices, exit reason and net P&L.
Every closed trade leaves NinjaTrader with its chart screenshot and full details, lands in a database, and shows up seconds later in a journal with a calendar and statistics. The same server stores market bars and options-gamma snapshots, and sends live signals back to NinjaTrader.
Architecture
One Flask server sits between the trading platform, a Python signal engine and the browser. Each arrow is an HTTP request with a defined format.
On every exit, the strategy uploads the chart image with instrument, account, entry and exit times in local and UTC, prices, exit reason and net P&L.
The server validates each upload, writes it to SQLite, saves the image and builds a thumbnail. Bars and gamma snapshots are stored per symbol and day.
The dashboard groups trades by strategy, colours each calendar day by win rate, and breaks results down by weekday and month. Everything exports to CSV.
A Python engine posts signals. The NinjaTrader add-on polls for them, places the order and reports the fill back, so every signal has a status.
Live demo
Sample data. These trades are generated for the demo and are not real results.
This is a working copy of the journal's calendar view. Pick a day to see its trades. The statistics view follows below.
Days are coloured by win rate: green above 50%, red below 50%. Stronger colour means further from 50%.
Select a coloured day in the calendar to list its trades.
Live demo
Same sample trades as the calendar above.
The statistics view ranks every strategy by net result, with win rate, profit factor and average trade, and shows which instruments each one traded. Strategies marked as restricted keep their numbers but hide their name from visitors without access.
Profit factor = gross profit ÷ gross loss. Sample results include commissions per contract.
Interfaces
| Endpoint | What it does |
|---|---|
| POST /screenshots/upload | NinjaTrader sends a trade: chart image plus entry, exit, prices, exit reason and P&L. |
| GET /screenshots/api/calendar_stats | Daily trade counts, win rate and net result for the calendar. |
| GET /screenshots/export/csv | Every trade as a CSV file for outside analysis. |
| POST /market/bars | NinjaTrader streams 5-minute bars per symbol. |
| GET /market/backtest/<symbol> | Bars merged with the gamma snapshot of the day, marked above or below the gamma flip. |
| POST /signals/submit | The Python engine publishes a new signal. |
| GET /signals/pending | The NinjaTrader add-on collects signals to place. |
| POST /signals/<id>/fill | NinjaTrader confirms the fill, closing the loop. |
Built with Python, Flask, SQLite and Pillow on Linux, with C# NinjaScript on the trading side.
The architecture, the trading strategies and the signal logic are my own design. The code was written with AI assistance, and I verified each piece before relying on it.