Can someone tell me if this indicator is repainting?

 

So I wanted to use a Bollinger Band Width indicator in mt5 but the only one available for free measured it in a weird ticksize so using it in optimizations or multisymbol EAs is not possible because of the huge difference in values. So I took the one from tradingview and tried to convert it into a BBand width % indicator using the same calculation. The Problem is I am now paranoid that its repainting and I genuinely cannot tell if it is or is not. If anyone would be so kind as to try it out here is the source code below. (and if they want to use it in their own trading systems the point of it is to keep from reentering trades once a trend has run out and provide better entries.)

 

Did you use AI for conversion?

NOTE: Traders and coders are working for free:

  • if it is interesting for them personally, or
  • if it is interesting for many members on this forum.

Freelance section of the forum should be used in most of the cases.

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2025.01.17
  • www.mql5.com
The largest freelance service with MQL5 application developers
 
replace all return(0) with return(prev_calculated) to avoid repainting.

there might be other issues, but that would be first step to try.
good luck
 
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Oleksandr Medviediev #:

Did you use AI for conversion?

NOTE: Traders and coders are working for free:

  • if it is interesting for them personally, or
  • if it is interesting for many members on this forum.

Freelance section of the forum should be used in most of the cases.

I tried to but they're all crap and do whatever you imply, so if you give it the prompt "Why does this indicator repaint" and then open a new chat and say "Why doesn't this indicator repaint" it will give you two different answers for the same code so I tried it do it the way Darwinex's KAMA indicator works. It also doesn't help that I did most of it at 4am.
 
Casey Courtney: So I wanted to use a Bollinger Band Width indicator in mt5

You are over-complicating things for yourself. The Bollinger Bands "width", or more correctly "height", is just a multiple of the Standard Deviation. So, why complicate things?

You should always endeavour to understand the maths used in Indicators so that you can better understand their nature:

  • The Bollinger Bands are just the Moving Average +/- a multiple of Standard Deviation.
EDIT: Bollinger Bands does not repaint, nor does the Moving Average, nor the Standard Deviation.
     
    Fernando Carreiro #:

    You are over-complicating things for yourself. The Bollinger Bands "width", or more correctly "height", is just a multiple of the Standard Deviation. So, why complicate things?

    You should always endeavour to understand the maths used in Indicators so that you can better understand their nature:

    • The Bollinger Bands are just the Moving Average +/- a multiple of Standard Deviation.
    EDIT: Bollinger Bands does not repaint, nor does the Moving Average, nor the Standard Deviation.

      yeh I was used to coding EAs not indicators this is my first time doing anything related to indicators so... I just really wanted a version of this indicator thats available for free, however it measures its values in the ticksize of the asset so you can't use it on multisymbol EAs because of the huge differences in values. I was kind of just asking other people to test the indicator just in case they catch repainting that I'm not catching although I'm pretty sure at this point it's not repainting. Thanks for the advice though 

      Executable file removed by moderator. Attach source code only, not executables.

       
      Casey Courtney #: yeh I was used to coding EAs not indicators this is my first time doing anything related to indicators so... I just really wanted a version of this indicator thats available for free, however it measures its values in the ticksize of the asset so you can't use it on multisymbol EAs because of the huge differences in values. I was kind of just asking other people to test the indicator just in case they catch repainting that I'm not catching although I'm pretty sure at this point it's not repainting. Thanks for the advice though 
      Then just make a Normalised Standard Deviation indicator (percentage or ratio). Why bother with the Bollinger Bands in the first place?
       
      Fernando Carreiro #:
      Then just make a Normalised Standard Deviation indicator (percentage or ratio). Why bother with the Bollinger Bands in the first place?
      Because I didn't think that far ahead and am also learning multisymbol EAs while doing this lol (also I based the formula in the indicator off a trading view version so I didn't think about it too much.). Also can you not post .ex5 files only mqh files?
       
      Casey Courtney #: Also can you not post .ex5 files only mqh files?

      Currently, on the forum, any discussed or shared MQL programs should be provided as source code files. Executable files are no longer allowed.