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

 
Artyom Trishkin:

It's not very clear what you want to find. The point at which the price crosses the trend line on any bar? There are functions for that to get the value of the line on a bar. But I would use the straight line equation:


Does not require a real object

I just want to use the straight line equation. Having got the trend line coordinates I calculate the coefficient of trend increment for one bar using the formula Dy=(Yn-Yo)/n, where n is the number of bars between the start and end points of the trend line segment.

And the Expert Advisor starts controlling the chart from the moment the trend line is drawn. I.e., in fact, it will check for a crossover of the trend line on the next current bar in the point Y1=Yo+Dy. If there is no crossover, the point Y2=Y0+2*Dy of the next current bar will be checked, etc., until such a crossover is found.
I've illustrated it all in the file below because I don't know how to insert the picture in the text of my post

Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
Документация по MQL5: Доступ к таймсериям и индикаторам / Bars
  • www.mql5.com
Если указаны параметры start_time и stop_time, то функция возвращает количество баров в диапазоне дат. Если эти параметры не указаны, то функция возвращает общее количество баров. Если данные для таймсерии с указанными параметрами при вызове функции Bars() еще не сформированы в терминале, или данные таймсерии в момент вызова функции не...
Files:
p1pxls.png  10 kb
 
Mihail Matkovskij:

As I said above, sketch a source code so that you have something to build on. Especially since you already have some knowledge of how to get the object data on the graph. No one wants to do everything for you from scratch. And in this case, you may supplement what is missing for expert's work...

Michael, I'm not asking to do that, I just wanted to clarify the correctness of the algorithmic part.

And you flatter me about my present knowledge of MQL - I've just started to study it, and therefore I don't have enough knowledge even for sketching a primitive source code.

The major stumbling block for me was solving the problem of finding manually drawn trend lines on the chart and reading their parameters. You and Artem helped me in this, and thank you very much.

And then I will gradually try to write it myself and, if something fails, I will ask for help again.

 
vladmirad:

I just want to use the straight line equation. After obtaining the trend line coordinates I calculate the coefficient of trend increase for one bar using the formula Dy=(Yn-Yo)/n, where n is the number of bars between the start and end points of the trend line segment.

And the Expert Advisor starts controlling the chart from the moment the trend line is drawn. I.e., it will actually check for a crossover of the trend line by the chart starting from the first bar after the initial one, where it will check for a crossover of the trend line in the point Y1=Yo+Dy. If there is no crossover, the point Y2=Y0+2*Dy of the next current bar will be checked, etc. until such a crossover is found.
I've illustrated all this in the file below because I don't know how to embed the picture in the text of my post

It's definitely better to use the straight line equation here. The link to the function I gave just above. There are explanations there as well.

The example of crossover trading can be found in the publications of Scriptor - he published such an Expert Advisor in CodeBase.

Scriptor
Scriptor
  • www.mql5.com
С возросшим интересом к рынку Форекс, люди часто спрашивают, что можно почитать о законах функционирования мировой валютной биржи. В связи с этим, выкладываю свой список литературы для начинающих. Дополнение приветствуется :) Форекс для начинающих - А. Куликов В основу книги положен многолетний опыт Бесплатно скачать MetaTrader 5 Бесплатно...
 
Artyom Trishkin:

It is definitely better to use the straight line equation here. The link to the function I gave just above. It also has explanations.

And you can find an example of trading by crossing lines in Scriptor's publications - he posted such an Expert Advisor in CodeBase.

Once again, thank you for your prompt and professional advice, I will definitely use it.
In the meantime, I need to digest everything I've learned... :)
 
vladmirad:

Mikhail, I'm not asking you to do that, I just wanted to clarify the correctness of the algorithmic part.

It's not that you don't ask, or haven't mastered it yet, but that it is easier to refine the source code than to create it from scratch. Then the programmers on this forum will help you without any problems, because you will immediately understand the problem statement and specifics. Sometimes it's easier to look at the code than to read a verbal explanation of what the coder wants to do. Moreover, if he is a novice, he might not always manage to explain what he needs. :) Also, you must learn to program by programming. This is an obligatory way of learning for any good programmer! And no one has seen your progress yet. So if you have any questions don't hesitate to publish the source code. And then write in words what you need to do or correct.

 

Hi all. Can you tell me in which thread to complain about MT5 updates?


Endless updates with new glitches over the last couple of months, what is it about?

When I close or open a deal on one terminal, all the history on the charts appears automatically, not only on this terminal, but also on other terminals for all symbols. It is annoying. I have to delete it every time.

It is impossible to manually transfer deals to the chart one by one from the history now. If you add all of the trades, it opens a new chart with all of the history.

The EA has been changed in the latest update, it hasn't compiled anymore, it keeps getting errors.

I had the opportunity to sign objects in the properties and the inscription appeared on the screen.

it is no longer there.

 
Good afternoon, please help, I need to insert a buffer in the indicator to take data from the Expert Advisor through iCustom.
Files:
FindLevels.mq4  12 kb
 
edelweiss7:
Good day! Please help, I need to insert a buffer in the indicator to take data from the Expert Advisor through iCustom.

simply specify the buffer index to be assigned during initialisation in SetIndexBufer

 
Mihail Matkovskij:

It's not that you don't ask for it, or that you haven't mastered it yet, but that it's easier to refine the source code than to create it from scratch. Then the programmers on this forum will help you without any problems, because you will immediately understand the problem and the specifics of the task. Sometimes it's easier to look at the code than to read a verbal explanation of what the coder wants to do. Moreover, if he is a novice, he might not always manage to explain what he needs. :) Also, you must learn to program by programming. This is an obligatory way of learning for any good programmer! And no one has seen your progress yet. So if you have any questions don't hesitate to publish the source code. And then write in words what must be done or corrected.

Thank you, Michael!
As soon as I've got the source code ready, I'll be sure to use your advice!

 

Can you tell me what these errors are now? After another update.

Tried to remove first line with error out of 3 left one, deleted it too, everything complied... Testing
Reason: