Skip to content

Chart.TakeChartshot

method · Chart · cAlgo.API

DesktopCLICloud

Takes a chartshot from the chart that indicator / cBot runs on.

Environment behaviour

CLI — not supported. Returns an empty byte array and raises InvalidOperationException "Chartshot is not available in current mode."

Cloud — not supported. Returns an empty byte array and raises InvalidOperationException "Chartshot is not available in current mode."

Definition

byte[] TakeChartshot()
api.Chart.TakeChartshot() -> list[int] | None

Returns byte[] — If successful chartshot data inside a byte array in PNG format otherwise null.

Examples

var chartshot = Chart.TakeChartshot();
if (chartshot != null)
    Print("Chartshot PNG size: {0} bytes", chartshot.Length);
else
    Print("Chartshot is not available, the chart is not visible");
chartshot = api.Chart.TakeChartshot()
if chartshot is not None:
    api.Print(f"Chartshot PNG size: {chartshot.Length} bytes")
else:
    api.Print("Chartshot is not available, the chart is not visible")

See also