MQL4: How to find if an Indicator Repaints

Repainting Indicators: A Big Problem

Sometimes when we see the final result of an indicator it appears too good to be true. Simply amazing that it could predict so well. But when we use it in real-time, we realize that the indicator massively repaints. So, we should have a way of finding it out beforehand, so we don’t use the indicator’s results on our real accounts.

This post shows how to find a repainting Arrow Indicator. But the same logic can be applied to other types of indicators. I have taken the Binary Viper Indicator as an example and used a wrapper indicator to check how much it repaints.

How does the Wrapper work?

It’s very simple. Wrapper Indicator just fills the buffer values and draws the arrows as they appear on original indicator. And it does not change the arrows even if the original indicator deletes them. As you can see in this image, the yellow arrows show everytime BinaryViper redraws the arrows and the Red Arrow is the final Down arrow in BinaryViper.

As you can see, it repainted 15 times before settling on a final down arrow (red).

How to Use:

To use the wrapper on your own arrow indicator just replace this code with your own indicator name:

double arrow_up = iCustom(NULL, 0, "Binary Viper v2.00", 0,i);
double arrow_down = iCustom(NULL, 0, "Binary Viper v2.00", 1,i);

Just use it with an empty expert advisor to see the results quickly.


You may also like...

5 Responses

  1. Bruce says:

    Nice post. But many indicators repaint “current bar”. Can you add another option to show only repaint arrows if an indicator changes for “previous bars”

  2. Avery Horton says:

    There’s a huge difference between repainting and updating in real time!!

    • Cip says:

      It really does not matter if you name it ” repainting”, “updating in real time”, recalculating. It is misleading and it is a marketing tactic that is a big lie. So this post is valid in all aspects.

      • Abir says:

        I agree with you 🙂
        But for those who need to turn current bar check off. And only check bar 1 onwards can set i=1 in code here:
        for(int i=0; i<limit; i++)
        for(int i=1; i<limit; i++)

        This will ignore current bar value. And use IsNewBar() function to run the code only once every new bar.

Leave a Reply

%d bloggers like this: