Like most traders, I keep a daily record of all trades whether taken through automation, MC's chart trader, or through the broker's client. At the end of the day, the basic trade data is automatically extracted from the broker into a .csv file. I then grade the trades and make comments and append it to my trading log.
For a quite a while I drew a trendline of each trade on the trading chart for the day and took a picture of it to save in my log. I got tired of this manual exercise and quit doing it. It occurred to me--belatedly--that I should also be able to feed the trade data into my trading chart and automatically plot a trendline for each trade.
Is anybody else doing this? Any thoughts about how best to do this?
Thanks in advance.
-PDQ
Plotting actual trades on a chart after the fact [SOLVED]
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Plotting actual trades on a chart after the fact [SOLVED]
I'm not doing this so I cannot offer concrete code snippets, but as far as thoughts about how to do this: I would use ELCollections to load the data from the file. Once loaded, you can go through it with PowerLanguage and plot a trend line between trades. Do you already have a piece of code that we can expand on?Is anybody else doing this? Any thoughts about how best to do this?
-
- Posts: 191
- Joined: 27 Apr 2010
- Location: San Jose
- Has thanked: 67 times
- Been thanked: 10 times
Re: Plotting actual trades on a chart after the fact
Thanks, Josh. Looks like I need to study ELCollections first. I've never used it. I've done a fair amount of work with trendlines so I'm not concerned with that part of it.
-
- Posts: 191
- Joined: 27 Apr 2010
- Location: San Jose
- Has thanked: 67 times
- Been thanked: 10 times
Re: Plotting actual trades on a chart after the fact
Finally got around to doing some more work on this idea this weekend. I'm at the point where I read the broker order transaction data, convert it into unique trade details, and plot the results on a chart. I'll be happy to share the code, but I'm trying to figure out the last piece of the puzzle first.
Here's the deal: my clearing broker uses the R-Trader client to display trade data. R-Trader has an option to "Export As CSV Periodically" in which you can pick a target file and have order data written daily. This is all good except for one fact: R-Trader writes a bunch of unnecessary header data into the file in addition to the order data. This causes ELCollections to puke when it tries to read in the data from the file.
My workaround is to edit the .csv file after it is exported and to remove the offending junk, re-save, and then run my routine against the cleansed file. This is a pain, however, because if you simple double-click on the .csv file to open it in Excel, Excel unhelpfully changes the data formats and loses the granularity needed to plot the trend lines. You can use the Excel file import as text, but that's a multi-step process that's a pain in the rear, too. Livable, but a pain.
What I'm looking to know is this: if I find a Visual Basic coder to create a simple routine to strip out the extraneous header lines, could this VB routine be invoked by my PLA code to cleanse the data file before it gets read? Or, would I have to run the VB code separately/manually and then run the PLA code after it? Or are there other alternatives?
Here's the deal: my clearing broker uses the R-Trader client to display trade data. R-Trader has an option to "Export As CSV Periodically" in which you can pick a target file and have order data written daily. This is all good except for one fact: R-Trader writes a bunch of unnecessary header data into the file in addition to the order data. This causes ELCollections to puke when it tries to read in the data from the file.
My workaround is to edit the .csv file after it is exported and to remove the offending junk, re-save, and then run my routine against the cleansed file. This is a pain, however, because if you simple double-click on the .csv file to open it in Excel, Excel unhelpfully changes the data formats and loses the granularity needed to plot the trend lines. You can use the Excel file import as text, but that's a multi-step process that's a pain in the rear, too. Livable, but a pain.
What I'm looking to know is this: if I find a Visual Basic coder to create a simple routine to strip out the extraneous header lines, could this VB routine be invoked by my PLA code to cleanse the data file before it gets read? Or, would I have to run the VB code separately/manually and then run the PLA code after it? Or are there other alternatives?
- Attachments
-
- 2016-11-24_1117.png
- how it plots on a chart
- (34.09 KiB) Downloaded 691 times
-
- 2016-11-24_1116.png
- what the unique trade leg data looks like
- (18.55 KiB) Downloaded 685 times
-
- 2016-11-24_1118.png
- raw trade data with header removed
- (8.68 KiB) Downloaded 683 times
-
- 2016-11-25_1751.png
- here's what the raw data file looks like
- (23.45 KiB) Downloaded 685 times