Download MetaTrader 5

Custom indicator for ATR and Bollinger not drawing

To add comments, please log in or register
You sell neither signals nor apps? No problem, everyone can make profit!
John
79
John 2015.09.15 06:50 

Hi, I've developed the following custom indicator. The values in the data Window are shown alright, but the indicator does not draw anything.

Here's the code. Can you anyone help me please ? Thanks. 

Files:
atr_bb.mq4 4 kb
Keith Watford
Moderator
9614
Keith Watford 2015.09.15 08:20  
The lines are drawn on my platform
John
79
John 2015.09.15 09:03  
GumRai:
The lines are drawn on my platform

Thanks for the confirmation. Strange thing, could it be a version related problem ?

My MT is version 4.0 Build 840 (12 June 2015). And yours ?

Keith Watford
Moderator
9614
Keith Watford 2015.09.15 10:43  
jfortes:

Thanks for the confirmation. Strange thing, could it be a version related problem ?

My MT is version 4.0 Build 840 (12 June 2015). And yours ?

Same
John
79
John 2015.09.15 11:35  
Here's how my chart looks. Indicator window just shows a flat line in grey :(  ATR_BB_no drawn 
John
79
John 2015.09.15 11:36  
Has anyone seen this strange behaviour before ?
Keith Watford
Moderator
9614
Keith Watford 2015.09.15 12:11  

The problem is your Buffer_VB.

If you just need it to show a value in the data window or nothing, don't fix it to 1.0

This means that with 4 or 5 digit symbols the other buffers are too close together and just appear as a single straight line. 

Instead of

      if(Buffer_ATR[shift] > Buffer_BB_main[shift])
      {
         Buffer_VB[shift] = 1.0;
      
      }

 do

      if(Buffer_ATR[shift] > Buffer_BB_main[shift])
         Buffer_VB[shift] = Buffer_ATR[shift];
      else
         Buffer_VB[shift] = EMPTY_VALUE;
John
79
John 2015.09.15 13:13  
GumRai:

The problem is your Buffer_VB.

If you just need it to show a value in the data window or nothing, don't fix it to 1.0

This means that with 4 or 5 digit symbols the other buffers are too close together and just appear as a single straight line. 

Instead of

 do

 

You are totally right. It's the 1.0 value that is out of scale, making the ATR & BB look flat.

Fixed as per your suggestion and is working fine :)

 

Thanks so much for your help. 

To add comments, please log in or register