# Indicator not sending value to EA

32

I'm trying to develop a simple indicator that tells me the difference between 2 similar products eg. UK & US Oil. The indicator correctly displays variance on a chart but does not send the same value to my EA.

Any help would be appreciated.

```//+------------------------------------------------------------------+
//|                                   |
//+------------------------------------------------------------------+

#property indicator_chart_window

extern color font_color = Red;
extern int font_size = 14;
extern string font_face = "Arial";
extern int corner = 0; //0 - for top-left corner, 1 - top-right, 2 - bottom-left, 3 - bottom-right
extern bool normalize = false; //If true then the spread is normalized to traditional pips

double Poin;
int n_digits = 0;
double divider = 1;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
//Checking for unconvetional Point digits number
if (Point == 0.00001) Poin = 0.0001; //5 digits
else if (Point == 0.001) Poin = 0.01; //3 digits
else Poin = Point; //Normal

if ((Poin > Point) && (normalize))
{
divider = 10.0;
n_digits = 1;
}

return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
RefreshRates();

return(0);
}
//+------------------------------------------------------------------+```
28587

Hi,

So you didnt implement a buffer for it,you should define a buffer,then spend the variance value into the buffer,or you could do it via global variables.

Or you could do this formula directly into your EA:

```double spread = (MarketInfo("XBRUSD",MODE_ASK) - MarketInfo("XTIUSD",MODE_BID)) / Point/divider;
```
32

Hi,

So you didnt implement a buffer for it,you should define a buffer,then spend the variance value into the buffer,or you could do it via global variables.

Or you could do this formula directly into your EA:

I put the code as suggested into the EA & disabled the indicator. EA now works fine.  Many thanks Mehrdad.

28587

wsandy59:

I put the code as suggested into the EA & disabled the indicator. EA now works fine.  Many thanks Mehrdad.

OK,Good,You're welcome,