Questions from Beginners MQL4 MT4 MetaTrader 4 - page 119

 
STARIJ:

See what's in the other buffers...

so there are only 8 of them on the screen.

Trying to pull data from buffers because I can't get it from files
 
Mickey Moose:

so there are only 8 of them on the screen.

Trying to pull data from buffers because it doesn't work from files

There can be more buffers in the data window - you can prohibit them with function: SetIndexLabel(1, NULL); Look at the contents of buffers zero to ten. See if the values you receive match and are visible. Move mouse cursor to the bar whose number is in iCustom function. Check how the result of the function depends on the number of parameters (default parameters). To speed up the process while debugging, use the script and Alert function instead of writing to a file. At the beginning of the script, put Alert("---------------------") will flag the last displayed values. All in all, it's very fascinating and interesting and there's a lot to dig into

 
STARIJ:

There may be more buffers in data window - you can prohibit it with function: SetIndexLabel(1, NULL); Look at the contents of buffers from zero to tenth. See if the values you receive match and are visible. Move mouse cursor to the bar whose number is in iCustom function. Check how the result of the function depends on the number of parameters (default parameters). To speed up the process while debugging, use the script and Alert function instead of writing to a file. At the beginning of the script, put Alert("---------------------") will flag the last displayed values. All in all, it's very fascinating and interesting and there's a lot to dig into

Yes, the question is how to take data from the required field using MQL4 methods. For example from alerts?

They are all in plain sight.

 
GOOD DAY ! Help or give me a tip ! There are two horizontal lines with price values ! I would like to: Write to file - Symbol, line values. Read from the file - Symbol, line values. The idea is that I build levels on the Demo terminal and then transfer the parameters to the Life terminal installed on the server!
 
Rewerpool:
GOOD DAY ! Help or give me a tip ! There are two horizontal lines with price values! I would like to: Write to a file - Symbol, line values. The idea is that the levels are built on the demo terminal and then transferred to the Life terminal installed on the server!

No one will give you vodka, everyone here is greedy :)

 
And now for my problem. The local experts remind me of my classmate (oh, how long ago it was) - he knew all the rules, all the formulas, but when to apply which one, he could not think straight, and went through almost everything, so that he never met the allocated time. It's the same here: they know a lot, but they don't see the solution, they just work by "gut feeling". At the institute, we were taught to solve a problem without numbers and formulas, and only then will you clearly know which formulas to apply. Newcomers to MKL4 do not understand the subtleties of the language, and that is where they need help (not in the sense of "read a textbook"). But no one can show you the pitfalls of opening/closing positions. Maybe they do not know? So they let my question slide...
 
novichok2018:

No one will give you vodka, everyone here is greedy :)

That's right, it's by the book.

Money in the morning, chairs in the morning.

Money in the morning, chairs in the evening.

 
novichok2018:
That's why they let my question go to waste...

So where's the question? I looked a few pages back and there isn't one.

 
Ihor Herasko:

So where's the question? Have scrolled through a couple of pages back - no.

In post 1149 there is a code for closing positions.Half solution:only if one type of position is opened. If, for example, one Sell position has been opened and is not yet closed, at the same time a Buy position is opened and closed, the Sell position cannot see any conditions to be closed before another Sell position opens and closes (in accordance with its conditions). And if BAY opens and closes again, it again misses its closing conditions. So what to do?

 
novichok2018:

In post 1149 code for closing positions.Half solution:only if the same type of positions are opened. If, for example, first a Sell position opens and has not yet closed, and at the same time a Buy position opens and closes, then the Sell position does not see its closing conditions until another Sell position opens and closes (according to its conditions). And if BAY opens and closes again, it again misses its closing conditions. So what to do?

Yep, I can see that. And I see the answer to the question in the post belowhttps://www.mql5.com/ru/forum/160587/page115#comment_6521492. In other words, the problem is that the functionality is not divided into logical subtasks. You have lumped together: parsing orders, deciding on a trade action and executing a trade.

Such a task can be solved exactly in three stages:

  1. Gathering information about orders to be monitored by the program. This is just the loop of order evaluation, which you already have. The result of this cycle must be the array of orders.
  2. Calculation of trading signals. The calculation result is a command to open and/or close orders. It depends on the trading strategy. Previously, when there was no enumeration, I used codes: 0 - no signal, 1 - open Buy, -1 - open Sell, 2 - close Buy, -2 - close Sell.
  3. Execution of one trade operation. If there is a trade signal and one of the orders (point 1) fits it, one trade operation is performed. After that, the entire algorithm is restarted starting from point 1. In some cases, you even exit OnTick in order to continue on the next tick.
Вопросы от начинающих MQL4 MT4 MetaTrader 4
Вопросы от начинающих MQL4 MT4 MetaTrader 4
  • 2018.02.09
  • www.mql5.com
Если у Вас вопросы по MQL4, MT4, MetaTrader 4, пожалуйста пишите в этой теме. Особенно когда вопросы касаются торговых функций...
Reason: