Do you have a solution for the flickering problem encountered when writing ZIGZAG type indicators on MT5? Is it a logic problem for MT5 to render the indicator buffer? - page 4

 
Alain Verleyen #:

How to reproduce the problem ?

And what is the solution ?

Please refer to 1#
 
Kaijun Wang #:
In the process of writing many MT4 and MT5 indicators, there is still a pitfall:
If you use ArraySetAsSeries(BuffXXX,true) to write indicators in MT5 to set the same K-line sequence logic code as MT4, if the code is free of any errors, MT5 may have data confusion and indicators display abnormally.
The solution at this time is to use the sequence logic of MT5 to rewrite a copy, so that there will be no more problems with confusing indicators on the chart.
Can you explain this further, I have used both Series true and false, by Data Confusion you mean?
 
Thank-god Avwerosuoghene Odukudu #:
Can you explain this further, I have used both Series true and false, by Data Confusion you mean?

I just give an example. If it is not normal to write according to the MT4 sequence, you can try to use the MT5 sequence to write. Generally, it can be solved.

 
Kaijun Wang:


Are you using the iBarShift function in your code (inside the OnCalculate function)?

 
Nikolai Semko #:

Are you using the iBarShift function in your code (inside the OnCalculate function)?

No, I also suspected that IBarShift had an impact before, so I removed this relevant code

 
Kaijun Wang #:

No, I also suspected that IBarShift had an impact before, so I removed this relevant code

Ok.
Judging by the animated GIF, you are reinitializing the entire buffer under a certain condition and this happens quite often instead of just once. When debugging, set a breakpoint in the entire chart reinitialization block and you will be able to catch the moment when this happens, except at the beginning of the indicator.

 

Flickering is a common issue when writing ZIGZAG-type indicators in MT5, and it can be caused by a number of factors, including the way the indicator is programmed and the settings of the chart. Here are some possible solutions:

Use the "nolag" option: One way to reduce the flickering in a ZIGZAG-type indicator is to use the "nolag" option. This option is available in some ZigZag-type indicators and can help to smooth out the chart and reduce flickering.

Optimize the indicator's settings: The settings of the indicator can also affect the flickering. You may want to experiment with different settings, such as the "depth" and "deviation" parameters, to find the optimal settings for your particular chart.

Use a different type of indicator: If flickering continues to be an issue, you may want to consider using a different type of indicator, such as a moving average or a trend line. These indicators can help to identify trends and price movements without the flickering associated with ZigZag-type indicators.

Regarding your question about whether the flickering is a logic problem for MT5 to render the indicator buffer, it's possible that the flickering is caused by the way the indicator is programmed or the settings of the chart, rather than a problem with MT5 itself. However, without more information about the specific issue you are encountering, it's difficult to say for certain.

Have you tried any of these solutions for reducing the flickering in your ZigZag-type indicator, and if so, which one(s) have worked best for you?



 

Until code is provided to reproduce this issue, nothing can be done to check if MT5 itself is implied.

Full code that compiles and possibly a procedure how to reproduce the issue if it's not systematic.

 
Alain Verleyen #:

Until code is provided to reproduce this issue, nothing can be done to check if MT5 itself is implied.

Full code that compiles and possibly a procedure how to reproduce the issue if it's not systematic.

I already have a solution, and I also know that it is because of the problem of the OnCalculate function. The solution is to give up using any complex calculations in OnCalculate.

At present, I don’t think there is a problem with my code. I have tested MT4/MT5 many times. You can see that most of my indicators are the same logic. I have two identical MT4/MT5 indicators. I have tried many MT4->MT5 indicators. , when the code is exactly the same, the ZIGZAG of MT5 will flicker. This needs to be solved by the solution I mentioned at the beginning (thanks to 1# for the inspiration, I suspected that the data update is not fast enough, so I just put the calculation again One copy to OnTime).

On the issue of ZIGZAG flickering, MT4's ZIGZAG and MT4's object refresh will not have the feeling of refreshing (that is, data changes and refilling of CANVAS fillings), and on MT5, the entire ZIGZAG will be seen by the eyes. The process from scratch, OBJ_BITMAP_LABEL filled with CANVAS is the same, there will be a process from scratch when refreshing.

At the same time, its refresh flashing is also related to the data filling order of MT5. Filling from the left or filling from the right will affect the order of its update. These fillings will change after filling on MT4, and will not let you see the process Yes. And MT5 allows us to see the process time from the beginning to the end of the filling, so that the object waiting to be filled has been in the state of clrNone waiting to be filled, and it will not reappear until it is finally filled. This is the ZIGZAG used in the MT5 indicator DRAW_SECTION is the result of the drawing, and OBJ_BITMAP_LABEL is filled with CANVAS as well.

 
Kaijun Wang #:

I already have a solution, and I also know that it is because of the problem of the OnCalculate function. The solution is to give up using any complex calculations in OnCalculate.

If you really want anyone to consider this you need to post some code that produces the issue keep saying you have a solution to an unproven problem is pointless

I have no such issue
Event timers can also be inaccurate 
Other times people have been on here about flickering it has been down to their graphics card/drivers
Reason: