Custom indicator for ATR and Bollinger not drawing

Back to topics list To post a new topic, please log in or register
avatar
27
jfortes 2015.09.15 08: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. 

Attached files:
  atr_bb.mq4  (3.12 KB)
avatar
Moderator
3404
GumRai 2015.09.15 10:20 #
 
The lines are drawn on my platform
avatar
27
jfortes 2015.09.15 11: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 ?

avatar
Moderator
3404
GumRai 2015.09.15 12: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
avatar
27
jfortes 2015.09.15 13:35 #
 
Here's how my chart looks. Indicator window just shows a flat line in grey :(  ATR_BB_no drawn 
avatar
27
jfortes 2015.09.15 13:36 #
 
Has anyone seen this strange behaviour before ?
avatar
Moderator
3404
GumRai 2015.09.15 14: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;

 

avatar
27
jfortes 2015.09.15 15: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. 

Back to topics list  

To add comments, please log in or register