This indicator is KILLING me

 

I wrote my own indicator and am having the weirdest problem. The indicator will display perfectly when I drag it onto the chart, but when I use it within the EA I get completely different results. I can't figure this out.

-There's only a single variable, set for 5, on the indicator in both the chart AND code.

-None of these are ASSIGNED in the rest of the EA or Indicator, so what's listed below in code IS the values.

// Get direction from indicator

int direction=0;

double bwSig[10];

double bwTop[10];

double bwBot[10];

ArrayInitialize(bwSig,0);ArrayInitialize(bwTop,0);ArrayInitialize(bwBot,0);

for (int a=0;a<=9;a++) {

bwSig[a]=iCustom(NULL,Period(),"barWorth-v2",5,0,a);

bwTop[a]=iCustom(NULL,Period(),"barWorth-v2",5,1,a);

bwBot[a]=iCustom(NULL,Period(),"barWorth-v2",5,2,a);

}

if (bwSig[1]>bwTop[1] && bwSig[2]<bwTop[2]) {direction=1;}

if (bwSig[1]bwBot[2]) {direction=-1;}

Cmt=Cmt+"Direction: " + direction + "\n";

Cmt=Cmt+"BW sig top bot (1 offset): " + bwSig[1] + " " + bwTop[1] + " " + bwBot[1] + "\n";

Files:
chart_3.gif  38 kb
 

indicator that make us LOSS -- give it up (it looks good, but it simply won't help much or don't fit our MIND SET)

 

I'm not sure how this is a useful comment.

I found what appears to be a profitable method, but I'm having problems getting the EA to grab the correct values. That's the problem here.