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

 

I searched the whole forum, I could not find a way to automatically calculate the shift of arrows/icons in the indicator (when you switch the TF you need to adjust the offset), but I know that a few months ago someone posted a ready-made function

PLEASE! )))

 
Igor Makanu:

I searched the whole forum, I could not find a way to automatically calculate the shift of arrows/icons in the indicator (when you switch the TF you need to adjust the offset), but I know that a few months ago someone posted a ready-made function

PLEASE! )))

This?

Как увеличить размер Wingdings-символа?
Как увеличить размер Wingdings-символа?
  • 2018.09.09
  • www.mql5.com
Смотрю я на свойства. Нет там, вроде бы, нужного...
 
Artyom Trishkin:

This?

cool!

ZS: One thing I don't understand is why I searched for about 20 minutes and I thought I remembered that Vitaly posted it (I searched his posts), but you found it and I didn't (((((

 
Igor Makanu:

cool!

ZS: I don't understand one thing, why I searched for 20 minutes and remembered for sure that Vitaly posted it (I searched through his posts), but you found it and I didn't (((((

The puzzle just opens: notepad and a file called "Usefulness". What I see that might be useful to someone somewhere, and it's not trivial - I type in the link to the post and a short description. It's been like this for years... We're here to help people, not just to "look out" for order

 
Ghabo:

Thank you. My muscles are not enough) It is not difficult to fix the moment when the colour red changes to blue, but how to know that at this time, the blue line is covered by black, I have no idea. What condition should be added to it:-

to exclude the signal when the bar crosses the black line? In your screenshot count the last crossing upwards and do not count the crossing of the previous three bars.

It's easier, while the bars close above the EMA(21) line, they are written into one buffer (blue), below it they are written into another one (red). To exclude the signal of crossings of this line, at least two bars in a row should be closed either higher or lower.
For the code it would be as follows:

        bool
        b = false,
        s = false; //обе эти переменные должны быть объявлены за пределами всех блоков программы

        BUY_1=NormalizeDouble(iCustom(NULL,0,"4X Pip Snager Trend",1,1),Digits);
        
        if(BUY_1 != EMPTY_VALUE)
          {
                // первичный вход в этот блок означает, что 1 бар закрыт выше линии, но действие при этом не выполняется т. к. b == false (либо изначально, либо было сброшено в блоке else)
                // вторичный и все последующие подряд входы в этот блок означают, что, как минимум 2 бара подряд закрыто выше линии и действие будет выполнятся т. к. в предыдущем входе b присвоено значение true
                if(b)
                  {
                // ДЕЙСТВИЕ ДЛЯ СИНЕЙ ЛИНИИ
                  }     
                b = true;
                s = false;
          }
        elae
          {
                // аналогично, как и в блоке выше
                if(s)
                  {
                // ДЕЙСТВИЕ ДЛЯ КРАСНОЙ ЛИНИИ
                  }
                b = false;
                s = true;
          }
 
Igor Makanu:

cool!

ZS: one thing I don't understand is why I searched for 20 minutes and I thought I remembered that Vitaly had posted it (I searched his posts), but you found it and I didn't (((((

But this method doesn't take into account user scrolling of the chart, that's the whole point. Put the indicator on a volatile period and then scroll into a flat period, or vice versa.
In that sense it makes more sense to rely on some ATR data to calculate distance.
If you don't want to track the chart scrolling by the user to rearrange all the arrows based on the new extreme chart prices.

 
Here's an example based on a fractal. I have made 2 additional buffers. For fractal it is unnecessary, because you can just use candlestick price as a reference. But for your task this variant might be needed.
Files:
 
Nikolay Khrushchev:
Here's an example based on a fractal. Made 2 extra buffers. For a fractal, it is redundant because one can simply refer to the price of a candle. But this variant may be useful for your task.

Thank you!

yes indeed I have a much simpler task - I sign about 30 ZigZag nodes with node numbers, no text labels in the history further on


Artyom Trishkin:

The puzzle opens simply: notepad and the file under the name "Usefulness". What I see that may be somewhere useful to someone, and it is not trivial - I put a link to the post and a short description. It's been like this for years... We're here to help people, not just to "look out" for order

persuaded, in KB usefulness to fill, not to say that I am sorry, so I do not share, just accompany their codes, I am not sure that I will, and discuss what and how already tired

ZS: of the interesting and ready, about 98%:

1 . access to ZigZag vertices as an array of structures (dynamic list and operator overloading [] ), everything seems to fly and it's very convenient that you write ZZ[2].price... ZZ[i]. up = true

2. second chart by means of MT4

out of this (1-2), is there anything interesting for the forum? - or it's like everywhere else, give us a 100% ready-made code, we won't do anything on our own ((((

 
Igor Makanu:

Thank you!

yes indeed I have a much simpler task - I sign about 30 ZigZag nodes with node numbers, no text labels in the history further on


persuaded, in the KB usefulness to fill, not to say that I am sorry, so I do not share, just accompany their codes, I am not sure that I will, and discuss what and how already tired

ZS: of the interesting and ready, about 98%:

1 . access to ZigZag vertices as an array of structures (dynamic list and operator overloading [] ), everything seems to fly and it's very convenient that you write ZZ[2].price... ZZ[i]. up = true

2. second chart by means of MT4

out of this (1-2), is there anything interesting for the forum? - or it's like everywhere else, give us a 100% ready-made code, we won't do anything on our own ((((

Well, you can get something useful and sometimes even unusual from each code.

Codebase is designed for this very purpose, not for what two people do with it.

P.S. This gives me a good idea, I need to rewrite to an array of structures, somehow I didn't even think about it before.
 
Vitaly Muzichenko:
P.S. This gave me a good idea, I should rewrite it on the structure array too, I've never thought about it before.

The structure array is a bit simpler, but the functionality is lower, I did it through dynamic lists CList - the implementation is quite simple, but it's hard to get used to working with pointers in MQL, I'll try to finalize the code and post it in KB