ChartShot API

Created at 11 Jun 2015, 11:00
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
SwapBridgeCapital's avatar

SwapBridgeCapital

Joined 01.10.2014

ChartShot API
11 Jun 2015, 11:00


http://help.spotware.com/charts/chartshots

 

Can I access this feature within calgo api. 

 

I would like to automate the process of taking a screenshot based on logic. 

If it can't be done with the calgo api, What function in c# or dll to use. Please include sample code, thank you


@SwapBridgeCapital
Replies

Spotware
11 Jun 2015, 14:29

Dear Trader,

Thank you for your suggestion. We will consider it. Additionally you can post your ideas/suggestions to http://vote.spotware.com/


@Spotware

BetsAnalistasCBot
10 Feb 2019, 12:51

Solved with ffmpeg

I have solved the problem running ffmpeg with "Process" from System.Diagnostics


@BetsAnalistasCBot

BetsAnalistasCBot
10 Feb 2019, 13:21

RE: Solved with ffmpeg

BetsAnalistasCBot said:

I have solved the problem running ffmpeg with "Process" from System.Diagnostics

I have solved the problem running ffmpeg with "Process" from System.Diagnostics


@BetsAnalistasCBot

BetsAnalistasCBot
10 Feb 2019, 13:22

RE: RE: Solved with ffmpeg

 

using System.Diagnostics;

private string FFmpegArguments;

if (CaptureChart(Symbol.Code.ToString()))
{
        Print(Symbol.Code.ToString() + " Chart successfully captured");
}

private bool CaptureChart(string Simbolo)
{
     FFmpegArguments = "-f gdigrab -i title=\"" + Simbolo + ", " + TimeFrame.ToString().Replace("Minute", "m").Replace("Hour", "h").Replace("Daily", "D").Replace("Day", "D").Replace("Tick", "t") + " - FxPro cTrader\" -s 800x400 -vframes 1 -f mjpeg z:/ForexCharts/" + Simbolo + ".png -y";

     if (Simbolo.Substring(0, 1) == "#")
           FFmpegArguments = "-f gdigrab -i title=\"" + Simbolo + ", " + TimeFrame.ToString().Replace("Minute", "m").Replace("Hour", "h").Replace("Daily", "D").Replace("Day", "D").Replace("Tick", "t") + " - FxPro cTrader\" -s 800x400 -vframes 1 -f mjpeg z:/ForexCharts/" + Simbolo.Substring(1) + ".png -y";

     try
     {
        Process myProcess = new Process();
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.StartInfo.Arguments = Argumentos;
        myProcess.StartInfo.FileName = "c:/nginx/ffmpeg/bin/ffmpeg.exe";
        myProcess.StartInfo.CreateNoWindow = true;
        myProcess.Start();
        myProcess.WaitForExit();
        return true;
     } catch (Exception e)
     {
        Print(e.Message);
        return false;
     }
}

@BetsAnalistasCBot

BetsAnalistasCBot
10 Feb 2019, 13:24

RE: RE: Solved with ffmpeg

BetsAnalistasCBot said:

BetsAnalistasCBot said:

I have solved the problem running ffmpeg with "Process" from System.Diagnostics

I have solved the problem running ffmpeg with "Process" from System.Diagnostics

First Detach your Symbol Chart from cTrader window and then use the code below to capture your Window Symbol Chart

Best regards


@BetsAnalistasCBot

BetsAnalistasCBot
10 Feb 2019, 13:32

RE: RE: RE: Solved with ffmpeg

BetsAnalistasCBot said:

BetsAnalistasCBot said:

BetsAnalistasCBot said:

I have solved the problem running ffmpeg with "Process" from System.Diagnostics

I have solved the problem running ffmpeg with "Process" from System.Diagnostics

First Detach your Symbol Chart from cTrader window and then use the code below to capture your Window Symbol Chart

Best regards

using System.Diagnostics;
 
private string FFmpegArguments;
 
if (CaptureChart(Symbol.Code.ToString()))
{
        Print(Symbol.Code.ToString() + " Chart successfully captured");
}
 
private bool CaptureChart(string Simbolo)
{
     FFmpegArguments = "-f gdigrab -i title=\"" + Simbolo + ", " + TimeFrame.ToString().Replace("Minute", "m").Replace("Hour", "h").Replace("Daily", "D").Replace("Day", "D").Replace("Tick", "t") + " - FxPro cTrader\" -s 800x400 -vframes 1 -f mjpeg z:/ForexCharts/" + Simbolo + ".png -y";
 
     if (Simbolo.Substring(0, 1) == "#")
           FFmpegArguments = "-f gdigrab -i title=\"" + Simbolo + ", " + TimeFrame.ToString().Replace("Minute", "m").Replace("Hour", "h").Replace("Daily", "D").Replace("Day", "D").Replace("Tick", "t") + " - FxPro cTrader\" -s 800x400 -vframes 1 -f mjpeg z:/ForexCharts/" + Simbolo.Substring(1) + ".png -y";
 
     try
     {
        Process myProcess = new Process();
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.StartInfo.Arguments = FFmpegArguments;
        myProcess.StartInfo.FileName = "c:/ffmpeg/bin/ffmpeg.exe";
        myProcess.StartInfo.CreateNoWindow = true;
        myProcess.Start();
        myProcess.WaitForExit();
        return true;
     } catch (Exception e)
     {
        Print(e.Message);
        return false;
     }
}

 


@BetsAnalistasCBot