Wrote an advisor, there is a problem. - page 6

 
khorosh >> :

What are the quotes 4 or 5 decimal places?

4 digits...tried it on 5 digits too. NormalizeDouble does not work :(

 
In general, it's all kind of weird.... In the first post I gave a screenshot of the EA, started to upgrade it, appeared errors ordersend error 130, returned everything to its original state, but the errors have not disappeared!!!!!!! But everything was working in its original state!!!! What the hell is this?
 
Noterday >> :

That's what I'm saying. Why is a 10 pips stop wrong...


Here's the thing: a 10 pips Stop may be wrong because the minimum distance at which you can place a Stop Loss is more than 10 pips (for example: 15 pips). This value is set by the dealing room.
 
I've tried 200! It's still the same...
 
Noterday >> :
I've tried 200 too! Still the same...


Can you post the original EA code?

 
#property copyright "Мостовнек"
#property link      ""

int init()
  {
   return(0);
  }
int deinit()
  {
   return(0);
  }

extern int Frame = 1;


int start()
  {
  int total;
  
  for (int i = 0; i <= OrdersTotal(); i++)
     {
       if (OrderSelect( i-1, SELECT_BY_POS) == true)
       total++;
     }
  
  
    double Buffer1 = NormalizeDouble(iCustom(NULL, Frame,"Osc_Mx",0,0,1),4);
    double Buf1    = NormalizeDouble(iCustom(NULL, Frame,"Osc_Mx",0,6,1),4);
    double Buffer2 = NormalizeDouble(iCustom(NULL, Frame,"Osc_Mn",0,0,1),4);
    double Buf2    = NormalizeDouble(iCustom(NULL, Frame,"Osc_Mn",0,6,1),4);
    
    double ZZ_1    = NormalizeDouble(iCustom(NULL,0,"ZigZag",0,0,1),4);

//-----------------------------------------------------  

  if ( total == 0 && (( Buffer1 != EMPTY_VALUE || Buf1 != EMPTY_VALUE) && ( ZZ_1 == Buffer1 || ZZ_1 == Buf1)))
    {
     OrderSend(Symbol(),OP_SELL,0.1,Bid,10, ZZ_1+15*Point,Bid-20*Point,"SELL",0,0,Red);
     Print("Zigzag = ", ZZ_1," | Buffer1 = ", Buffer1);
    }
  
  if ( total == 0 && (( Buffer2 != EMPTY_VALUE || Buf2 != EMPTY_VALUE) && ( ZZ_1 == Buffer2 || ZZ_1 == Buf2)))
    {
     OrderSend(Symbol(),OP_BUY,0.1,Ask,10, ZZ_1-15*Point,Ask+20*Point,"BUY",0,0,Blue);
     Print("Zigzag = ", ZZ_1," | Buffer2 = ", Buffer1);
    }

return(0);
  }
 

The principle of setting a stop loss in the OrderSend() function is correct. So there is no need to change anything there.

When the Print() function runs, ZigZag=0, hence the stop loss : 0+15*Point, i.e. equal to 0.0015. That is why it generates error OrderSend Error 130.

double ZZ_1 = NormalizeDouble(iCustom(NULL,0, "ZigZag",21,5,3,0,1),4);// 21,5,3 are external indicator variables, they must be specified in the order they are declared in the ZigZag indicator.

Similarly, double Buffer1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,0,1),4);
double Buf1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,6,1),4);
double Buffer2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,0,1),4);
double Buf2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,6,1),4);

No external variables are specified here.

 

But they are optional, as written in MQL4 documentation.

And in

double Buffer1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,0,1),4);
double Buf1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,6,1),4);
double Buffer2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,0,1),4);
double Buf2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,6,1),4);


no external variables at all :)

By the way, my PRINT function outputs ZigZag normally:


 
Noterday >> :

But they are optional, as written in MQL4 documentation.

And in

double Buffer1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,0,1),4);
double Buf1 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mx",0,6,1),4);
double Buffer2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,0,1),4);
double Buf2 = NormalizeDouble(iCustom(NULL,Frame, "Osc_Mn",0,6,1),4);


no external variables at all :)

By the way, my PRINT function outputs ZigZag normally:



If there are no external variables in these indicators, there is no claim :). But I still need to think about the stops. Maybe you'll get an insight.
 
ellizii >> :

If there are no external variables in these indicators, there is no claim :). But I still need to think about the stops. Maybe you will get an insight.

Don't worry about it :) To developers: BASIC TESTER/OPTIMIZER

I'm sure it's the same with stopomi.

Reason: