Currently using cTrader all the operational information of your automated strategies (cBot) or indicators are displayed on the platform in the log tab, unfortunately, if you ever close the platform or stop and re-start the robot, all that information is lost.
What Is It?
The data logger is a .NET assembly that you add to your cBot or indicator as a referenced AddOn, this takes away all the complex code and allows you to use the data logger with a few lines of code. All the data is written to files on your computer, a new file is created each day to help you investigate.
"Data Logging Has Never Been So Easy"
Log Results Delimiter
It is also possible to alter the results delimiter, the default value is a comma, so the results would be:
RSI > 80 , 0.004
To change the delimiter to a semi-colon or other value you need to specify this using the TextSeperator method, this has to be set after the SetLogDir method.
TradeLogger.TextSeparator = " ; ";
Logging Automated Strategies (cBots)
It can be very useful when you run your robot to record all signal and trade activity. Also, you would want to know when something strange has happened, a small error in the code of your software can cause huge financial losses. Strange behaviour in your algo that has got you banging your head against the wall can easily be identified with some well-placed logging logic in your source code.
Logging Custom Indicators
You can also add the logging code to custom indicators for analysis, all the information is stored in files to be opened with your favourite software, notepad and excel.
How to Use Logging for Back-Testing
cTrader uses server time for backtesting and not your current time, if you start your back-test on the 01.01.2012, this will be the first date, so you will need to add this as a parameter to each call for Info, Warning and Error, an example of this is below.
Back-Test Code with an extra parameter
TradeLogger.Info("RSI > 80 " + _rsi.Result.LastValue.ToString("0.0000"), Server.Time);
Forward-Test Code for Normal Running of the Robot Without Parameter
TradeLogger.Info("RSI > 80 " + _rsi.Result.LastValue.ToString("0.0000");
Watch a Video Demo
You can expand screen full size as well as set it to 1080p HD
Ok, hands in the air. I noticed my mistake of the incorrect values for SMA, I should have used an RSI indicator to demonstrate logging information when the RSI value is > 80 or < 20. I hope that you still understand what I was trying to show you, and if I get time, I will record the video again. It is a Friday afternoon and many strange things usually happen towards the end of the day. The example code has been updated using the RSI instead of SMA.
Prerequisites
In order to use this project, you will need Microsoft Visual Studio, this is free to download and the standard with C# software development.
Our Development Service
We also offer a custom development service to help you build your trading robots and indicators.