what problem with this indicator

 

hi,,

what problem with this indicator

i try use this

 bool up = iCustom(0,0,"OSCILLATOR",0,1)< 5000;
  bool down = iCustom(0,0,"OSCILLATOR",1,1)< 5000;
   bool down2 = iCustom(0,0,"OSCILLATOR",2,1) < 5000;


i want if bar green ==> buy

if red sell

but in this line

 bool up = iCustom(0,0,"OSCILLATOR",0,1)< 5000;

all the time show true ...!!! 

but this line work good

  bool down = iCustom(0,0,"OSCILLATOR",1,1)< 5000;

some time show true and false

how fix this problem ? 

sorry my English not good :(

Files:
oscillator.ex4  40 kb
 
any update ?
 
  1. We humans can't read an ex4, only a mt4 and there are no mindreaders here.
  2. The first paremeter to iCustom is a string. "0" is not a string. If you want the current chart, use NULL.
  3. The second from the last is the buffer index. We can't know if buffer index 1 is correct.
  4. We can't know what values the indicator produces, so less than 5K may always be true.
  5. Detailed explanation of iCustom - MQL4 forum
 
WHRoeder:
  1. We humans can't read an ex4, only a mt4 and there are no mindreaders here.
  2. The first paremeter to iCustom is a string. "0" is not a string. If you want the current chart, use NULL.
  3. The second from the last is the buffer index. We can't know if buffer index 1 is correct.
  4. We can't know what values the indicator produces, so less than 5K may always be true.
  5. Detailed explanation of iCustom - MQL4 forum

thank you for reply

and i found .mt4

how fix indicator :)

Files:
oscillator.mq4  10 kb
 

replace lines 58-60 by:

   SetIndexLabel(0, "up");
   SetIndexLabel(1, "dn");
   SetIndexLabel(2, "buff-2");

Then you see and can call the values.

Reason: