Questions from Beginners MQL5 MT5 MetaTrader 5 - page 740
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
I'm just duplicating the question here, no one is answering in the indicators...
I have started studying MQL5. I am not experienced in programming and therefore I have some questions and doubts. Some of them can be solved by myself, by analyzing examples and partly by 'gut feeling', but some aspects are difficult to understand right away. I started to study a simple thing - to have two toollines displayed in the main chart window. I draw the Close for the current and additional (related, the note will follow) instrument for the current timeframe by 1000 bars backwards. The related instrument is the futures of the next series, it is illiquid and always has some gaps in the data, i.e. the number of deals is not as frequent as in the main futures series. The task would seem to be accomplished, but there are errors. I can't say whether smoothing is useful, so I used iMA with period 1, so that if necessary it can be smoothed without rework.
Here are the questions:
1. When compiling, when I copy the iMA buffer to an array, I see a warning "possible loss of data due to type conversion". What is this and why, what type conversion are we talking about? The lines are drawn normally and nothing seems to be missing.
2. after the indicator has worked and the lines of the two instruments appear on the main chart window, I see that they are not synchronized. I.e. the first instrument is normal and corresponds to the candlestick chart of the main window. The second (less liquid) has gaps and therefore it is gradually "squeezed", causing the desynchronization. I need it to be synchronized in time somehow. This is so far beyond my capabilities. I have to see it visually to understand what is missing.
Here is a screenshot of what it looks like. The yellow line is what needs to be synchronized relative to the green line. So that the yellow line, where the gaps in the dates are just "connections" of the previous values to the next, rather than a squeeze with missing dates. The code is in the attachment.
I'm just duplicating the question here, no one is answering in the indicators...
I have started studying MQL5. I am not experienced in programming and therefore I have some questions and doubts. Some of them can be solved by myself, by analyzing examples and partly by 'gut feeling', but some aspects are difficult to understand right away. I started to study a simple thing - to have two toollines displayed in the main chart window. I draw the Close for the current and additional (related, the note will follow) instrument for the current timeframe by 1000 bars backwards. The related instrument is the futures of the next series, it is illiquid and always has some gaps in the data, i.e. the number of deals is not as frequent as in the main futures series. The task would seem to be accomplished, but there are errors. I can't say whether smoothing is useful, so I used iMA with period 1, so that if necessary it can be smoothed without rework.
Here are the questions:
1. When compiling, when I copy the iMA buffer to an array, I see a warning "possible loss of data due to type conversion". What is this and why, what type conversion are we talking about? The lines are drawn normally and nothing seems to be missing.
2. after the indicator has worked and the lines of the two instruments appear on the main chart window, I see that they are not synchronized. I.e. the first instrument is normal and corresponds to the candlestick chart of the main window. The second (less liquid) has gaps and therefore it is gradually "squeezed", causing the desynchronization. I need it to be synchronized in time somehow. This is so far beyond my means. I have to see it visually to understand what is missing.
Here is a screenshot of what it looks like. The yellow line is what needs to be synchronized relative to the green line. So that the yellow line, where the gaps in the dates are just "connections" of the previous values to the next, rather than a squeeze with missing dates. The code is in the attachment.
The indicator handle must have int type. Example see here:CopyBuffer
The indicator handle must be of int type. Example see here:CopyBuffer
Right, I missed that point, the compilation error is gone, thanks!
But the main problem at the moment is the timing difference, it is still relevant. Without its solution it will be impossible to perform, for example, mathematical operations between the tools, which I plan to test.
Right, I missed that point, the compile-time error is gone, thanks!
But the main problem at the moment, the timing issue, is still relevant. Without solving it, it would be impossible, for example, to perform mathematical operations between instruments, which I plan to test.
If I were you I would start with proper coding - the thing is that your style now is reckless "quadruple" - that is, there are no checks, everything is at random.
Start fixing OnInit():
If I were you, I'd start by writing the code correctly - the thing is, your style is now a reckless "quaternary" - i.e. no checks, everything at a whim.
Start correcting OnInit():
So who told you, friend, that you can't staple on a five and write beautifully on a four?
It's not about the PLATFORM, it's about the head of the particular scribe...
Professor Preobrazhensky was right when he said that it's not in the toilets, it's in the heads...
If I were you, I'd start with proper code writing - the thing is that your style is now a reckless "quaternary" - that is, there are no checks, everything is on the off-chance.
Start correcting OnInit():
Well, now I'll know what my style is called) True, I'm starting right from version 5, from scratch)
Thanks, I've corrected points 1 and 2. The whole snag is in the calculation block. I will think how to prescribe the location of bars of two instruments in accordance with the time. Otherwise there is a lag and the same warning #4806.
Well, now I'll know what my style is called) Really, I'm starting right from version 5, from scratch)
Thanks, I fixed points 1 and 2. The whole snag is in the calculation block. I will think how to prescribe the location of the bars of two instruments according to the time. Otherwise a lag and the same warning #4806.
That's right! Because, for example, M1 futures "A" has bars at 13 minutes, 14 minutes and 15 minutes. But futures "B" has bars at 13 minutes and 15 minutes only - i.e. a gap. There were articles somewhere, search by the word "hole".
Good afternoon.
Can you please tell me how to find the price of the trend line for the current bar? Tried via ObjectGetDouble, but it doesn't give the desired result. Example code:
Good afternoon.
Can you please tell me how to find the price of the trend line for the current bar? Tried via ObjectGetDouble, but it doesn't give the desired result. Example code: