I edit your code using SRC button, next time use SRC button to post the codes.
I know this is almost a year old, but it is so hard to find anything about ExcelLink. Maybe I can help you or someone else. I found that if ExcelStart was accessed more than once that I would get -1. I put ExcelStart in my int init() section and my ExcelEnd, ExcelSave and ExcelClose in my int deinit() section. I know it seems like you don't want to open the Excel file until the last moment, or you do want save it right away, or mainly you think it is needed at the start of each section where ExcelLink is used, but it just doesn't seem to work well that way. So, my Excel opens as soon as the EA starts. I will try using ExcelSave more often as long as there are no problems. Right now it seems to work flawlessly. Before I had to close MT4 and Excel after each trade/Excel session.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Trying to access data from Excel file using Excellink. All OK at first Tick when indicator dropped onto chart ie reads and writes to file but when I later try to access Excellink reads only 0 data value.
Problem appears to be Handle which on 1st pass = 0 but on subsequent accesses = -1. Error code is 4101 in both cases ie "Wrong File Name". Appears I need to delete original handler in some way.
I have included some of the code the selection variable being highlighted (XLLnk = 0;)
Would be very interested if someone had this problem before and has an answer.
Thanks in anticipation
John W