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

 
Vladimir Gribachev:

Well, on the MetaQuotes-Demo server (where the moderator is testing) the min. stop level returns normally. Check for yourself, 0 will not.

I do not know on what server is tested moderator but the topik starter was checking for a stop level and he returned the product to the improvement of the error 130. Read the thread from the beginning.
 
Vitalii Ananev:
I don't know on what server the test moderator but the topic starter had a check for a stop level and the product was returned to him for improvement because of an error 130. Read the thread from the beginning.

In his case 130 may not only occur when owls try to place a stop loss too close to the market.

It is better to check directly when sending or modifying a slp.

 
Vladimir Gribachev:

Question, why put a stop loss of 1 point on the real?

I just remembered... Once tested such an algorithm with a minimum stop loss, the check is basically the same and there were no errors as well as no profits.

I've sold 60 Marketplace products -- I've written 80 freelance tasks -- I've had an advertising site for writing Expert Advisors, and I've been doing it for years.

And suddenly the topicstarter asks what to do about zero stoplevelling and says that the marketplace moderators are somehow weirdly checking the marketplace EAs.

In contrast to his comments -- the forum users who have experience of development, who have experience of putting products on the market -- read his comments and are perplexed.

Seems to me -- the topicstarter is in a state of complete inadequacy and has bluntly sucked the problem out of his hand.

 
Andrey F. Zelinsky:

The seller of 60 marketplace products -- who has written 80 tasks in local freelance -- who has a website advertising writing EAs -- and all of this is far from the first year -- is the topicstarter.

And suddenly the topicstarter asks what to do about zero stoplevelling and says that the marketplace moderators are somehow weirdly checking the marketplace EAs.

In contrast to his comments -- the forum users who have experience of development, who have experience of putting products on the market -- read his comments and are perplexed.

Seems to me -- the topicstarter is in a state of complete inadequacy and has bluntly sucked the problem out of his hand.

Maybe he just wants to communicate? ) programming bots is a very lonely business
 
lilita bogachkova:

the code posted here:

double point=SymbolInfoDouble(symToWorkmodify,SYMBOL_POINT);
int spread=(ask-bid)/point;

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 at the 2010 championship caused some EAs to crash with aZero divide error, when this function returned 0 in OnInit.

 
Vladimir Gribachev:

Question, why put a stop loss of 1 point on the real?

I just remembered... I once tested a similar algorithm with a minimum stop-loss, the check was basically the same and there were no errors, nor were there any profits.

Look at the root of the matter. This is not about why I set a 1 pip stop loss. The point is that the stop loss may be less than the stop loss that is hidden by the broker and calculated based on the spread width.

To clarify the essence of the problem, I am showing you an Expert Advisor that uses your algorithm to check stops:

#property strict
//--- input parameters
input int      i_slSize          = 10;
input int      i_tpSize          = 10;
input int      i_magicNumber     = 32847623;

int OnInit()
{
   Print("Величина стоплевел: ", MarketInfo(_Symbol,MODE_STOPLEVEL));
   return(INIT_SUCCEEDED);
}

int GetExpertOrderTicket()
{
   for (int i = OrdersTotal() - 1; i >= 0; i--)
   {
      if (!OrderSelect(i, SELECT_BY_POS))          
         continue;
         
      if (OrderSymbol() != Symbol())
         continue;   
         
      if (OrderMagicNumber() != i_magicNumber)
         continue;
         
      if (OrderType() == OP_BUY)
         return OrderTicket();
   }
   
   return -1;
}

void OnTick()
{
   int ticket = GetExpertOrderTicket();
   if (ticket < 0)
   {
      ticket = OrderSend(Symbol(), OP_BUY, 0.01, Ask, 30, 0.0, 0.0, NULL, i_magicNumber);
      return;
   }
      
   if (!OrderSelect(ticket, SELECT_BY_TICKET) || OrderCloseTime() != 0 || OrderStopLoss() > 0.0 || OrderTakeProfit() > 0.0)
      return;
      
   double SL=NormalizeDouble(OrderOpenPrice()-MathMax(i_slSize,(int)MarketInfo(_Symbol,MODE_STOPLEVEL))*_Point,_Digits);
   double TP=NormalizeDouble(OrderOpenPrice()+MathMax(i_tpSize,(int)MarketInfo(_Symbol,MODE_STOPLEVEL))*_Point,_Digits);
   
   bool result = OrderModify(ticket, 0.0, SL, TP, 0);
}

Testing result of such an Expert Advisor:

0       14:52:30.354    Expert CheckStopLevel EURUSD,H1: removed
0       14:52:30.372    Expert CheckStopLevel EURUSD,H1: loaded successfully
0       14:52:30.390    Tester: template 'D:\ForexDC\Alpari\templates\tester.tpl' applied
0       14:52:30.395    TestGenerator: current spread 10 used
2       14:52:32        2015.01.12 00:00  CheckStopLevel inputs: i_slSize=10; i_tpSize=10; i_magicNumber=32847623; 
0       14:52:32        2015.01.12 00:00  CheckStopLevel EURUSD,H1: Величина стоплевел: 0.0
2       14:52:32        2015.01.12 00:00  CheckStopLevel EURUSD,H1: open #1 buy 0.01 EURUSD at 1.18674 ok
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:35        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130
3       14:52:36        2015.01.12 00:00  CheckStopLevel EURUSD,H1: OrderModify error 130

As can be seen, the method does not pass the elementary test.

 
Ihor Herasko:

Get to the root of it. It's not about why you should put a 1-point stoploss. It's about...

If you get to the root of it -- you have to distinguish between a) "foolproofing the developer's buyer " and b) counting on the buyer being an idiot. They are different protections.

No sane buyer would put a negative take and stop. Therefore, checking "how the EA will react to a negative stop and take" is counting on the fact that the buyer is an idiot.

Creating an EA in which a user-defined take and stop is forced to continuously increase by an incomprehensible value of "2 spreads" - this is "foolproofing" - only a protection against a "fool of a developer".

Especially if the developer puts such protection in order to pass market moderation.

 
Andrey F. Zelinsky:

If you look at the root of it, you have to distinguish between a) "foolproofing the developer purchaser " and b) counting on the purchaser being an idiot. These are different protections.

No sane buyer would put a negative take and stop. Therefore, checking "how the EA will react to a negative stop and take" is counting on the fact that the buyer is an idiot.

Creating an EA in which the user-defined take and stop is forced to continuously increase by an incomprehensible amount of "2 spreads" is "foolproof", only foolproof by not purchasing the product from the "fool developer".

Do you think there are many sane people here? :) Especially among buyers.
 
Ihor Herasko:

Get to the root of it. It's not about why you should put a stop loss of 1 pip. It's about the fact that the stop loss may be less than the stop loss, which is hidden by the broker and is calculated based on the spread width.

To clarify the problem, I am showing you an Expert Advisor that uses your algorithm to check stops:

Testing result of such an Expert Advisor:

As can be seen, the method does not pass the elementary check.

If it is that bad, here is

#property strict
//--- input parameters
input int      i_slSize          = 10;
input int      i_tpSize          = 10;
input int      i_magicNumber     = 32847623;

int OnInit()
{
   Print("Величина стоплевел: ", MarketInfo(_Symbol,MODE_STOPLEVEL));
   return(INIT_SUCCEEDED);
}

int GetExpertOrderTicket()
{
   for (int i = OrdersTotal() - 1; i >= 0; i--)
   {
      if (!OrderSelect(i, SELECT_BY_POS))          
         continue;
         
      if (OrderSymbol() != Symbol())
         continue;   
         
      if (OrderMagicNumber() != i_magicNumber)
         continue;
         
      if (OrderType() == OP_BUY)
         return OrderTicket();
   }
   
   return -1;
}

void OnTick()
{
   int ticket = GetExpertOrderTicket();
   if (ticket < 0)
   {
      ticket = OrderSend(Symbol(), OP_BUY, 0.01, Ask, 30, 0.0, 0.0, NULL, i_magicNumber);
      return;
   }
      
   if (!OrderSelect(ticket, SELECT_BY_TICKET) || OrderCloseTime() != 0 || OrderStopLoss() > 0.0 || OrderTakeProfit() > 0.0)
      return;
      
   double SL=NormalizeDouble(Bid-MathMax(i_slSize,(int)MarketInfo(_Symbol,MODE_STOPLEVEL))*_Point,_Digits);
   double TP=NormalizeDouble(Bid+MathMax(i_tpSize,(int)MarketInfo(_Symbol,MODE_STOPLEVEL))*_Point,_Digits);
   
   bool result = OrderModify(ticket, 0.0, SL, TP, 0);
}

log

2016.03.16 15:09:35.611 GBPUSD,H1: 94 tick events (1095 bars, 286082 bar states) processed in 0:00:06.037 (total time 0:00:10.109)
2016.03.16 15:09:35.611 2016.03.01 00:12  Tester: order #14  is closed
2016.03.16 15:09:35.588 2016.03.01 00:12  Tester: stop button pressed
2016.03.16 15:09:35.547 2016.03.01 00:12  abcd GBPUSD,H1: modify #14  buy 0.01 GBPUSD at 1.39165 sl: 1.39130 tp: 1.39154 ok
2016.03.16 15:09:35.483 2016.03.01 00:12  abcd GBPUSD,H1: open #14  buy 0.01 GBPUSD at 1.39165 ok
2016.03.16 15:09:35.483 2016.03.01 00:12  Tester: take profit #13  at 1.39144 (1.39144 / 1.39165)
2016.03.16 15:09:35.099 2016.03.01 00:12  abcd GBPUSD,H1: modify #13  buy 0.01 GBPUSD at 1.39156 sl: 1.39120 tp: 1.39144 ok
2016.03.16 15:09:35.035 2016.03.01 00:11  abcd GBPUSD,H1: open #13  buy 0.01 GBPUSD at 1.39156 ok
2016.03.16 15:09:35.035 2016.03.01 00:11  Tester: stop loss #12  at 1.39148 (1.39135 / 1.39156)
2016.03.16 15:09:34.971 2016.03.01 00:11  abcd GBPUSD,H1: modify #12  buy 0.01 GBPUSD at 1.39171 sl: 1.39148 tp: 1.39172 ok
2016.03.16 15:09:34.907 2016.03.01 00:11  abcd GBPUSD,H1: open #12  buy 0.01 GBPUSD at 1.39171 ok
2016.03.16 15:09:34.907 2016.03.01 00:11  Tester: take profit #11  at 1.39143 (1.39150 / 1.39171)
2016.03.16 15:09:34.267 2016.03.01 00:10  abcd GBPUSD,H1: modify #11  buy 0.01 GBPUSD at 1.39147 sl: 1.39119 tp: 1.39143 ok
2016.03.16 15:09:34.203 2016.03.01 00:10  abcd GBPUSD,H1: open #11  buy 0.01 GBPUSD at 1.39147 ok
2016.03.16 15:09:34.203 2016.03.01 00:10  Tester: stop loss #10  at 1.39132 (1.39126 / 1.39147)
2016.03.16 15:09:33.947 2016.03.01 00:10  abcd GBPUSD,H1: modify #10  buy 0.01 GBPUSD at 1.39174 sl: 1.39132 tp: 1.39156 ok
2016.03.16 15:09:33.883 2016.03.01 00:10  abcd GBPUSD,H1: open #10  buy 0.01 GBPUSD at 1.39174 ok
2016.03.16 15:09:33.883 2016.03.01 00:10  Tester: stop loss #9  at 1.39157 (1.39153 / 1.39174)
2016.03.16 15:09:33.435 2016.03.01 00:09  abcd GBPUSD,H1: modify #9  buy 0.01 GBPUSD at 1.39186 sl: 1.39157 tp: 1.39181 ok
2016.03.16 15:09:33.371 2016.03.01 00:09  abcd GBPUSD,H1: open #9  buy 0.01 GBPUSD at 1.39186 ok
2016.03.16 15:09:33.371 2016.03.01 00:09  Tester: take profit #8  at 1.39163 (1.39165 / 1.39186)
2016.03.16 15:09:32.603 2016.03.01 00:06  abcd GBPUSD,H1: modify #8  buy 0.01 GBPUSD at 1.39173 sl: 1.39139 tp: 1.39163 ok
2016.03.16 15:09:32.539 2016.03.01 00:06  abcd GBPUSD,H1: open #8  buy 0.01 GBPUSD at 1.39173 ok
2016.03.16 15:09:32.539 2016.03.01 00:06  Tester: take profit #7  at 1.39152 (1.39152 / 1.39173)
2016.03.16 15:09:32.346 2016.03.01 00:06  abcd GBPUSD,H1: modify #7  buy 0.01 GBPUSD at 1.39173 sl: 1.39128 tp: 1.39152 ok
2016.03.16 15:09:32.282 2016.03.01 00:06  abcd GBPUSD,H1: open #7  buy 0.01 GBPUSD at 1.39173 ok
2016.03.16 15:09:32.282 2016.03.01 00:06  Tester: take profit #6  at 1.39148 (1.39152 / 1.39173)
2016.03.16 15:09:32.025 2016.03.01 00:05  abcd GBPUSD,H1: modify #6  buy 0.01 GBPUSD at 1.39155 sl: 1.39124 tp: 1.39148 ok
2016.03.16 15:09:31.961 2016.03.01 00:05  abcd GBPUSD,H1: open #6  buy 0.01 GBPUSD at 1.39155 ok
2016.03.16 15:09:31.961 2016.03.01 00:05  Tester: stop loss #5  at 1.39140 (1.39134 / 1.39155)
2016.03.16 15:09:31.249 2016.03.01 00:04  abcd GBPUSD,H1: modify #5  buy 0.01 GBPUSD at 1.39170 sl: 1.39140 tp: 1.39164 ok
2016.03.16 15:09:31.185 2016.03.01 00:04  abcd GBPUSD,H1: open #5  buy 0.01 GBPUSD at 1.39170 ok
2016.03.16 15:09:31.185 2016.03.01 00:04  Tester: take profit #4  at 1.39147 (1.39149 / 1.39170)
2016.03.16 15:09:30.801 2016.03.01 00:02  abcd GBPUSD,H1: modify #4  buy 0.01 GBPUSD at 1.39159 sl: 1.39123 tp: 1.39147 ok
2016.03.16 15:09:30.737 2016.03.01 00:01  abcd GBPUSD,H1: open #4  buy 0.01 GBPUSD at 1.39159 ok
2016.03.16 15:09:30.737 2016.03.01 00:01  Tester: take profit #3  at 1.39136 (1.39138 / 1.39159)
2016.03.16 15:09:30.481 2016.03.01 00:01  abcd GBPUSD,H1: modify #3  buy 0.01 GBPUSD at 1.39143 sl: 1.39112 tp: 1.39136 ok
2016.03.16 15:09:30.417 2016.03.01 00:01  abcd GBPUSD,H1: open #3  buy 0.01 GBPUSD at 1.39143 ok
2016.03.16 15:09:30.417 2016.03.01 00:01  Tester: stop loss #2  at 1.39126 (1.39122 / 1.39143)
2016.03.16 15:09:30.225 2016.03.01 00:00  abcd GBPUSD,H1: modify #2  buy 0.01 GBPUSD at 1.39156 sl: 1.39126 tp: 1.39150 ok
2016.03.16 15:09:30.161 2016.03.01 00:00  abcd GBPUSD,H1: open #2  buy 0.01 GBPUSD at 1.39156 ok
2016.03.16 15:09:30.161 2016.03.01 00:00  Tester: take profit #1  at 1.39135 (1.39135 / 1.39156)
2016.03.16 15:09:29.647 2016.03.01 00:00  abcd GBPUSD,H1: modify #1  buy 0.01 GBPUSD at 1.39148 sl: 1.39111 tp: 1.39135 ok
2016.03.16 15:09:29.583 2016.03.01 00:00  abcd GBPUSD,H1: open #1  buy 0.01 GBPUSD at 1.39148 ok
2016.03.16 15:09:29.583 2016.03.01 00:00  abcd GBPUSD,H1: Величина стоплевел: 12.0
2016.03.16 15:09:29.574 2016.03.01 00:00  abcd inputs: i_slSize=10; i_tpSize=10; i_magicNumber=32847623; 
2016.03.16 15:09:27.513 TestGenerator: current spread 21 used

and no problems.

Well, if it is that bad, as rightly pointed outby Andrey F. Zelinsky

If you want to degrade EA's functionality only to go to the Marketplace moderation, that is inadequate.

If my EA has not been checked for 130th error and adds +1 to stops. But that's just nonsense.
 
Maxim Dmitrievsky:
Do you think there are many sane people here? :) Especially among the buyers.

I think if you do the research -- there are more sane buyers than sane developers.

The buyer can be wrong. The customer can be made to understand. They can be persuaded.

But if the developer has a problem with the common sense, it can not be solved.

To impair the functionality of the Expert Advisor only to go to the Market -- this is inadequate.

Reason: