Checking the minimum stop in EAs published in the marketplace. - page 16

 
Vladislav Andruschenko:

the spread is taken into account, the spread was 8 pips. + min stop 18=26 pips

27 is ok.

And further, if a person needs to place a stoploss of 100 pips, it means he will lose 100 pips, so for BAY from the ASC price you need to count 100 pips.

and for sell from the BID, respectively.

I didn't say where to put the SL. I said what price to use when checking.
 
Andrey Khatimlianskii:
I didn't say where to put the SL. I said what price to use when checking.
Thank you. That option also counts.
 
Taras Slobodyanik:

So how can you not guess? if the broker gives an unreasonable stop level? %)

...it's clear that after all the checks, you have to guess to know the minimum indent

You cannot guess in the layout. You have to know everything. In advance. So as not to make a single mistake. Although I believe that mistakes from the server are not an error. It's a warning.
 

I have no experience of selling EAs on the Market, but after reading all the opinions, I'll put in my five cents.

You can try to select several options in the menu

1 Variant - Default. This is when the min stop is entirely determined byMODE_STOPLEVEL. Be sure to ask for a freshSTOPLEVEL before each action on the order.

2 Variant, ifMODE_STOPLEVEL == 0, then the stop lefts the spread.

3 Optionally, we manually set our own stop level, or some multiplier multiplied by the spread.

It is necessary to introduce control. If an EA is being tested or optimized, the stop level cannot be less than the spread. I think this will allow the market to pass any stress test, including one with StopLoss = 1.

 
Dmytro Zelenskyy:

I have no experience of selling EAs on the Market, but after reading all the opinions, I'll add my five cents.

You can try to select several options in the menu

1 Variant - Default. This is when the min stop is entirely determined byMODE_STOPLEVEL. Be sure to ask for a freshSTOPLEVEL before each action on the order.

2 Variant, ifMODE_STOPLEVEL == 0, then the stop lefts the spread.

3 Optionally, we manually set our own stop level, or some multiplier multiplied by the spread.

It is necessary to introduce control. If an EA is being tested or optimized, the stop level cannot be less than the spread. I think this will allow the market to pass any stress test, including one with StopLoss = 1.

Unfortunately, no.

In the market everything should go automatically.

Now here is a new funny thing with gold, there quotes 3 digits, but the last digit must be rounded, i.e. the last digit should be 0,

The last digit should be 0, so when rounding, it rounds according to a mathematical rule, and not in the direction that allows you to bypass the min stop rule.

Of course, I can just put - through market check to put all levels in 10 stop levels - so to speak, in order to let the moderators pass, but I would like to handle it properly.

i have to round it up for buy and down for sell. oh............

 
Vladislav Andruschenko:

Unfortunately, no.

In the market everything should go automatically.

Now here's a new trick on gold, there are 3-digit quotes, but the last digit must be rounded, i.e. the last digit must be 0,

The last digit should be 0, so when rounding, it rounds by a mathematical rule, and not to the side that allows you to bypass the min-stop rule.

Of course, I can just put - through market check to put all levels in 10 stop levels - so to speak, in order to let the moderators pass, but I would like to handle it properly.

I have to round it up for buy and down for sell. oh............

I have faced this problem too when testing gold and silver.

double NormalizePrice(string symbol,double value)
  {
   double ts=SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE);
   if(ts==0)return(value);
   return(NormalizeDouble(value/ts,0)*ts);
  }

example of use

      double ask=NormalizeDouble(SymbolInfoDouble(symbol,SYMBOL_ASK),digits);
      if(NormalizeDouble(NormalizePrice(symbol,ask),digits)!=ask)return;
 

this is what my take profit and stop loss function looks like for example

void ModifyTP(string symbol,double tp)
  {
   if(tp<=0)return;
   bool res;
   double last=SymbolInfoDouble(symbol,SYMBOL_LAST);
   double bid=SymbolInfoDouble(symbol,SYMBOL_BID);
   double ask=SymbolInfoDouble(symbol,SYMBOL_ASK);
   double point=SymbolInfoDouble(symbol,SYMBOL_POINT);
   int digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);

   if(last<=0.0)
     {
      bid=SymbolInfoDouble(symbol,SYMBOL_BID);
      ask=SymbolInfoDouble(symbol,SYMBOL_ASK);
     }
   else
     {
      bid=SymbolInfoDouble(symbol,SYMBOL_LAST);
      ask=SymbolInfoDouble(symbol,SYMBOL_LAST);
     }

   if(bid<=0.0)return;
   if(ask<=0.0)return;

   int total=OrdersTotal();

   for(int i=0; i<total; i++)
     {
      if(!OrderSelect(i,SELECT_BY_POS))continue;
      if(OrderMagicNumber()!=Magic)continue;
      if(OrderSymbol()!=symbol)continue;
      if(OrderType()>1)continue;
      if(OrderTakeProfit()!=0)continue;

      if(OrderType()==OP_BUY) tp=NormalizeDouble(NormalizePrice(symbol,bid+tp*point),digits);
      if(OrderType()==OP_SELL) tp=NormalizeDouble(NormalizePrice(symbol,ask-tp*point),digits);
      if(tp<0)continue;
      res=OrderModify(OrderTicket(),OrderOpenPrice(),OrderStopLoss(),tp,0);
      if(!res)
        {
         int error=GetLastError();
         rezult=StringConcatenate(OrderSymbol(),": error modifying TakeProfit order ",StrToType(OrderType())," №- ",error," ",ErrorDescription(error)," Ticket: ",OrderTicket());
         Print(rezult);
        }
     }
  }
 
Sergey Gritsay:

Also faced with the problem of testing on gold and silver, I wrote a function like this

example of use

If I use gold on mt5 server - 3 decimal places, but stops and open price should be set to !!!! If you still want to play with 2 decimal places, round it up to 2 decimal places instead of 3, and you may also see some humorous tricks with min. stops on gold and silver,

like this:

   request.tp=NormalizeDouble(request.tp,SymbolInfoInteger(symToWork2,SYMBOL_DIGITS)-Rounding);
   request.sl=NormalizeDouble(request.sl,SymbolInfoInteger(symToWork2,SYMBOL_DIGITS)-Rounding);
   request.price=NormalizeDouble(request.price,SymbolInfoInteger(symToWork2,SYMBOL_DIGITS)-Rounding);

whereRounding= for gold mt5 is 1.

You need to round the price, otherwise it will inform you that the price is wrong, but when you round it, the server will correct it to the right price and the transaction will be closed.

The mt4 has no such quirks - there are 2 decimal places and you round up to 2 decimal places without any problems.

my personal opinion about error 130:

i have all the checks for error 130 - there's an error log output.

There is also normalisation.

In the marketplace they made me normalize to min stop, respectively + spread, (for example, I should buy from ASK price and check for min stop at BID price).

So, it should be forced on the user, if a trader uses the EA and sets for example 20 points of Stop Loss, then the EA should automatically overwrite it by 50 points (MinStop + Spread), which is not correct. The trader must see error 130 and correct the stop on his own risk.

Another option - if a user sets the stoploss lower than the minimum - prohibit trading and modification, because the moderators will not allow the Expert Advisor with an error of 130.

But banning the trade is wrong, stop and spread is floating, now it's less than the minimum - then it's OK.

I don't think it's a good idea to use the market for such an approach.

IMHO: an error 130 should be and a user should see the 130th error from the server, not from an Expert Advisor saying: "Your stop is below the minimum, correct it".

Market rule: do not skip the Expert Advisor that generates error 130 - because the checker has put 1 point in the Stop Loss - well, this is a failure.

One and the same Expert Advisor version may or may not be passed.

I have posted a version - everything is OK, after a while I saw that the EA prints a lot (just the fact that the stop loss is less than the minimum), I quickly corrected it and waited for a week until they start testing, again 2 weeks of stagnation because again I see 130 error on some symbol

 
Vladislav Andruschenko:

In gold on the mt5 server - 3 decimal places, but stops and opening price should be set to !!!!. If you want to change the price for gold and silver, you need to set it to 2 decimal places, i.e. round it to 2 decimal places and not to 3, and there will be a trick with your min stop on gold and silver,

like this:

whereRounding= for gold mt5 is 1.

You need to round the price, otherwise it will inform you that the price is wrong, but when you round it, the server will correct it to the right price and the transaction will be closed.

The mt4 has no such quirks - there are 2 decimal places and you round up to 2 decimal places without any problems.

my personal opinion about error 130:

i have all the checks for error 130 - there's an error log output.

There is also normalisation.

The marketplace made me normalize it to min stop, respectively + spread, (for example, I should buy from ASK price and check min stop at BID price).

So, it should be forced on the user, if a trader uses the EA and sets for example 20 points of Stop Loss, then the EA should automatically overwrite it by 50 points (MinStop + Spread), which is not correct. The trader must see error 130 and correct the stop on his own risk.

Another option - if a user sets the stoploss lower than the minimum - to prohibit trading and modification? Because moderators will not allow the Expert Advisor with an error of 130

But to ban trading is wrong, stop and spread is floating, now it's less than the minimum - then it's OK.

I don't think it's a good idea to use the market for such an approach.

IMHO: an error 130 should be and a user should see the 130th error from the server, not from an Expert Advisor saying: "Your stop is below the minimum, correct it".

Market rule: do not skip the Expert Advisor that generates error 130 - because the checker has put 1 point in the Stop Loss - well, this is a failure.

One and the same Expert Advisor version may or may not be passed.

I have posted a version - everything is OK, after a while I saw that the EA prints a lot (just the fact that the stop loss is less than the minimum), I quickly corrected it and waited for a week until they start checking, again 2 weeks of stagnation because 130 error appears again on some symbol

IMHO - many server messages - not an error, and the return code. And it is not intended to be avoided by all sorts of tricks, but for the Expert Advisor to be able to make decisions. It is decisions based on the server's response to his/her actions. Otherwise, it would be just a dumb toy that does not allow to monitor the market and correct its actions based on the "communication" with the server.

So "faceting" the moderators on error 130 is overkill. We must be thoughtful: it is one thing when an Expert Advisor continues to bang the server after the 130th error, and another thing when it reacts to it and changes its actions. Why are we not allowed to do the latter? Is it simply because someone (the moderator) does not want to take a closer look at the EA's work? It feels like seeing 130 - in marriage. It does not matter that the expert probably needs such a response from the server for its own logic, it is important just to reject it, and do not look any further. Is that how it works?

 
Artyom Trishkin:

IMHO - many server messages are not an error, but a return code. And you need it not to avoid it by all sorts of tricks, but for the Expert Advisor to be able to make decisions. It's decisions based on the server's response to his/her actions. Otherwise, it would be just a dumb toy that does not allow to follow the market and correct its actions based on a reciprocal "communication" with the server.

So, it's an overkill to "force" moderators to make the 130th mistake. We need to be thoughtful: it is one thing if the Expert Advisor continues to bang the server after the 130th error, but it is quite another thing when it reacts to it and changes its actions. Why are we not allowed to do the latter? Is it simply because someone (the moderator) does not want to take a closer look at the EA's work? It feels like seeing 130 - in marriage. It does not matter that the expert probably needs such a response from the server for its own logic, it is important to just reject it, and not to look any further. Is that how it works?

This is why my EA has been catching min/max movements and therefore it is pounding the server not with 1 pip stoploss but with a normal min level + spread, but the spread is floating. Therefore, EA will pound the server until it returns a normal spread.

In other words, at the moment of opening it checks for min stop - rebuilds its values - then it hits the server. But if you need to put a 10 pips stop, you have to wait for the min spread and beat the server.

Reason: