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

 
ZZuretc: Mm-hmm. Yeah, the "hat" is a bit of a mystery. I've been poking around, I can't figure it out. I'll look at the prints, it'll make more sense.

Send me all the code in your inbox or post it here. I'll have a look. The correction on EURUSD seems to be over... And let me know what I need. I've been watching it for a while...

 
ZZuretc:

Mmmm... Yeah... "hat's a big deal". Did all the poking around, couldn't find the answer I was looking for. I'll look at the prints, it's clearer that way.

Here is a screenshot of the moment of debugging. Breakpoint is on line 15

Forum on trading, automated trading systems and strategy tester

We suggest to use MT5 as a terminal for programmers, not for traders

Alexey Viktorov, 2018.01.09 18:57

You should not use LASTBAR_DATE I have understood it very well. All the rest is evil.

iBarSift() returns bar number with specified time, indexing starts from zero.

Bars() returns the number of bars from date to date. Like in all other functions, such as OrdersTotal() PositionsTotal() and others, the number of bar with the specified time will be minus 1.

As you can see from the example, the function is also available in mql4

 
ZZuretc:
What does LASTBAR_DATE have to do with it?

Nothing to do with it at all. The words there are addressed to you.

Alexey Viktorov:

Here's a screenshot of the moment of debugging. The breakpoint is on line 15.

In general, help on the meta-editor describes it all very well.

 

Hello) Help me out here. The Expert Advisor draws two types of objects from the file - vertical and horizontal lines. The Expert Advisor has three buttons: 1 - delete all lines, 2 - delete horizontal lines, 3 - delete vertical lines. I want to make that on button release lines removed by pressing the corresponding button will be drawn again - 1 - all, 2 - horizontal, 3 - vertical. Which way to go? Write a complete cycle While on each push to open the file with the data and then re-create the corresponding object? I don't understand how to do it correctly. What direction to dig?

 
Юра куксов:

Yes, and this is not - until the next tick, etc., until this condition is true, at which point what you have written in this condition will be fulfilled. That is, its body. Like this?!

Yura, keep writing here. It's more interesting there.

 
WinProject:

Hello) Help me out here. The Expert Advisor draws two types of objects from the file - vertical and horizontal lines. The Expert Advisor has three buttons: 1 - delete all lines, 2 - delete horizontal lines, 3 - delete vertical lines. I want to make that on button release lines removed by pressing the corresponding button will be drawn again - 1 - all, 2 - horizontal, 3 - vertical. Which way to go? Write a complete cycle While for each push to open the file with the data and then re-create the corresponding object? I don't understand how to do it correctly. What direction should I dig in?

I think we should dig in the direction of button properties

if(ObjectGetInteger(0, name, OBJPROP_STATE) == true) // кнопка нажата

And, we may have to add a sequence flag. To be able to formulate a condition, was pressed became pressed and vice versa, was pressed became pressed.

 
Alexey Viktorov:

I think we need to dig into the properties of the button

And we may have to add a sequence flag. To be able to formulate a condition, was pressed became pressed and vice versa, was pressed became pressed.


Thank you, I must not have phrased my question quite well. It's not clear how to rationally redraw the objects deleted by pressing the button. And attaching the code I need to the button press is not a problem.

 
WinProject:

Hello) Help me out here. The Expert Advisor draws two types of objects from the file - vertical and horizontal lines. The Expert Advisor has three buttons: 1 - delete all lines, 2 - delete horizontal lines, 3 - delete vertical lines. I want to make that on button release lines removed by pressing the corresponding button will be drawn again - 1 - all, 2 - horizontal, 3 - vertical. Which way to go? Write a complete cycle While on each push to open the file with the data and then re-create the corresponding object? I don't understand how to do it correctly. What direction to dig?

Instead of deleting an object, you can make its colour as a background - it will hide. You can hide them off the screen and then arrange them. The data from the file can be saved in an array of structures. If the file changes frequently, you can check when it was created. If the object appears again when the button is released - it will be absent only for the time the button is pressed...

 
WinProject:

Thank you, I probably didn't formulate the question quite right. It's not clear how to rationally redraw objects deleted by pressing the button. And attaching the code I need to the button press is not a problem.

In this case there is not enough information.

Although, you can keep the times of vertical lines in the array and the prices of horizontal lines in another array. But the goal is abstract and the solution may be wrong.

 
Is there a function that returns the type of variable?

For example, you write.

int a=10;

then you write:

functia(a);

and it says: INT!

:)
Reason: