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

 

Baffle,

I can't figure out the reason.

Min stop on server 18 pips

message in the logbook:

2016.04.06 08:32:02     Core 1  2016.01.05 21:36:00   Result = 10016 symbol EURUSD volume 0.01 action 1 tp 1.07441 sl 1.07389 type 0 price 1.07415   Invalid stops in the request
2016.04.06 08:32:02     Core 1  2016.01.05 21:36:00   failed instant buy 0.01 EURUSD at 1.07415 sl: 1.07389 tp: 1.07441 [Invalid stops]

trade open price = 1.07415

Stop Loss = 1.07389 = 26 pips

TakeProfit = 1.07441 = 26 pips

And still writes wrong stops.

 
Vladislav Andruschenko:

Baffle,

I can't figure out the reason.

Min stop on server 18 pips

message in the logbook:

trade open price = 1.07415

Stop Loss = 1.07389 = 26 pips

Take Profit = 1.07441 = 26 pips

And still writes wrong stops.

Is your'slippage' not bigger than 'Min server stop 18 pips'?
 

Slipage= 2 spreads

that works out to 20 pips, more yes.

 
Vladislav Andruschenko:

Slipage= 2 spreads

that works out to 20 pips, more yes.

So calculate - the slippage is more than the SL, TP set level.

To avoid this, I first open SL; TP=0 and then modify SL; TP= Ask-26*_Point

If not, min stop level should be calculated from the price +- Slipage.

 

Thank you. I'll ponder on the slippage - but I've never had such problems. the code has always worked, but after the penultimate build (since December) if you set the server min level to stops - it doesn't open and that's it.

 
Vladislav Andruschenko:

Min stop on server 18 pips

Deal open price = 1.07415

Stop Loss = 1.07389 = 26 pips

TakeProfit = 1.07441 = 26 pips

But it still writes wrong stops.

Stop for buy should be counted from Bid price (at which it will trigger).

And you have only 16 pips from the SL to the Bid.

 

So what prevents you from pushing back the TP/SL when an error occurs? Catch an error - move the spread, catch it again - move it again...

 
Taras Slobodyanik:

So what prevents you from pushing back the TP/SL when an error occurs? Catch an error - move the spread, catch it again - move it again...

No, you need to get it right the first time. The code should work without errors )
 
Igor Volodin:
Nah, you have to guess it right the first time. The code should work without errors.)

Exactly

Andrey Khatimlianskii:

Stop for buy should be based on the Bid price (at which it will trigger).

And you have only 16 pips from the SL to the Bid.

The spread is counted there, the spread was 8 pips. + min stop 18=26 pips.

here at 27 everything is ok.

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

And for sell from Bid.

//Вычисляем стоплосс
   if(StopLoss!=0)sl=MarketInfo(Symbol(),MODE_ASK)-StopLoss*Point; else sl=0;
// ВЫчисляем тейкпрофит
   if(TakeProfit!=0)tp=MarketInfo(Symbol(),MODE_ASK)+TakeProfit*Point; else tp=0;
   OPs(Symbol(),OP_BUY,GetSizeLot(),sl,tp,Magic,"");

//Вычисляем стоплосс
   if(StopLoss!=0)sl=MarketInfo(Symbol(),MODE_BID)+StopLoss*Point; else sl=0;
// ВЫчисляем тейкпрофит
   if(TakeProfit!=0)tp=MarketInfo(Symbol(),MODE_BID)-TakeProfit*Point; else tp=0;
   OPs(Symbol(),OP_SELL,GetSizeLot(),sl,tp,Magic,"");
 
Igor Volodin:
No, you have to guess right from the first time. The code should work without errors )

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 indentation.

Reason: