Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 997

 

In which event should the stop-limit be caught?

I.e. for example:

1. an order is open, put a stop and a take.

SL = FALSE

TP = FALSE

2. Stop-limit triggers

change the variable

SL = TRUE

 
Iurii Tokman:

Thank you. How do I change the colour of the EA name on the chart?

 
yiduwi:

Thank you. How do I change the colour of the EA name on the chart?

print the name at the top, in the same font but in a different colour

 

Good afternoon,


Has anyone come across this :


1. I converted an EA from mql4 to mql5. I did not write my EA without OOP. The compilation is going well, no errors or warnings. There is only about 3000 lines of code with a lot of arrays, since it has not used OOP.

2. I am running the MT5 tester and some parts of the code do not enable at all (graphical objects do not appear). Some code parts do not work properly. For example, this second zigzag in the first picture (two zigzags with different depth):

the zig-zag is not working properly




3. I put a print where the lines of the zigzag are drawn:

print



4. And now the zig-zag starts working correctly. The red down arrow that was supposed to be in the first picture also appears here.

right

And the prints are correct:

prints






Here is only one example. There are also code fragments which are switched on after compilation and then don't work after compilation.



The whole code should be converted into OOP ?

 
Tj1:

Good afternoon,

Has anyone come across this :

1. I converted an EA from mql4 to mql5. I did not write my EA without OOP. The compilation is going well, no errors or warnings. There is only about 3000 lines of code with a lot of arrays, since it has not used OOP.

2. I am running it in the MT5 tester and some parts of the code do not work at all (graphical objects don't appear), some parts of the code do not work correctly. For example, this second zigzag in the first picture (two zigzags with different depth):

3. I put a print where the lines of the zig-zag are drawn:

4. And now the zig zag starts working correctly:

And the prints go right :

This is just one example. There are some code fragments which are turned on after compilation and some which don't work after compilation.

Does all the code need to be converted to OOP ?

No.

In drawLine() at the very end before the closing parenthesis write ChartRedraw();

 
Artyom Trishkin:

No.

In drawLine(), write ChartRedraw() at the very end before the closing parenthesis;


I apologise for writing in the wrong place.


I put it in:

redrau




It draws differently now, it's still wrong :


hz

 
Artyom Trishkin:

No.

In drawLine(), write ChartRedraw() at the very end before the closing bracket;


Thanks for the quick response, I didn't expect it.

 
Artyom Trishkin:

No.

In drawLine(), write ChartRedraw() at the very end before the closing parenthesis;


You should have usedChartRedraw(0);

That's it, it works. Thanks a lot !!!!

 
Artyom Trishkin:

No.

In drawLine() at the very end before the closing parenthesis write ChartRedraw();



The bottom line is that it doesn't work.

Once compiled, logic works correctly and graphical objects are drawn correctly. The second time you compile the logic does not work.

 
In online the indicator works fine, but in the tester (mt4) it does not display correctly... During initialisation in the tester it starts fine, but then it does not work as it should. What is the reason?