Get a boolean value from indicator to EA

 
Hello, I want to take the values "buy" and "sell" from "indicator 1" and send them to my EA. Looking on the internet I saw the "iCustom function" but it returns a double value and I do not know how it works
#property strict 

#property indicator_chart_window
#property indicator_buffers 6

#property indicator_color1 RoyalBlue       //DodgerBlue
#property indicator_color2 Crimson         //OrangeRed
#property indicator_color3 LightSteelBlue  //White
#property indicator_color4 LightSteelBlue  //White
#property indicator_color5 Gold            //White
#property indicator_color6 Magenta         //Red

#property indicator_width1 2
#property indicator_width2 2

#property indicator_style3 STYLE_DOT
#property indicator_style4 STYLE_DOT

input int    p        = 10;    
input int    s        = 5;     
input double distance = 2.0;  
input bool   showBb   = true;  
input bool   showCl   = true;
input int    barsig   = 1;    
input int    arrots   = 30;   
input int    arrsz    = 1;    
input int    ATR      = 1000;  
input int    cb       = 1000; 

bool buy=false;
bool sell=false;

double fx1[],fx2[],hp[];
double z1,z2,ki;
int fs;

double upper[],lower[];
double upar[],dnar[];


int OnInit(void)
  {
IndicatorBuffers(7);
SetIndexBuffer(0,fx1);
SetIndexBuffer(1,fx2);
SetIndexBuffer(2,lower);
SetIndexBuffer(3,upper);
SetIndexBuffer(4,upar);
SetIndexBuffer(5,dnar);
SetIndexBuffer(6,hp);

SetIndexStyle (4,DRAW_ARROW,0,arrsz);
SetIndexArrow (4,233);
SetIndexStyle (5,DRAW_ARROW,0,arrsz);
SetIndexArrow (5,234);

   if(showBb)
   {SetIndexStyle(2,DRAW_LINE);
    SetIndexStyle(3,DRAW_LINE);
   }
   else
   {SetIndexStyle(2,DRAW_NONE);
    SetIndexStyle(3,DRAW_NONE);
   }
   
    if(showCl)
   {SetIndexStyle(0,DRAW_LINE);
    SetIndexStyle(1,DRAW_LINE);
   }
   else
   {SetIndexStyle(0,DRAW_NONE);
    SetIndexStyle(1,DRAW_NONE);
   }

SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);

   return(INIT_SUCCEEDED);
  }
  
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   int i;
   
   SetIndexDrawBegin(0,Bars-cb);
   SetIndexDrawBegin(1,Bars-cb);

double avg;

ki=2.0/(p+1);

for (i=cb; i>=0; i--) {fx1[i]=Close[i];}

for (int m=0; m<=s; m++)
{
z1=fx1[0];
for (i=0; i<=cb; i++) {z1=z1+(fx1[i]-z1)*ki; hp[i]=z1;}

z2=fx1[cb];
for (i=cb; i>=0; i--) {z2=z2+(fx1[i]-z2)*ki; fx1[i]=(hp[i]+z2)/2;}
}

fs=0;
for (i=cb; i>=0; i--)
{
if (fx1[i]>fx1[i+1]) fs=1;
if (fx1[i]<fx1[i+1]) {if (fs==1) fx2[i+1]=fx1[i+1]; fs=2;}
if (fs==2) fx2[i]=fx1[i]; else fx2[i]=0.0;

avg = iATR(NULL,0,ATR, i+10);
upper[i] = hp[i] + distance*avg;
lower[i] = hp[i] - distance*avg;

if(Close[i+1+barsig]<upper[i+1+barsig] && Close[i+barsig]>upper[i+barsig]) {
 dnar[i] = High[i]+arrots*Point; buy=true;} else dnar[i] = EMPTY_VALUE;
 
if(Close[i+1+barsig]>lower[i+1+barsig] && Close[i+barsig]<lower[i+barsig]) {
 upar[i] = Low[i]-arrots*Point; sell=true;} else upar[i] = EMPTY_VALUE; 
}
   return(rates_total);
  }
 
 
up
 
Niketion:
Hello, I want to take the values "buy" and "sell" from "indicator 1" and send them to my EA. Looking on the internet I saw the "iCustom function" but it returns a double value and I do not know how it works

iCustom "talks" to indicators through Buffers - those set by the SetIndexBuffer(). Whatever you put into those buffers that is the stuff that will appear on the "Caller" indicator...

If you put a Double there, a Double will appear on the "other side"...

;)