Skip to content

Chartshot Method

This user guide explains how to use the TakeChartshot() method when creating cTrader algorithms. If you are eager to get started, simply read our one-minute summary below.

Chartshot Methods in One Minute!

  • The TakeChartshot() method allows cTrader algos to take chartshots of the charts on which they are running but only if this chart is visible.
  • Chartshots are a great tool to communicate with other traders and share technical analysis. With the TakeChartshot() method, this process becomes easier than ever!
  • The TakeChartshot() method returns an array of bytes, meaning that you can easily share chartshots as .PNG files. You can also share the chartshot on the Internet using the network access feature.
  • The TakeChartshot() method is essential if you want to make chartshots whenever your algos do something (e.g., when a cBot places an order). This feature provides a great visual aid for anyone who wants to evaluate how their solutions perform without keeping an eye on the chart 24/7.

How to Use the TakeChartshot() Method

Chartshots offer a way to quickly create screenshots of trading charts. If you create a chartshot manually via the cTrader toolbar, the screenshot is saved on your local machine in addition to being automatically uploaded to a special portal that offers several ways via which you can share it (e.g., via embeddable HTML code).

In turn, our API allows for making chartshots automatically. In contrast to regular chartshots, chartshots made by cTrader algos are not saved anywhere by default. Instead, such chartshots are returned as byte arrays that you are free to save wherever you want by specifying an additional action in the code.

The byte[] TakeChartshot() method works as follows.

  • byte[] TakeChartshot(). Takes a chartshot of the chart on which the algorithm is running and returns it as an array of bytes.

Note that the method only works if a chart is visible. To allow for easily checking chart visibility, the Chart interface includes the IsVisible property. It is equal to true for a visible chart and false for an invisible one.

Chartshots in Backtesting and Optimization

  • In optimization and non-visual backtesting, the TakeChartshot() method always returns null and invokes the OnException() handler if you have specified it.
  • In visual mode backtesting, the method works as intended.

Creating an Example cBot

To demonstrate how taking chartshots automatically works, we will create a simple cBot that will make a chartshot of the current chart and save it in the family system of your local machine.

using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cAlgo.API;
using cAlgo.API.Collections;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;

namespace cAlgo.Robots
    [Robot(AccessRights = AccessRights.FullAccess)]
    public class ChartshotTest : Robot
        protected override void OnStart()
            if (Chart.IsActive)
                var chartshot = Chart.TakeChartshot();

                File.WriteAllBytes(@"D://examplePath/chartshot.png", chartshot);


On start, the .PNG file containing the chartshot of the chart to which we have attached the cBot instance will be added to D://examplePath/.


The TakeChartshot() method allows cTrader algos to make easily sharable chartshots, making it essential for anyone who wants to share information with other traders or track how their automated solutions perform in response to certain conditions. This method is also usable in visual backtesting, allowing you to easily match the actions of your cBots to events occurring on charts.

Last update: November 30, 2023