When do I need a hybrid trading system for auto execution? Since we released CQG AutoTrader functionality and XLS Trader we have had some use cases were we wanted to combine the best of both worlds.
The CQG trade systems tool gives us the functionality to create trade systems with a lot of build in functionality such as canned exits, trailing stops, understanding partial fills to just name a few. It can be very challenging and complex to build these on your own just using Excel. On the other hand you might have calculations, or inputs that you cannot (or do not want to) replicate in CQG’s language. This is where you can combine the two together!
Disclaimer: Initiating trades and/or variables of trades from outside of the CQG language can make the backtesting output inaccurate and unusable. These functions are only for auto execution and NOT for backtesting. This can make it much harder to troubleshoot!
As a first example we want to control the trading quantity from Excel. We use the XLRT function from the toolbox to read the values from excel and put it into our trading system quantity field.
Inside the CQG trade system tap, this would look like this:
Instead of a hard coded trading size we take this information in real time out of our Excel sheet. All we need to know is the workbook name, the sheet and the cell we are referring to. The workbook needs to be up and running!
On the Excel side this cell can be a manual input or being calculated based on your own code. Another option is to actually trigger the trade based on the real time input from Excel.
When the cell C6 turns to “1” the system will immediately execute the order when AutoTrader is engaged. Again, this can be formula based on your own calculations or just a manual input in Excel.
Once the trade was initiated, the exits are controlled by the rules in the trading system created by CQG.
These are only two simple examples, but the possibilities to mix Excel and CQG trade systems are infinite. You can pull price levels, study values and all kind of on/off switches from Excel.
The XLRealtime function can also be used to pull real-time data from Excel and plot it into a study on your chart.
Cell C10
Additional Resources
- More information on the Excel real-time study in CQG: http://help.cqg.com/cqgic/20/#!Documents/xlrealtimexlrt.htm
- CQG’s XLS Trader starting point: https://news.cqg.com/workspaces/2020/04/cqgs-xls-trader
- Official documentation: http://help.cqg.com/cqgic/20/default.htm#!Documents/xlstrader1.htm