Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 822
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
Good day to all forum users! Met with the problem, the second day headache, I can not figure out how to implement the idea! How to draw a rectangle, a circle, an oval (no matter what figure) on a certain candlestick, not to redraw it by new coordinates. And what if some conditions trigger a figure? Each figure on its own candlestick. I am just recently started studying mql4, so I'm not familiar with charting. I decided yesterday to try to print a square on the 10th bar (as an example). I got one and it's not drawn anymore. Yesterday, I poked and poked the code, and eventually it worked, but the square is constantly erased in its old place and drawn in a new one, then bothered that the output square only once. Hint who knows how to implement it! Or advise where there is a branch on the forum. Aka already read a bunch of information, just more confused! Thanks in advance for the answers!
a universal way to 'sunset the sun by hand' - overlay a canvas on the chart and draw over it. By shifting what is drawn when new bars are opened or the chart is shifted. But it is long and bothersome
A fast way to mark - place Arrows or captions on a candlestick - with a timebase. Then the terminal shifts everything as it should.
You cannot place a time-bound rectangle around a separate candlestick in 4. The only way to do it is to hit its "neighbours". This is not always nice and suitable. That leaves me with RectLabel linked to the screen. But, again, the coordinates should be recalculated for each new bar or chart scrolling/scaling.
Good afternoon to all forum users! Faced with a problem, the second day headache, I can not figure out how to implement the idea! How to draw a rectangle, a circle, an oval (no matter what figure) at a certain candle, not to redraw in new coordinates. And what if some conditions trigger a figure? Each figure on its own candlestick. I am just recently started studying mql4, so I'm not familiar with charting. I decided yesterday to try to print a square on the 10th bar (as an example). I got one and it's not drawn anymore. Yesterday, I poked and poked the code, and eventually it worked, but the square is constantly erased in its old place and drawn in a new one, then bothered that the output square only once. Hint who knows how to implement it! Or advise where there is a branch on the forum. Aka already read a bunch of information, just more confused! Thanks in advance for the answers!
The easiest thing to do is to carefully read the documentation on the language and understand that the object name must be unique. For example, in the name of the object, put the opening time of the desired bar.
Is there a difference between using the period identifier (PERIOD_H4) and its numeric value (240). For example, if the EA is 2TF. ?
It is better to get used to PERIOD_** type format, because PERIOD_H4 in mql5 is not equal to 240, but you will still need to switch to mql5. And it is more informative. For example, do you remember how many seconds are in a week or month? For me personally I still have to calculate it, while PERIOD_W1 is easily understood.
Is there a difference between using the period identifier (PERIOD_H4) and its numeric value (240). For example, if an EA 2TF. ?
Use an enum value - this will save you problems when upgrading to MQL5
The easiest thing to do is to read the language documentation carefully and understand that the object name must be unique. For example, put the opening time of the desired bar in the object name.
Thanks for the tip, I'll give it a try!
If there are several open positions for one instrument and the EA only needs to be run to follow one of them, is there any way to select a ticket when it is run, so you don't have to write it by hand?
If there are several open positions for one instrument and the Expert Advisor needs to run only to follow one of them, is there any way to select a ticket when running it, so as not to write it by hand?
Use magik - that's what it's for.
But if all positions are opened manually, then, of course, the Expert Advisor should somehow know which position to follow - only the ticket will help. And in order to make a choice of ticket when the EA starts - then it must look through all open positions, make a list of their tickets and offer you a window with the selection of the necessary ticket - it is easier to manually enter in the settings.
Use Magik - that's what it's for.
But if all of the positions are opened manually, then of course, the Expert Advisor should somehow know which position to follow - only the ticket will help here. And in order to make a selection of the ticket when the EA starts - then it must look through all open positions, make a list of their tickets and offer you a window with the selection of the necessary ticket - it is easier to manually enter in the settings.
It's cumbersome to fill in the numbers, isn't it? Can we create a library in which to write a selection of tickets in an array, and then somehow feed it to the EA?
It's cumbersome to fill in the numbers. Is it possible to create a library in which to write a selection of tickets in an array, and then somehow feed it to the Expert Advisor?
Yes, we can. But do you need it? It is not a one-time thing.
You can read an order ticket (if there is its icon on the chart) by clicking on the order icon with the mouse.