Execute trades example using LinqToExcel and LINQ to easily read an Excel or CSV file into your Automated Trading Robot.
Please note that this is an example and not a working robot.
I found this very useful tool for working with Microsoft Excel data that I would like to share with you. If you need to get data out of Excel, which can be done using ADO.NET. However using LINQ to Excel makes this very easy for people who are not experienced programmers.
DATA - ANALYSIS - TRADE
This robot is an example to demonstrate the power you can have at your fingertips using cTrader, cAlgo and C#, this robot reads trades from an excel file and executes them in real time with the robot, you can dynamically modify the trade results with user defined parameters from the robots user interface or from within the code.
Watch uTube video about LinqToExcel to find out more...
THE SIMPLEST WAY OF READING DATA FROM EXCEL
The example shows a list of trades for the day that have been entered onto a spreadsheet with separate sheets for different instruments, it does not matter if this would not be useful in real life, it is just to show what can be accomplished and possibilities. The image below shows information for opening new positions when the price reaches the entry price, the expiry date and time allows you to filter these out using LINQ from within your robot.
You will notice in the source code that there is a class called DailyTrade, this class is the data container which will automatically be populated with data from the spreadsheet.
As you can see the class name is the same as the spreadsheet name dailyTrades.xls and each property has an attribute [ExcelColumn], this maps to the name of columns in the spreadsheet, so the property name does not have to be the same as the property name and you can have spaces in the column name.
The code that injects all the data into the class is a collection of DataTrade objects, so you will end up with a list of daily trades which you can iterate through to open the trades. You will be able to access the data in a clean and readable manner like; trade.EntryPrice or trade.ExpiryDate.