Skip to content

Create and run cBots

Read the dedicated cTrader Algo guide on how cBots operate.

The flow of creating and running a cBot is illustrated in a diagram in another article.

1. To create a new cBot, click the New cBot button located above the collapsible algorithm lists.

Image title

Enter the name of your new cBot.

Note

If you want to create an algorithm similar to one of the sample cBots, use the Duplicate function in the algorithm actions menu.

2. Now, you can edit the sample code in the code editor window to the right of the sidebar.

Image title

When developing cBots, you can use existing code snippets.

Consult the References section of the cTrader Algo guide to learn more about the classes, methods and properties you can use when coding cBots. In addition, you can also write custom methods, as shown in our introduction to C# and .NET.

3. Save your cBot by clicking the Save button above the code editor window, selecting Save from the context menu or pressing Cmd+S.

Image title

Click the Build button above the code editor window, to the right of your algorithm, or in the algorithm actions menu. Alternatively, you can use the Cmd+B hotkey.

Image title

You will see the following message in the Build result window when your cBot builds successfully.

Image title

4. To add an instance in the cTrader Algo application, press the Plus icon to the right of the cBot in the algorithm list.

Image title

You can also add instances from the cBot actions menu.

Image title

In the Trade application, you can add cBots to the active chart via the Chart toolbar.

5. Before running an instance, adjust your cBot parameters (if needed) in the Parameters section below the trading chart. You can also open and save parameters by clicking the corresponding buttons in the top-right corner of this section.

Image title

If you run a cBot from the Trade application, you can customise its parameters in a separate window.

6. Finally, run the cBot instance by clicking the Start button to the right of the instance in the algorithm list. Here, you can also adjust the symbol and the period.

Image title

Or click the Start button at the top of the trading chart.

Image title

To stop the cBot, press the Stop button in the same locations as the Start button.

Warning

You cannot change the symbol, period and parameters of a running instance. Stop your cBot before making adjustments.