BandWidth - Bollinger Envelope: no error when compiling, yet cannot divide by buffer (no line drawn on indicator window).
My issue: when trying to draw the line, no line is to be seen. The formula is (UpperBB - lowerBB) / middleBB.
It is a zero divide error.
I've not looked too closely at your code, but
if(ExtMovingBuffer[i]!=0 && ExtMovingBuffer[i]!=EMPTY_VALUE) ExtWidthBuffer[i]=(ExtUpperBuffer[i]-ExtLowerBuffer[i])/ExtMovingBuffer[i];
Will prevent the error
Hi GumRai,
thanks a lot for looking at it.
I am not quite sure that's the issue. If you exchange the division sign by a multiplication one, you'll get a perfectly working indicator with no places where the value is 0.
I am not quite sure that's the issue. If you exchange the division sign by a multiplication one, you'll get a perfectly working indicator with no places where the value is 0.
Are you sure about that?
try this
ExtWidthBuffer[i]=(ExtUpperBuffer[i]-ExtLowerBuffer[i])*ExtMovingBuffer[i]; if(ExtWidthBuffer[i]==0) Print(i);
I think that you will see that there are zero values
Did you try my suggestion that I posted?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am trying to recreate the BandWidth indicator for the Bollinger Envelope (not BBands, but Envelope).
I am still struggling with the not normalized version. See code below.
My issue: when trying to draw the line, no line is to be seen. The formula is (UpperBB - lowerBB) / middleBB.
I tested around - if I delete the last part and leave it as (UpperBB - lowerBB), then the line gets drawn. It seems that the division by the buffer seems to mess up everything.
Anyone has an idea?
Code here: