![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
ok you said i got help, but where's the code help?
.ok you said i got help, but where's the code help?
.I can code for mql4 but no mql5, because THERE IS NO BOOK OUT THERE, and it's easy if you study programming in college, but i didn't, i just need 1 example of Close [ 1 ] code, simple, i don't want you to code for me, but show me some examples, that's the purpose of this forum
I don't want to learn mql5, because i like only to work with mt4, but i need this to work
I don't want to learn mql5, because i like only to work with mt4, but i need this to work
If you do not want to learn mql5, ok, but do not say there is no mql5 Book.
I had answered in your other post with the code explained step by step, but that post has been deleted (I guess a moderator has deleted it in duplicate), so seeing that you have no intention of learning anything, I will not repeat here the code that I showed there.
Regards.
If you do not want to learn mql5, ok, but do not say there is no mql5 Book.
I had answered in your other post with the code explained step by step, but that post has been deleted (I guess a moderator has deleted it in duplicate), so seeing that you have no intention of learning anything, I will not repeat here the code that I showed there.
Regards.
i tried your way, but it didn't work, i think your style of coding is a bit difficult to understand, no offense, but thanks a lot for helping anyway, i think it's too complicated, they should make it way more simple, why not a simple array like mql4? 5000 pages? no way, and that's not a book, it's only a compilation that works once you already grasp the concepts.
i tried your way, but it didn't work, i think your style of coding is a bit difficult to understand, no offense, but thanks a lot for helping anyway, i think it's too complicated, they should make it way more simple, why not a simple array like mql4? 5000 pages? no way, and that's not a book, it's only a compilation that works once you already grasp the concepts.
If it is an indicator, you can use the predefined array (close [i]) inside the OnCalculate () function. That way, you do not need to use the CopyClose () function. You just have to sort the data as Series and make your loop:
My code is not complicated, it's how things are done in mql5. If you want to use CopyClose(), you have to know that the first time you call that function it is possible that the data are not synchronized (especially if you request the data of another symbol or another timeframe different from the current chart) and therefore you do not get all the data you need. Therefore, the developers recommend checking this, and if all the data has not been copied, then return and wait for the next call.
In mql4, it happens in a similar way if you request the data of another symbol or another timeframe different from the current chart. In that case you would have to use either CopyClose() (yes, it can be used in mql4, too) or iClose(), and you would have to handle errors 4066 and 4073:
4066
ERR_HISTORY_WILL_UPDATED
Requested history data is in updating state
4073
ERR_NO_HISTORY_DATA
No history data
Another thing is that you do not know anything about all this and call those functions without checking anything or checking any errors , which means that you risk that your code has numerous bugs. If you do not do it this way, or do not know how to do it, does not mean that you would not have to do it.
As for the function of opening the file, you should always check if it has been opened correctly (otherwise the function will return INVALID_HANDLE), before trying to save anything in such file. This you should do the same in mql4. The bad thing is that it seems that you still have a lot to learn (also about mql4 and not just about mql5). I hope you have the will for it.
Regards.
Here add as a new function below your code so that you can use the classic way.
You can find also on my git https://github.com/Thecreator1/MQL4-TO-MQL5/blob/master/iFunctions.mq5