If you’ve got MetaTrader Error: OrderSend Error 130, it could mean a few different things go wrong. First, it may mean that your stop loss is very close to the market price. Second, it may mean that the profit you receive is very close to the market value. And thirdly, if you have a pending order, what should you do if you are trying to keep it very close to the market price?
Since there are many foreign brokers with different account types, you need to check the market information of your current account in your expert advisor to know the minimum stop level distance. Some accounts are 3 pip, others may be 15 pip.
The function you will use is called marketinfo. This requires two parameters, SYMBOL and TYPE. SYMBOL is the currency pair or security that you want to access and TYPE is the request identifier to specify the account you want to return to. Since we are looking for the lowest stop level, we will use the type, MODE_STOPLEVEL.
Double marketinfo (string symbol, int type)
int MinStopDist = MarketInfo (“EURUSD”, MODE_STOPLEVEL);
Once you have this data, you want to make sure that you do not try to take the place of stop loss or gain over this minimum distance from the market price. Additionally, you don’t want to try to place a pending order more than this distance from the current market price. If you are using an expert advisor who does not have the source code, you may want to look in the input value settings and see if there are any stop losses or minimum stop loss settings that you can change.