Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1528

 
MakarFX:

the first indicator has a value of EMPTY_VALUE when there is no signal

do the following

Wouldn't it be easier to write != EMPTY_VALUE?
 
Alexey Viktorov:
Wouldn't it be easier to write != EMPTY_VALUE?
And if the function returns zero?
 
Artyom Trishkin:
And if the function returns zero?

What function? The indicator buffer values are viewed there. If a non-displayable value of 0.0 was set then check for > 0.0

Forum on trading, automated trading systems & strategy testing

Any questions from newbies in MQL4 and MQL5, help and discussion of algorithms and codes

jarikn, 2021.07.04 14:04

but that's what's in the buffers when there's no signal. i don't think that >0 will do. but i'll try now



 
Alexey Viktorov:

Stops should not be used. Instead of using stops, put pending orders in the opposite direction.

Exactly :) Thanks for the idea
 
Alexey Viktorov:

What function? The indicator buffer values are viewed there. If a non-display value of 0.0 was supplied then check for > 0.0


iCustom() what does it return on error?
 
panel
void OnTick()
  {
  

    int ns=0,nb=0;
    int nss[100],nbb[100];
    double BuyLIVEL[1000], SellLIVEL[1000];
    
   double prise;
if(NewBar_M1()==true){   
for(int i=10000; i>0; i--){
  
  
double zig_s=iCustom(NULL,0,"ZigZag",Depth,Deviation,Backstep,1,i);  
double zig_b=iCustom(NULL,0,"ZigZag",Depth,Deviation,Backstep,2,i);   
         
if(zig_s>0.0){ns++; nss[ns]=ns; SellLIVEL[ns]=zig_s; comments(Time[i],zig_s+170*Point,ns);}
if(zig_b>0.0){nb++; nbb[nb]=nb; BuyLIVEL[nb]=zig_b; commentb(Time[i],zig_b-70*Point,nb);}


string rez;
 for(int b=0; b<nss[ns]; b++){
    rez+="ns "+nss[b]+" sel urovni  "+SellLIVEL[b]+"\n";
Comment(rez);
}

  }}
   
  }
//+------------------------------------------------------------------+
void comments(datetime y2,double y3,string y4){
   string name="1";
   ObjectDelete(name);
   bool obcrt= ObjectCreate(0,name+(string)y4, OBJ_TEXT, 0, y2,y3);
    ObjectSetInteger(0,name+(string)y4,OBJPROP_COLOR,clrBlack);
    ObjectSetString(0,name+(string)y4,OBJPROP_TEXT,y4); 
    ObjectSetString(0,name+(string)y4,OBJPROP_FONT,"Arial"); 
    ObjectSetInteger(0,name+(string)y4,OBJPROP_FONTSIZE,12); 
      }
//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж|
void commentb(datetime y2,double y3,string y4){
   string nama="2";
   ObjectDelete(nama);
   bool obcrt= ObjectCreate(0,nama+(string)y4, OBJ_TEXT, 0, y2,y3);
    ObjectSetInteger(0,nama+(string)y4,OBJPROP_COLOR,clrBlack);
    ObjectSetString(0,nama+(string)y4,OBJPROP_TEXT,y4); 
    ObjectSetString(0,nama+(string)y4,OBJPROP_FONT,"Arial"); 
    ObjectSetInteger(0,nama+(string)y4,OBJPROP_FONTSIZE,12); 
      }
//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж|
bool NewBar_M1() {
   static int Ba;
   if(Ba != iBars(NULL,PERIOD_CURRENT)){ 
   Ba = iBars(NULL,PERIOD_CURRENT); return (true); } else {return (false);} } 
//жжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжжж

Help me understand the need for zigzag levels upper resistance lower support I'm getting abar codabr

 
the advisor needs support and resistance levels in arrays; the lower levels should be support and upper and upper as resistance so that the advisor can review upper and lower levels and rewrite them to a new level
 
Artyom Trishkin:
What does iCustom() return when an error occurs?

Returned value

Numerical value of the specified custom indicator. The custom indicator must be compiled (file with EX4 extension) and located in terminal_directory\MQL4/\Indicators.

There is no information about errors. Apparently, they are not provided.

 
Alexey Viktorov:

There is no mention of errors. Apparently they are not provided for.

Oh, well. I haven't looked at the reference on the four in years because I didn't need to.

 
Artyom Trishkin:

All right, then. I haven't looked at the reference on the four in years because I didn't need to.

Yeah, and I looked it up to answer you, too.

Reason: