Improve Existing NinjaScript with AI

ClickAlgo Team

Master Trader
Aug 31, 2017
68
0
47
Swindon, United Kingdom
clickalgo.com
Many traders using NinjaTrader already have Strategies they have built, purchased or modified over time. The problem is often not creating another Strategy from scratch, but safely improving the code they already have. This is an area where AI can be particularly useful.

An existing NinjaScript Strategy can be reviewed to understand its entry, exit and risk-management logic before any changes are made. From there, AI can help repair problems, add new features or merge functionality from another Strategy.

We recently improved the existing-code workflow in Xen AI for NinjaTrader to make this type of development easier.

Instead of relying on source code buried inside a long AI conversation, the Strategy is attached as the project's current source. Other NinjaScript files can then be added either for integration or simply as reference code.

For example, you could have:

  • Your main Strategy as the current source
  • A second Strategy containing a trailing-stop system you want to integrate
  • Another NinjaScript file provided only as an implementation reference
Xen can review the source before modifying anything and identify unclear requirements or decisions that need to be made. Confirmed requirements and clarification decisions can also remain with the project. This becomes increasingly important when a simple modification develops into a longer coding session involving several changes.

A sensible workflow is:

Review → Clarify → Modify → Build Check → Compile → Test

When Xen produces a complete revised Strategy, the latest working version can then become the basis for the next modification. This does not remove the need for testing. AI-generated or modified NinjaScript should always be compiled in NinjaTrader and its actual trading behaviour verified before use.

I recorded a short demonstration of the updated workflow:

Video:
To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.

Xen AI for NinjaTrader:
https://ninja.clickalgo.com/

For traders who already have working NinjaScript, I think improving existing code is ultimately one of the more practical applications of AI coding.