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

 
Ihor Herasko:

I'm sorry, but where in your code is the value of StopLevel variable discussed? In the code you cited, there is no change in the value of this variable. There is a change of Stop and Profit values. As the result, if you increase them once, it will be impossible to return these values to their initial values. Thus, you will chase large stops and profits, while Stop Level has decreased long time ago.

I do not possess the information on many brokers (dozens, hundreds). With those brokers I have to deal with (as clients have accounts there), I see a figure of 2 spreads. Perhaps there is a different value somewhere.

In my opinion, this is fundamentally the wrong approach for a broker to provide information. There is a standard mechanism for getting restrictions on stopleaves. If we receive 0 on request, but in reality it is not zero. Then change it on every tick, depending on the spread value, as you need. My broker that correctly displays Stop Level is the only broker that has the right value.

I made a conclusion based on the function name - OnInitLevels. It is associated with a single action.

You're right, our functions are not similar, but the sense is the same,

When I change the internal variable, the external one remains the same and when the stop is bigger or smaller - then all internal variables are rearranged, everything is OK.

But min stop = assign spread *2 I will try what MetakvotesDemo server has to say.

 
Vitalii Ananev:

I did this

The Expert Advisor has the ability to adjust the stop in 3 ways. Manually set the stop size (StopLoss) or set it to zero.

If StopLoss is equal to zero, its size is calculated based on market conditions, but limited by StopLimit variable.

And in OnInit() these parameters are checked for correctness, because it makes no sense to put a stop below 10 points.

Yes, but what if the stop = 8, like in MetacvotesDemo Server?
 

I did this.

int OnInitLevels(string symToWorkmodify)
  {
   int stoplevel;
   stoplevel=SymbolInfoInteger(symToWorkmodify,SYMBOL_TRADE_STOPS_LEVEL);
   double ask=SymbolInfoDouble(symToWorkmodify,SYMBOL_ASK);
   double bid=SymbolInfoDouble(symToWorkmodify,SYMBOL_BID);
   double point=SymbolInfoDouble(symToWorkmodify,SYMBOL_POINT);
   int SPREAD=(ask-bid)/point;
   if(stoplevel==0)stoplevel=SPREAD*2;
   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<stoplevel)StopLosss=(int)stoplevel;else StopLosss=StopLoss;
   if(TakeProfit>0 && TakeProfit<stoplevel)TakeProfits=(int)stoplevel;else TakeProfits=TakeProfit;
   if(TrailingStop>0 && TrailingStop<stoplevel)TrallingStops=(int)stoplevel;else TrallingStops=TrailingStop;
   if(TakeProfitALL>0 && TakeProfitALL<stoplevel)TakeProfitsAver=(int)stoplevel;else TakeProfitsAver=(int)TakeProfitALL;
   if(TrailingStop>0 && TrailingStop<stoplevel)TrallingStops=(int)stoplevel;else TrallingStops=TrailingStop;

   return(0);
  }

I'll wait to hear what the moderator has to say.

 
Vitalii Ananev:

I did this

The Expert Advisor has the ability to adjust the stop in 3 ways. Manually set the stop size (StopLoss) or set it to zero.

If StopLoss is equal to zero, its size is calculated based on market conditions, but limited by StopLimit variable.

And in OnInit() these parameters are checked for correctness, because it makes no sense to put a stop below 10 points.

You shouldn't suggest this, your checks don't contain any reference to trading conditions on the account, the figures are coming from the ceiling
 
Alexander Bereznyak:
You can't suggest this, your checks don't have any reference to trading conditions on the account, the numbers are from the ceiling
They are from the ceiling here, I'm not going to write you the whole code of the Expert Advisor here. It's up to you whether you agree or not with my approach, I'm not going to force it on you.
 
Vladislav Andruschenko:
yes but if stop = 8 e.g. like the MetakwotsDemo server?
Do you mean stop loss = 8? In the example I set the minimum stop loss not based on trading conditions. But based on expediency and the trading strategy implemented in the EA.
 
Vitalii Ananev:
Do you mean stop level = 8? In the example I set the minimum stop loss size not based on trading conditions. But for reasons of expediency and the trading strategy implemented in the EA.

Yeah, I get it, strategy and so on.

it's not about strategy etc.

When you put an EA in the Market, they cut your strategy to check it, so they put a stop not 100 points as for a strategy but 1!

it turns out to be an error of 130, that's what I was asking about :-)

 
Vitalii Ananev:
Do you mean stop level = 8? In the example I set the minimum stop loss not based on trading conditions. It's based on expediency and the trading strategy implemented in the EA.
The reasonability may inadvertently conflict with the trading conditions in the account
 
Vladislav Andruschenko:

Yeah, I get it, strategy and so on.

it's not about strategy etc.

When you put an EA in the Market, they cut your strategy to check it, so they put a stop not 100 points as for a strategy, but 1!

it turns out to be an error of 130, that's what I was asking about :-)

That's what I was talking about. If the stop level is floating then either tie it to a spread like Alexander suggested or set some boundary conditions below which you cannot set the stop loss size.
 
Vitalii Ananev:
That's what I'm talking about, if the stop level is floating, then either tie it to the spread as Alexander suggested or set some boundary conditions below which you cannot set the stop loss size.

I checked for spread*2 - let's see what they say.

Reason: