Coding help - page 764

 
Hello friends, im working in new strategy with this indi, I want to join it with other indicators, im useing ICustom, the indicators have 2 buffers no problem with that, but the indicador have  extreme levels 12 and 15, how can i code thats levels in my custom indicator, thanks.
Files:
SDA v 3.2.mq4  8 kb
 
Sanz50:
Hello friends, im working in new strategy with this indi, I want to join it with other indicators, im useing ICustom, the indicators have 2 buffers no problem with that, but the indicador have  extreme levels 12 and 15, how can i code thats levels in my custom indicator, thanks.
Compare the values returned by iCustom() to 12 and 15
 
mladen:
Compare the values returned by iCustom() to 12 and 15

Thanks soo much for your reply sir, i am learning to code, im interested only when price is over level 15, what must change in  this?

 

 double SDA(int i)

{

  double up = iCustom(Symbol(),0,"SDA v 3.2",1,i+1)!=EMPTY_VALUE;

  double dn = iCustom(Symbol(),0,"SDA v 3.2",0,i+1)!=EMPTY_VALUE; 

   

  if(up)

  {

  return(1);

  }

  if(dn)

  {

  return(-1);

  }

 

 return(0);

}


Files:
SDA v 3.2.mq4  8 kb
 
sda v 3.2__2.mq4
coding?
this is indicator is "reversed / dumped"
 

I use this code to read the support and resistance from the attached indicator,

Is my code correct? 

 

//global variables
   double            m_SupResvalS[1];
   double            m_SupResvalR[1];
   double            m_SupRescl[1];
   int               shift=0;
   bool  buyreg,sellreg=false;

bool getSinal()
  {
          if(CopyBuffer(m_SupResHand,0,Shift,1,m_SupResvalS)==-1 ||
             CopyBuffer(m_SupResHand,1,Shift,1,m_SupResvalR)==-1 ||
             CopyClose(_Symbol,CURRENT_PERIOD,Shift,1,m_SupRescl)==-1
            ) return(false);


          buyreg=m_SupRescl[0]>m_SupResvalR[0] && m_SupRescl1[0]<=m_SupResvalR1[0];
               // Crossing the line of resistance up.                    
          sellreg=m_SupRescl[0]<m_SupResvalS[0] && m_SupRescl1[0]>=m_SupResvalS1[0];
               // Crossing the line of support down.                      

   return(true);
}
 
CHARTNEXT() function

Hello everyone,

i am trying to work with this in my ea:

//--- variables for chart ID
   long currChart,prevChart=ChartFirst();
   int i=0,limit=100;
   Print("ChartFirst =",ChartSymbol(prevChart)," ID =",prevChart);
   while(i<limit)// We have certainly not more than 100 open charts
     {
      currChart=ChartNext(prevChart); // Get the new chart ID by using the previous chart ID
      if(currChart<0) break;          // Have reached the end of the chart list
      Print(i,ChartSymbol(currChart)," ID =",currChart);
      prevChart=currChart;// let's save the current chart ID for the ChartNext()
      i++;// Do not forget to increase the counter
     }
its from mql4 docs. But after some time or switching the timeframe where the ea is attached i get no value for ChartSymbol(currChart) in the second print, the first always works. Thats why i think there is something wrong with ChartNext function. Somehow it works in an indicator, but i would like to use it in an ea.

Can someone help please?

greets

Joe
 
mladen:
Compare the values returned by iCustom() to 12 and 15

Im interested when SDA is over level 15, how to code that into iCustom()

 

Thanks soo much. 

 
Sanz50:

Im interested when SDA is over level 15, how to code that into iCustom()

 

Thanks soo much. 

That code is decompiled ...
 
this is an equal indicator have 2 buffers soo can work for iCustom
Files:
my filter.ex4  9 kb
 
Sanz50:
this is an equal indicator have 2 buffers soo can work for iCustom
:)

Check buffer 1 and buffer 2 - what else is there that you can check? :)
Reason: