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

 
Igor Volodin:

You can't divide by a point that way, the value of theSymbolInfoDouble(symToWorkmodify,SYMBOL_POINT) function may be equal to zero.
This also applies to other market functions.

For example, the use ofAccountInfoInteger(ACCOUNT_LEVERAGE) in calculations caused some Expert Advisors to crash at the 2010 championship with theZero divide error, when this function returned 0 in OnInit.

If you look at the reference,SymbolInfoDouble(), SymbolInfoInteger() must always be checked for errors.
 
Vladimir Gribachev:

If it's that bad, here goes

Once again, please note that the topic is about a situation where the stoplevel is 0. You cited a test result with a stoplevel greater than zero.

And if it's that bad, as rightly pointed outby Andrey F. Zelinsky

you can add a check for the 130th error and add +1 to the stops. But it does not make sense at all.
Checking for error 130 is a normal practice, just like any other error in the program. But adding 1 to the stops, firstly, doesn't help, secondly, is a bad solution.
 
Ihor Herasko:

Once again, please note that the topic is about the situation when the stoplevel is 0. You gave a test result with a stoplevel greater than zero.

Show me where on the MetaQuotes-Demo server stoplevel = 0

even if Stop Level = 0, then the minimum stop loss equals the value of the spread.

If spread = 0 too, then show me such a broker and I will go there to cut my money.

Checking for error 130 is normal practice, just like any other error in the program. As for adding 1 to the stops, firstly it doesn't help, secondly it's a bad decision.

Who said it was good.

I posted the check code, you put in owls for verification, I showed that on the server where moderators check this check works.

If you need to mock the system and not find a solution that the topikstarter wanted, you need to create a new topic called "Let's blow up the brains!

ZS. The topickeeper needed a solution to get tested in the Market. Moderators test on their server, not on Alps or wherever.

 
Vladimir Gribachev:

If the spread is also 0, then show me such a broker and I will go there to chop dough.

No you won't, there will be a commission
 

:-) I read it and smiled.


I did not ask what to do if the server returns 0, moderate your ego - I'm addressing specifically to one person, he will understand it or not - but it does not matter.

The post was written not for the sake of communication, but for specific examples of programmers who put their products in the Market, it's strange to hear from a man who has never sold a single product - about what to do and what not to do.

THE TOPIC IS ABOUT VERIFICATION IN THE MARKETPLACE.

We are not talking about what an EA should check and how to handle errors. - I'm fine with that.

 
Vladislav Andruschenko:

I didn't ask what to do if the server returns 0

Then you should have been clearer in the subject line:

Right now 90% of brokers have floating spreads and minstops and return 0.

 
Ihor Herasko:

Then you need to be clearer in the thread:

I was asking about how to bypass marketplace error if server returns 0 - and when checking in macret the moderator puts stoploss = 1, but EA cannot change to min stop as it is 0, - it is floating.

It is clear that the EA returns error 130 and says that the stoploss is wrong, make changes, but in the marketplace, this command does not work.

my post sounded like this:

Hello all, friends!

there is a feature of marketplace: you have to check all values for min stop.

If the value of the variable is less than the min-stop, then assign a min-stop, so that there is noerror 130.

Currently 90% of brokers have floating spread and min STOP and yield 0.

There is a code construct that assigns all variables to the min stop.

 int OnInitLevels(string symToWorkmodify)
  {
   if(lot<SymbolInfoDouble(symToWorkmodify,SYMBOL_VOLUME_MIN))lots=SymbolInfoDouble(symToWorkmodify,SYMBOL_VOLUME_MIN);else
   if(lot>SymbolInfoDouble(symToWorkmodify,SYMBOL_VOLUME_MAX))lots=SymbolInfoDouble(symToWorkmodify,SYMBOL_VOLUME_MAX);else lots=lot;
   if(StopLoss>0 && StopLoss<SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL))StopLosss=(int)SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);else StopLosss=StopLoss;
   if(TakeProfit>0 && TakeProfit<SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL))TakeProfits=(int)SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);else TakeProfits=TakeProfit;
   if(TrailingStop>0 && TrailingStop<SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL))TrallingStops=(int)SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);else TrallingStops=TrailingStop;
   if(TakeProfitALL>0 && TakeProfitALL<SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL))TakeProfitsAver=(int)SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);else TakeProfitsAver=(int)TakeProfitALL;
   if(TrailingStop>0 && TrailingStop<SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL))TrallingStops=(int)SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);else TrallingStops=TrailingStop;
   return(0);
  }

But it doesn't work in the marketplace anymore, because minstop = 0 everywhere now,

Who is dealing with this problem?

 
Vladimir Gribachev:

Show me where on the MetaQuotes-Demo server stoplevel = 0

Not on the MetaQuotes server, but on the check in the marketplace (see the first post of the thread):

but it no longer passes in the marketplace, because now min stoplevel = 0 everywhere ,

Vladimir Gribachev:

even if min stoploss = 0, then the min stop loss equals the spread.

Not a fact. There could be 2 or 3 spreads. Perhaps you simply have not encountered such situations. But that does not mean that they do not exist. If you don't know what I'm talking about, you may try to avoid them.

 
Ihor Herasko:

Not on the MetaQuotes server, but when checking in the marketplace (see the first post of the thread):

Not a fact. There may be 2 or 3 spreads. Maybe you just haven't encountered such situations. But that doesn't mean they don't exist. The situation at the broker I mentioned is exactly the same.

i>That's the point, setting a hard min stop for 1-2-3 spreads is an excuse.

you need a real solution to the problem with floating stops.

They don't know what kind of floating stop they have, but they don't tell you how to do it. I'm sorry. Or he just won't tell me.

 

I think you should be clear on the question )). In the meantime, you're confused about it:

я не спрашивал что делать если сервер возвращает 0

and through the post:

I was asking about how to bypass the marketplace error if the server returns 0

Reason: