ERR_INVALID_STOPS

 

Hello,

I try to code very basic EA. Can someone explains to me what is the problem with it ? It keeps saying ERR_INVALID_STOPS.

int start()
  {
if (iStop  >0 && iStop < MarketInfo(Symbol(), MODE_STOPLEVEL) )
iStop = MarketInfo(Symbol(), MODE_STOPLEVEL);
if (iLimite  > 0 && iLimite < MarketInfo(Symbol(), MODE_STOPLEVEL) ) 
iLimite = MarketInfo(Symbol(), MODE_STOPLEVEL);

if(iStop > 0) double dBuyStop = MarketInfo(Symbol(), MODE_BID) - (iStop * fPoint(Symbol()));
if(iLimite > 0) double dBuyLimite = MarketInfo(Symbol(), MODE_ASK) + (iLimite * fPoint(Symbol()));

while (iCompteur <6)
    {iTicket = OrderSend(Symbol(), OP_BUY, 1, MarketInfo(Symbol(), Ask), fSlippage(Symbol(),  1), dBuyStop, dBuyLimite, 0, 0, 0, 0);
    iCompteur = iCompteur +1;}

   return(0);
  }
//+------------------------------------------------------------------+

double fPoint(string sPaire) // Fonction pour déterminer la valeur correcte de Point
  {
  if((MarketInfo(sPaire, MODE_DIGITS)) == 2 || (MarketInfo(sPaire, MODE_DIGITS)) == 3) // Paires à 2 ou 3 décimales
    {
    double dPoint = 0.01; // Point = 0.01
    }
  if((MarketInfo(sPaire, MODE_DIGITS)) == 4 || (MarketInfo(sPaire, MODE_DIGITS)) == 5) // Paires à 4 ou 5 décimales
    {
    dPoint = 0.0001; // Point = 0.0001
    }
  return(dPoint); // Renvoi de la valeur correcte
  }


double fSlippage(string sPaire, int iPipsSlippage) // Fonction pour calculer la valeur correcte du slippage
  {
  if((MarketInfo(sPaire, MODE_DIGITS)) == 2 || (MarketInfo(sPaire, MODE_DIGITS)) == 4) // Paires à 2 ou 4 décimales
    {
    double dSlippage = iPipsSlippage; // Pas besoin de modifier la valeur
    }
  if((MarketInfo(sPaire, MODE_DIGITS)) == 3 || (MarketInfo(sPaire, MODE_DIGITS)) == 5) // Paires à 3 ou 5 décimales
    {
    dSlippage = iPipsSlippage * 10; // Nécéssité de multiplier la valeur par 10
    }
  return(dSlippage); // Renvoi de la valeur correcte
  }
 
int iCompteur;
int iTicket; 
int iStop = 2;
int iLimite = 4;
 
nikky:

Hello,

I try to code very basic EA. Can someone explains to me what is the problem with it ? It keeps saying ERR_INVALID_STOPS.

Is your Broker an ECN Broker ?  ECN
 
RaptorUK:
Is your Broker an ECN Broker ?  ECN


Hello,

I'm on MT4 on a demo account, i don't remember having open an account on an ECN Broker.

 
nikky:

Hello,

I'm on MT4 on a demo account, i don't remember having open an account on an ECN Broker.

You have a Demo account with a specific Broker  . .  is that Broker an ECN type Broker ?
 
Yes, it's an ECN broker. I spotted a mistake
MarketInfo(Symbol(), Ask)
but it changed nothing, MT4 does not want to open trades... Why?
 
Did you bother to read the ECN link I posted above ?
 
O... Sorry, thank you ! :)