Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 482
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
@STARIJ Thanks, I took my time writingObjectSet! It has long been written, not commented, and the code does not interfere! You wroteStringSubstr(str,20,7) , I didn't think it was all literal! After dinner, I realised it was all about the spaces! I should have counted every character and space! Thanks friend!!!!
Hello, dear friends. Another question from an μl4 newbie. I use the Fun_New_Bar() function recommended in the tutorial to define a new bar:
However, for some reason it does not always work. I've put in a print check:So, it opens a position on a new bar, then prints "No new bar" and opens a position on the current bar. I cannot understand why. Thank you.
Hello, dear friends. Another question from an μl4 newbie. I use the Fun_New_Bar() function recommended in the tutorial to define a new bar:
However, it somehow does not always work. I put in a print check:So, it opens a position on a new bar, then prints "No new bar" and opens a position on the current bar. I cannot understand why. Thank you.
How do you distinguish between New bar and Current bar? How often is this part of the code executed - every tick or only when a new bar is formed?
how do you distinguish between New bar and Current bar? How often is this part of the code executed - every tick or only when a new bar is formed?
New bar - by function. The Current bar - in which a position has been closed, but the bar time has not expired. The code must be executed at the moment of anew bar forming.Or rather, not so. The part of the code where the conditions for closing the position are defined is executed every tick, while those for opening the position are executed in a new bar.
New bar - by function. Current - where the position has been closed but the bar time has not expired. The code must be executed at the moment when thenew bar is formed.Or rather, it is not. The part of the code where the conditions for closing the position are defined is executed every tick, while the condition for opening the position is executed in a new bar.
So, everything is clear here. But when you are writing and see that you should write it more precisely, move the cursor back and correct. Otherwise it is hard to read it this way and that way.
The code is executed with every tick. I.e. the question "Is there a new bar? Is there a new bar? Is there a new bar? and each time a message is printed that there is no new bar. And then there is a new bar. The order opens? First a command is sent to the server. And then the ticks come in and there's a new bar? There is a new bar and every time there is no new bar, the server finally opens an order and you look at the time and wonder what time it is. You can use Print(TimeCurrent()) before the opening of an order, 4 lines below the first one. Or better yet, use Alert - right on the screen. You can see at a glance.
One more thing: instead of if(New_Bar==false) if(New_Bar==true), you may use if(!New_Bar) if(New_Bar) otherwise you get buttery oil
In short, everything is clear here. But when you write and see that you need to write more precisely, bring the cursor back and correct it. It's hard to read it this way and that way.
The code is executed with every tick. I.e. the question "Is there a new bar? Is there a new bar? Is there a new bar? and each time a message is printed that there is no new bar. And then there is a new bar. The order opens? First a command is sent to the server. And then the ticks come in and there's a new bar? There is a new bar and every time there is no new bar, the server finally opens an order and you look at the time and wonder what time it is. You can use Print(TimeCurrent()) before the opening of an order, 4 lines below the first one. Or better yet, use Alert - right on the screen. You can see at a glance.
And one more thing: instead of if(New_Bar==false) if(New_Bar==true) you may use if(!New_Bar) if(New_Bar) otherwise you will get oil
Ok, everything is clear with the message about absence of a new bar. The time of order opening displayed in the journal by the platform is sufficient for me even without an additional print. However, I still do not understand why an order is opened on a new bar once and on the current one the second time, although according to the code, a new bar should appear before looking for conditions to open the position.
OK, everything is clear with the message about the lack of a new bar. The time of order opening printed in the log by the platform is sufficient for me even without the additional print. However, I still do not understand why the order opens on a new bar once and on the current one the second time, although according to the code, a new bar should appear before looking for conditions to open the position.
First, a command is sent to the server. In the meantime, the ticks come and Is there a new bar? There is a new bar and each time there is no new bar, the server finally opens an order and you look at the time and wonder. You can use Print(TimeCurrent( )) before the opening of an order, 4 lines below the first one. Or better yet, use Alert - straight to the screen. You can see at a glance... the command to open the order was sent earlier, on the new bar
Can you tell me how to make it possible to have a shading colour between the 2 indicator lines?
As in ishimoku
Can you tell me how to make it possible to have a shading colour between the 2 lines of the indicator? As in the ishimoku
Take a look at how it's donethere... And the terminal probably has...
Hello, I have started to study MQL4 using the 2013 video tutorials, I have been rewriting the code exactly from the video, adding some minor changes from another one, as I need them. As a result I get 25 errors. I have tried to look for solution to these errors, but since build of terminal has changed and some changes in coding have occurred. I will be grateful if someone can help me to edit the code or at least give me some useful advice, thanks in advance.