Skip to content

Fix cTrader Algo Code Bugs with Xen AI

What this Workflow Does

The Repair Mode workflow helps you resolve issues in existing trading code, including indicators, cBots, and plugins.

Repair Mode helps you fix compilation errors in cTrader cBots and indicators. It combines a source code editor, a build checker, and automatic AI repairs in one workspace. Once your code builds successfully, you can download an .algo file for use in cTrader.

Watch the video walkthrough

Open Repair Mode

Click Repair Mode at the top of the cTrader Xen workspace. The repair editor and Build Output panel replace the main chat area.

Before starting, keep a copy of your original source code so you can compare it with the repaired version.

Add your Source Code

Paste the complete C# source code for your cBot or indicator into the editor. You can also click Upload File to select a .cs or .txt file, or drag a source file into the editor.

Use the complete source file rather than an isolated method or error message. Repair Mode needs the code itself to check the build and apply corrections. You can also edit the code directly in the editor.

Check your code with Verify Build

Click Verify Build to compile the code once without requesting an AI repair.

The Build Output panel reports whether the build succeeded. If compilation fails, it displays the returned compiler errors, including error codes and line and column numbers where available.

Use this option when you want to check existing code or verify changes you have made yourself.

Automatically repair compilation errors

Choose a value under Retry attempts, then click Auto Build & Repair. You can select one, two, or three attempts; the default is three.

Xen checks the build, sends compilation errors and your source code to the selected AI model, applies a complete repaired response, and checks the updated code again. It continues until the code builds successfully or the selected attempt limit is reached.

Repair Mode is designed to make the minimum changes needed to resolve compilation errors. For new features or changes to trading behaviour, use the main chat.

AI repair requests use your selected model and consume account credit. Additional repair attempts can use more credit.

If the repair does not succeed

If errors remain after the selected attempts, the Build Output panel shows the remaining compiler errors. Review them before trying again. You can make manual corrections in the editor or select a more advanced AI model and run another repair.

If an AI response is incomplete or interrupted, Repair Mode keeps the previous complete source in the editor instead of replacing it with a partial response. Read the displayed message and retry when appropriate.

Click Stop to cancel an active automatic build or repair operation.

Download the working build

After a successful build, Download Algo becomes available. Click it to download the compiled .algo file for use in cTrader.

Check your browser’s Downloads folder for the file. To download another copy, click Verify Build again to create a fresh download.

Watch Video Explainer

Watch this video to learn how to fix bugs in your cBot or indicator.

Tip: Set the video quality to HD (1080p) for the best viewing experience.