Errors, bugs, questions - page 276

 

Thank you very much for your promptness)

 

On topic. I almost got it, but COUNTER does not start in the terminal log says


removed

loaded successfully


it worked!!!
 

you have an error here.

   v161_handle=iCustom(NULL,0,"ErolМТ5");                            
   v162_handle=iCustom(NULL,0,"ErolМТ5");
   Sum_handle=iCustom(NULL,0,"ErolМТ5");
In this case, all three variables will have the same handle. as you are calling the same indicator three times.
 
sergey1294:

you have an error here

In this case, all three variables will have the same handle, because you are calling the same indicator three times.

Yes, but as I understand it, the values of the index lines of the indicator (the values of the 3 lines)

we get through:

CopyBuffer(v161_handle,1,0,3,Spr1Buffer)
CopyBuffer(v162_handle,2,0,3,Spr2Buffer)
CopyBuffer(Sum_handle,4,0,3,SumBuffer)

here 1, 2 and 4 are the index values of the indicator lines, which are stored in the buffer,

which we then compare with each other.

But that's not a problem, it doesn't calculate correctly with these indicator line indices

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Линии индикаторов - Документация по MQL5
 

Any advice on where to go or what to do here?


void OnTick()
{  
   ArraySetAsSeries(Spr1Buffer,true);
   ArraySetAsSeries(Spr2Buffer,true);
   ArraySetAsSeries(SumBuffer,true);

   if(CopyBuffer(v161_handle,1,0,3,Spr1Buffer)<0 || CopyBuffer(v162_handle,2,0,3,Spr2Buffer)<0 || CopyBuffer(Sum_handle,4,0,3,SumBuffer)<0)
      {
      Alert("Ошибка копирования буферов индикатора номер ошибки:",GetLastError());
      }
   bool SellSpr1 =(Spr1Buffer[1] > Spr2Buffer[1]);
   bool SellSum1 =(SumBuffer[1]>=Sp);
   if(SellSpr1 && SellSum1 && !PositionSelect(_Symbol))     
      {
        PositionOpenSell1();
      }
   bool BuySpr1 =(Spr1Buffer[1] < Spr2Buffer[1]);
   bool BuySum1 =(SumBuffer[1]>=Sp);
   if(BuySpr1 && BuySum1 && !PositionSelect(_Symbol))     
      {
        PositionOpenBuy1();
      }
 
alexluek:

Yes, but as I understand it, the values of the index lines of the indicator (the values of the 3 lines)

we get through:

here 1, 2 and 4 are the index values of the indicator lines, which are stored in the buffer,

which we then compare to each other.

But it's not a problem, it doesn't calculate correctly according to these indexes of indicator lines

It is sufficient to load one copy of the indicator and address the necessary buffer indexes via the copy buffer
 
sergey1294:
It's enough to load one copy of the indicator, and address the desired buffer index via the copybuffer

no it is not, I cannot get the values of the 2nd line

as the values of 2 line indices stored in different buffers are compared.


   bool SellSpr1 =(Spr1Buffer[1] > Spr2Buffer[1]);
 
alexluek:

Wrong, it is not possible to get the values of the 2nd line

as the values of 2 line indices stored in different buffers are compared.


there may be an error in the indicator itself
 
sergey1294:
there may be errors in the indicator itself

the indicator reads correctly

 

Saving the drowning is the job of the drowning.

It may come in handy for the future:

To call 2 or more indicator lines in an EA for the current bar

choose 1 handle and call the indicator, then use the copybuffer to save index values

and then work with these buffers. sergey1294 thanks for the help!

int OnInit()
  {
   v161_handle=iCustom(NULL,0,"LeroyMТ5");                            
   if(v161_handle<0)
     {
      Alert("Ошибка при создании индикаторов: ",GetLastError());
      return(-1);
     }
   return(0);
  }


void OnTick()
{  
   ArraySetAsSeries(Sp1Buffer,true);
   ArraySetAsSeries(Sp2Buffer,true);
   ArraySetAsSeries(Sp3Buffer,true);
   if(CopyBuffer(v161_handle,1,0,1,Sp1Buffer)<0 || CopyBuffer(v161_handle,2,0,1,Sp2Buffer)<0 || CopyBuffer(v161_handle,4,0,1,Sp3Buffer)<0)
      {
      Alert("Ошибка копирования буферов индикатора номер ошибки:",GetLastError());
      return;
      }    
   bool SellSpr1 =( Sp1Buffer[0]> Sp2Buffer[0] && Sp3Buffer[0]>=Sp );
   if(SellSpr1  && !PositionSelect(_Symbol))     
      {
        PositionOpenSell1();
      }
   bool BuySpr1 =( Sp1Buffer[0]< Sp2Buffer[0] && Sp3Buffer[0]>=Sp );
   if(BuySpr1 && !PositionSelect(_Symbol));   
      {
        PositionOpenBuy1();
      }
}     
Reason: