Help me with the iCustom

 

Hi,

I have a compiled indicator. When the indicator is in use I can see in the data window 19 values that I would intercept with the iCustom function in my EA.

Is there a way to do this?

snapshot

 
Nobody does anything for free here. Believe me, I have tried and I still wish forex-tsd.com did not merge with this.
 
Just get the value(s) of the indicator(s) into the EA and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
          Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
 
Ok, it's a good new that this is possible, I go tu study.. thank's
 

This is a very simple EA that would capture only 2 values of the 18 indicator values, but I receive only the 2147483647, zero value. And this is not possible.


#define NL  "\n"    
#define SFX "PTS_DoubleTopBottom"
bool trovato1 = false;
bool trovato2 = false;

int OnInit()
  {
//---
   return(INIT_SUCCEEDED);
  }

void OnTick()
  {
         valore1 = getVALUE(0,0);
         valore2 = getVALUE(1,0);
         if (valore1 != 2147483647) trovato1 = true;
         if (valore2 != 2147483647) trovato2 = true;
         Commenti(); 
  }
//+------------------------------------------------------------------+

void Commenti()
{
Comment("--------------------------------------------------------= " + NL +            
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        "Valore 1 = " + valore1 + " - " + trovato1 + NL +
        "Valore 2 = " + valore2 + " - " + trovato2 + NL +
        "......................................................................................................");
}

double getVALUE(int eBuf, int iBar = 0){ 
   return( iCustom(NULL, 0, SFX, eBuf, iBar) ); 
}

the indicator has no parameters to be set.

 

10 value release.. it desn't work.. :-(

In what I'm in wrong?


#define NL  "\n"    
#define SFX "PTS_DoubleTopBottom"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
double valore[];
int trovato[];

int OnInit()
  {
  ArrayResize(trovato,10);

  int x = ChartSetSymbolPeriod(0,"EURUSD", PERIOD_M1);
//---
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
         ArrayResize(valore,10);

         for (int x=0; x<10; x++)
            {
               valore[x] = getVALUE(x,0);
               if (valore[x] != 2147483647) trovato[x] = true;
            }
         Commenti(); 
  }
//+------------------------------------------------------------------+

void Commenti()
{
Comment("--------------------------------------------------------= " + NL +            
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        " " + NL +
        "Valore 1 = " + valore[0] + " - " + trovato[0] + NL +
        "Valore 2 = " + valore[1] + " - " + trovato[1] + NL +
        "Valore 3 = " + valore[2] + " - " + trovato[2] + NL +
        "Valore 4 = " + valore[3] + " - " + trovato[3] + NL +
        "Valore 5 = " + valore[4] + " - " + trovato[4] + NL +
        "Valore 6 = " + valore[5] + " - " + trovato[5] + NL +
        "Valore 7 = " + valore[6] + " - " + trovato[6] + NL +
        "Valore 8 = " + valore[7] + " - " + trovato[7] + NL +
        "Valore 9 = " + valore[8] + " - " + trovato[8] + NL +
        "Valore 10 = " + valore[9] + " - " + trovato[9] + NL +
        "......................................................................................................");
}

double getVALUE(int eBuf, int iBar = 0){ 
   return( iCustom(NULL, 0, SFX, eBuf, iBar) ); 
}
 
pieroim: I receive only the 2147483647, zero value. And this is not possible.
 for (int x=0; x<10; x++) valore[x] = getVALUE(x,0);
  1. Don't expect us to know your indicator's code, or the version you are using. Post the code or a link to it.
  2. Of course it's possible. Do you really expect a double top to be detected on bar zero? Like the fractal indicator - never on bar zero.
  3. 2147483647 is EMPTY_VALUE, not zero, no value.
  4. How many buffers do you think it has?
 

I don't know the code, it's compiled. Studyng it in the tester I can see that sometimes one of the 18 values change from empty to a price value. In the first picture you can see that only the value13 has a price. 

I tested the EA in the same period where the indicator find a double top and some of the values change from empty to price value. But my ea don't intercept these values.

 
testing on bar 1 same results..
 
I can't post the link because it is a commercial site..
 
RISOLTO, piú semplice di quanto pensassi.. grazie.
Reason: