Why do dolls die the power of passivity and the embodied interplay between disability and sex dolls

Ошибка модификации ордера код ошибки 130

How to beat Ordersend Error 130 in MetaTrader 4

ordersend-error-130

By popular demand, proven strategies on how to beat every algorithmic trader’s worst nightmare – Error 130

The OrderSend Error 130 appears in MetaTrader 4 when an Expert Advisor can’t execute a marker order as expected. Also known as the Invalid Stop (ERR_INVALID_STOPS) in MQL jargon, the Error 130 happens when the TakeProfit and StopLoss levels are set to close to the current market price.

Where does this error come from? What does it mean for your Expert Advisor? How can you find the part of your code that is causing the error? We tackle all this and more…

Video Tutorial

Alright! Let’s go ahead and send some orders with OrderSend. The video below is available if you prefer watching instead of reading

To start off, a formal definition from our friend, MQL4 Documentation:

ERR_INVALID_STOPS

That’s right! That is all you get from MetaQuotes. And the rest… Go figure!

Ordersend Error 130 is briefly mentioned in other sections of the documentation. However, there is no thorough guide to what “Invalid Stops” actually means and how to deal with this, perhaps, most common problem in Forex programming.

But not a worry! That’s why I have written this article. Let’s get through this together!

The silent killer

So… you launched your expert advisor and… nothing happens. No BUY orders, no SELL orders, no pending orders, not even error messages in the logs…. Just silence. You decide to wait a few hours / days / weeks, and nothing really changes – the charts go up and down, but you don’t see any profit. This can go on forever…

The real reason is simple – you’re actually getting ERR_INVALID_STOPS (which is the correct technical term for the issue), but you can’t see it. That’s because 130 is a silent killer. A cold-blooded murderer of your brain and inner calm ?

There is no way to pick up this error through expert advisor logs or even terminal logs. The only way to catch it is by adding the right failsafe mechanisms into your code. Here’s an example you can adapt to your code:
int ticket;
ticket = OrderSend("EURUSD", OP_BUY, 1.0, Ask, 10, StopLossLevel, TakeProfitLevel, "My 1st Order!");

if(ticket < 0)
<
Alert(“OrderSend Error: “, GetLastError());
>
else
<
Alert(“Order Sent Successfully, Ticket # is: ” + string(ticket));
>
What we are doing here is taking the ticket number and that OrderSend() returns and checking if it is less than zero. If yes, then that is a signal from MetaTrader 4 telling us that there was a problem with the request.

The error code is then printed out onto the screen using Alert() and the built-in GetLastError() function. This code will give a pop-up window like in the image up at the top of this article.

Note: you can use Print() instead of Alert() to redirect the message straight to the EA’s log instead of displaying it on the screen.

Core of Ordersend Error 130

Invalid stops is the real name for the culprit we are dealing with today. So what does invalid stops in MetaTrader 4 actually mean?

As we can see, the issue is always with one (or many) of the prices that your Forex Robot specified in its request to the trade server. Now that we know our enemy – let’s beat it!

1) StopLoss & TakeProfit are prices

There are several possible causes of ERR_INVALID_STOPS, and one of the more frequent ones among beginners is specifying the StopLoss and TakeProfit in pips rather than actual price levels. Like this:
OrderSend(EURUSD, OP_BUY, 0.1, 1.1606, 10, 20, 40);
This person tried to set a StopLoss of 20 pips and a TakeProfit of 40 pips. Big NO-NO….. The correct and only way of specifying your SL and TP is through price levels:
OrderSend(EURUSD, OP_BUY, 0.1, 1.1606, 10, 1.1585, 1.1645);
By the way, here we assumed that the current ASK price is 1.1606 and current BID price is 1.1605 (i. e. 1 pip spread).

2) 4-digits vs 5-digits

Another reason you could be getting ERR_INVALID_STOPS is if you are setting the input parameters of your EA in Pips (4-digit points) when the Robot is anticipating 5-digit points. Let’s look at an example:
extern int StopLoss = 20;
extern int TakeProfit = 40;

OrderSend(EURUSD, OP_BUY, 0.1, Ask, 10, Bid-StopLoss*Point(), Bid+TakeProfit*Point());

This code will work fine on a 4-digit broker, however will fail on a 5-digit broker. The reason is that on a 4-digit broker, Point() equals to 0.0001, whereas on a 5-digit broker Point() equals to 0.00001.

Basically, with no additional adjustments, on a 5-digit broker the EA will be attempting to set the StopLoss and TakeProfit at only 2 and 4 pips away from the Bid price respectively!

That’s why in the case of a 5-digit broker you have to increase your StopLoss and TakeProfit parameters tenfold. Like this:
extern int StopLoss = 200;
extern int TakeProfit = 400;

OrderSend(EURUSD, OP_BUY, 0.1, Ask, 10, Bid-StopLoss*Point(), Bid+TakeProfit*Point());
However, be careful! Some EA’s already have modules that will detect the number of digits after the decimal and will automatically adjust your input parameters for you. In these situations multiplying inputs by 10 can actually lead to erroneous performance.

Note: I plan on posting a separate article where we will discuss how to create our own modules to detect the number of digits after the decimal

3) ECN brokers

ECN accounts have their own specifics. One of them is – when trading through a ECN broker you will not be able to set a StopLoss and/or TakeProfit with your Market Order (BUY or SELL). If you try to do this – you will get Error 130.

However, of course, you do need to set a StopLoss (and maybe TakeProfit) for your order, and this must be done as soon as possible after the order has been executed. Try this code:
int MarketOrderSend(string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment, int magic)
<
int ticket;

ticket = OrderSend(symbol, cmd, volume, price, slippage, 0, 0, NULL, magic);
if(ticket <= 0) Alert(“OrderSend Error: “, GetLastError());
else
<
bool res = OrderModify(ticket, 0, stoploss, takeprofit, 0);
if(!res) < Alert(“OrderModify Error: “, GetLastError());
Alert(“IMPORTANT: ORDER #”, ticket, ” HAS NO STOPLOSS AND TAKEPROFIT”);>
>
return(ticket);
>
You can add this function to your code (at the very end) and then use it instead of OrderSend() in your main code. This function adds an extra step in the process of sending a Market Order.

First, it send the request to execute a market order stripping out the StopLoss and TakeProfit. Next, it modifies the newly opened market order by adding the desired SL and TP.

There is, of course, a risk that the order will be executed, but the modification will fail. However, in that case the function will promptly notify the trader that the StopLoss and TakeProfit have not been set.

Feel free to modify this function to suit your needs and trading style.

4) Stop-Levels

Stop-Levels are a mechanism for brokers to protect themselves from certain volatility and liquidity related risks. In simple terms, you will not be able to set your StopLoss or TakeProfit OR any pending order closer than a predetermined number of Pips to the current market price.

To find out what the Stop Level is for a specific currency pair you need to press CTRL+U on your keyboard, select the desired currency pair and click the “Properties” button as shown on the illustration below:

forex-symbol-properties

In this example the Stop Level for AUDUSD is 3 Pips. This means that you will not be able to set the StopLoss for your order closer than 3 Pips to the price at which the order will be opened.

This also means that any pending order will have to be set at least 3 Pips away from the current market price.

If you Robot tries to break these rules and set a StopLoss / TakeProfit or Pending Order within the Stop Level range, then it will get Error 130 “Invalid Stops”. So just be mindful of the Stop Level of the currency where your EA’s are trading – don’t specify excessively small StopLoss and TakeProfit parameters.

It is also worth noting that more exotic currency pairs can have much more significant Stop Levels. Fore example, for AUDNZD the Stop Level with the same broker as in the above example is 20 Pips. For GBPSEK (British Pound vs Swedish Krone) – it’s 100 Pips.

5) Normalization of doubles

With some brokers you will find that for an unknown reason the Ask and Bid prices are passed onto the trader with additional negligible digits after the decimal. For example:

Instead of 1.1606 the broker would give you 1.160600001

Now this phenomenon has no effect on manual trading, moreover since the MT4 terminal is hardwired to display a certain number of digits after the decimal point (either 4 or 5) – you will not be able to notice any difference at all!

However, these ‘negligible’ digits after the decimal can have a dramatic effect on Expert Advisors causing……… that’s right! Our old friend, OrderSend Error 130!

Here’s a strategy that I personally use to protect my Robots from this issue:
void OnTick()
<
//.
OrderSend(EURUSD, OP_BUY, 0.1, ND(Ask), 10, ND(Bid-StopLoss*Point()), ND(Bid+TakeProfit*Point()));

double ND(double val)
<
return(NormalizeDouble(val, Digits));
>
This neat little trick allows you to normalize (in simple terms – Round) any prices that you are inputting into the OrderSend() function. This way you cut off all ‘negligible’ digits after the decimal point.

Conclusion

Today we saw that there may be multiple (at least 5) causes to error 130. Though this is quite a few, the underlying issues are all trivial and can be corrected in a matter of minutes.

Therefore, Error 130 should not be feared! If you have encountered this culprit, it’s just a matter of going through the list above, finding the situation that applies to you and applying the prescribed solution.

Hope you found this article useful!

Let me know if you have any questions by using the comments section below.

Ошибки кодов маркировки в УПД — как исправить

464-основа. png

Корректность передачи права собственности на маркированный товар при его продаже — важна как для продавца, так и для покупателя. ГИС МТ «Честный ЗНАК» сообщает об этом производителям, дистрибьютерам и рознице через оператора электронного документооборота (ЭДО).

Вероятная проблема

При обработке «Честным ЗНАКОМ» направленных ему участниками рынка универсальных передаточных документов (УПД) могут выявляться ошибки.

Например, статус кода маркировки не соответствует выполняемой операции. Или УПД содержит коды разных товарных групп. Или поставщик наклеил коды на товар, но забыл передать в «Честный ЗНАК» сведения о вводе товара в оборот.

Поэтому крайне важно всем участникам оборота маркированной продукции не допускать расхождений в информации в электронных документах на этапе отгрузки и во время приёмки.

«Такском-Файлер» поможет исправить ошибки

Когда стороны сделки подписывают УПД, оператор ЭДО «Такском», передаёт в ГИС МТ «Честный ЗНАК» информацию, содержащуюся в этом документе. После того, как «Честный знак» идентифицирует коды из УПД, сервис «Такском-Файлер», получает и показывает пользователю варианты ответа «Честного ЗНАКА»:

— получен положительный ответ;

— получен отрицательный ответ.

Последний вариант ответа указывает на допущенные ошибки, в том числе технические. «Такском-Файлер» делает их текстовое описание и рекомендует пользователю, как их исправить.

Ошибки и рекомендации

Описание ошибки

Рекомендация по действиям пользователя

Документ с таким номером уже зарегистрирован в ГИС МТ

Документ уже зарегистрирован в ГИС МТ.

Обратитесь на support@crpt. ru или направьте новый документ с уникальным номером или УКД/УПДи к направленному ранее документу.

Покупатель не зарегистрирован в ГИС МТ

Для успешной смены собственника оба участника оборота товаров должны быть зарегистрированы в системе ГИС МТ. Покупателю (получатель товара) необходимо зарегистрироваться в системе мониторинга ГИС МТ по ссылке.

Участник(и) (ИНН: <ИНН>) не зарегистрирован(ы) в ГИС МТ

Для успешной смены собственника оба участника оборота товаров должны быть зарегистрированы в системе ГИС МТ. Поставщику и Покупателю необходимо зарегистрироваться в системе мониторинга ГИС МТ по ссылке.

УКД № <номер>от <дата>не обработан. Не найден исходный УПД в ГИС МТ

Исходный УПД не поступал в систему мониторинга ГИС МТ или после поступления документа УПД уже был обработан корректирующий (исправительный) документ. Сведения в отношении переданных маркированных товаров в УПД на основании корректировочного документа не могут быть изменены. Проверьте отправку исходного УПД.

Коды маркировки <КМ>не найдены в ГИС МТ

В УПД должны указываться коды идентификации, присутствующие в личном кабинете ГИС МТ. Обратитесь к вашему поставщику за разъяснением. Коды маркировки, не найдены в ГИС МТ, не подлежат дальнейшей реализации (продаже).

У участника оборота (ИНН: <ИНН>) товаров нет полномочий на выполнение операции с кодом(ами) маркировки

Код(ы) маркировки не принадлежит(ат) в ГИС МТ отправителю товаров. Отправитель (Поставщик товара) должен обратиться на support@crpt. ru

Статус кода маркировки <КМ>не соответствует выполняемой операции

Поставщик товара должен ввести товар в оборот и сменить статус на товар в ГИС МТ на «В обороте». Коды идентификации, которые указаны в УПД, должны иметь статус в системе мониторинга «В обороте». Товар в Статусе «Эмитирован. Выпущен», «Эмитирован. Получен», «КМ выбыл» и особое состояние «Ожидает приемку» является некорректным и не может быть передан Покупателю.

Состав или имя документа некорректно

Необходимо проверить корректность поданных сведений. Требования к оформлению УПД указаны в Методических рекомендациях по оформлению электронных документов или обратитесь на support@taxcom. ru

Не заполнена дата исправления

Для корректировочных документов ИУПД и УКД необходимо проверить дату исправления. В случае её отсутствия необходимо её указать.

УПДи № <номер>от <дата>не бработан. Был проведен УПДи с более поздними номером или датой исправления

Было отправлено по очереди несколько УПДи. Корректировка информации в ГИС МТ проводится на основании документа, присланного с более поздней датой. Документ с более поздней датой считается итоговым.

Коды маркировки <КМ>некорректные

В УПД должны указываться коды идентификации, присутствующие в личном кабинете ГИС МТ. Требования к указанию кодов идентификации товаров и к экранированию специальных символов указаны в Методических рекомендациях по оформлению электронных документов. Коды указанные в документе имеют неверный формат. Отправитель (Поставщик товара) должен обратиться на support@crpt. ru

УПД\УКД № <номер>от <дата>не обработан. Содержит коды маркировки разных товарных групп

УПД содержит коды идентификации разных товарных групп (например: обувь и одежда), такой документ не может быть обработан. Необходимо формировать отдельные УПД в разрезе товарных групп.

УПД\УКД № <номер>от <дата>не обработан. Не содержит кодов маркировки

Оператор ГИС МТ обрабатывает УПД/УКД, подписанные двумя сторонами и содержащие сведения о маркированном товаре. Документ не содержит коды маркировки и не может быть принят в ГИС МТ.

Источники:

https://forexboat. com/ordersend-error-130/

https://taxcom. ru/baza-znaniy/markirovka-tovarov/novosti/oshibki-kodov-markirovki-v-upd-kak-ispravit/

Понравилась статья? Поделиться с друзьями:
Добавить комментарий

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: