All,
Sometimes I have trouble printing trade data to Excel. What happens is that I get duplicate days of data. It is like I've coded the "Print" statement twice in the code.
I've used the very latest 64 bit v10 file.
In Excel for a 3 stock portfolio the results would look like this: (note what I see in Excel is the order is repeated as 1,2,3,1,2,3 not 1,1,2,2,3,3)
...
7/6/2017 Stock 1 Close
7/6/2017 Stock 2 Close
7/6/2017 Stock 3 Close
7/6/2017 Stock 1 Close
7/6/2017 Stock 2 Close
7/6/2017 Stock 3 Close
7/7/2017 Stock 1 Close
7/7/2017 Stock 2 Close
7/7/2017 Stock 3 Close
7/7/2017 Stock 1 Close
7/7/2017 Stock 2 Close
7/7/2017 Stock 3 Close
....
Any thoughts?
Also is there another way (perhaps better) to get data output from MC into Excel?
Thanks
scuba
Trouble Printing to Excel
- JoshM
- Posts: 2195
- Joined: 20 May 2011
- Location: The Netherlands
- Has thanked: 1544 times
- Been thanked: 1565 times
- Contact:
Re: Trouble Printing to Excel
One possible reason that I can think of is that your script does a (partial) calculation twice. This typically happens when you reference historical bar values in MultiCharts, but in such a way that MultiCharts cannot estimate beforehand how many bars of historical data the script needs.It is like I've coded the "Print" statement twice in the code.
Any thoughts?
MultiCharts then begins calculating the script with its estimated MaxBarsBack value, but sometimes that estimation proves to be wrong. In that case, MultiCharts adjusts the estimation and recalculates the script. When that happens, code of our indicator or strategy can execute twice.
For more on this, see How Scripts Work.
If this causes the behaviour you're experiencing, you can fix it by setting the 'maximum number of bars a study will reference' setting to a high enough value yourself (instead of having it to Auto-Detect). If you've already done that, then this problem is caused by something else.