Skip to content

Build a cTrader Plugin with Xen AI

What this Workflow Does

The Build a Plugin workflow helps you create a plugin that extends the functionality of a trading platform beyond standard indicators and strategies.

Plugins are typically used for advanced tools, platform extensions, shared services, custom panels, or integrations that cannot be handled properly inside a basic indicator or robot. This workflow focuses on correct structure, lifecycle handling, and stability.

When to Use This Workflow

Use this workflow when you need functionality that indicators or robots cannot provide. It is best suited for reusable tools, platform-level extensions, and features that require tighter integration with the trading platform.

Do not use this workflow for simple chart studies or basic automated strategies. For those, use an indicator or trading robot workflow instead.

What You Should Prepare

Before starting, define what the plugin should do and how it should interact with the platform. Plugins are more complex than indicators or robots, so the requirements should be clear before code is generated.

Useful details include:

  • the main purpose of the plugin
  • required inputs, settings, or configuration
  • how the plugin interacts with platform data or tools
  • any existing code or reference logic you want to reuse

Plugins should always start with a minimal working base before adding advanced features.

How to Interact with Xen

Describe the plugin in functional and structural terms. Explain what the plugin should do, when it should run, and how it should behave during startup, operation, and shutdown.

Good examples:

  • “Create a plugin that exposes account information.”
  • “Build a background service that tracks market state.”
  • “Add a shared panel used by multiple tools.”
  • “Handle startup and shutdown cleanly.”

Avoid vague requests such as:

  • “Build an advanced plugin.”
  • “Add everything at once.”
  • “Make it powerful.”

Clear structure leads to more stable plugin code.

How Xen Builds Plugins

Xen will generate a correct plugin skeleton and follow the proper plugin lifecycle for the target platform. It will separate core logic from UI components where possible and add configuration options when they are appropriate.

The result is returned as a complete, compile-ready file. Because plugins are more advanced than standard tools, the first version should be treated as a baseline and extended gradually after testing.

Common Mistakes to Avoid

Plugins require more care than simple scripts or indicators. Most problems happen when complex features are added before the base structure has been tested.

Avoid these common mistakes:

  • skipping lifecycle handling
  • mixing plugin logic with indicator or robot code
  • adding complex features before the base works
  • treating plugins like simple scripts

Build the plugin in stages, test loading and unloading behaviour, then extend it step by step.

After building the plugin, test how it loads, runs, and shuts down. Confirm that it behaves correctly before adding more features or integrating it with other tools.