How to avoid Repainting?

 

Hello


I'm wondering if anyone has a good solution for indicators that repaint?


so far I have been using the following code to avoid it but I'm pretty sure that someone out there has probably figured out a better way to do it,



  double PSAR=iSAR(Symbol(),PERIOD_M5,0.04,0.2,1);

  double PSAR_DELAY=iSAR(Symbol(),PERIOD_M5,0.06,0.02,2);

  double MA=iMA(Symbol(),PERIOD_M5,1,0,MODE_SMA,PRICE_CLOSE,1);

 double MA=iMA_DELAY(Symbol(),PERIOD_M5,1,0,MODE_SMA,PRICE_CLOSE,2);


if (PSAR < MA && PSAR_DELAY > MA_DELAY)

{

Alert("Up trend");

}



if anyone has any ideas, or maybe examples in the codebase, that would be muchly appreciated.


thanks

 

Hi

What do you mean by repaint I don't understand? Do you mean the whole indicator redraws itself across the screen with every tick or that the front end flaps around with every tick?

From your code it looks like you are trying to prevent false signals by using closed bars that don't change anymore and that is correct.

Reason: