OrderSend Error 130: No Stop Loss Issue

 

The following code generated an error even though no stop loss was set.

int buy = OrderSend(Symbol(), OP_BUYLIMIT, LOT, Open[0], SLIPPAGE, 0, 0, "buy", 9999, 0, clrRed);

The error codes are as follows

2023.05.08 00:08:39.964 2022.07.28 12:45:00  fenix BTCUSDT,M15: OrderSend error 130
 

Please don't post randomly in any section. MT4/mql4 has it's own section on the forum.

I have moved your topic to the correct section. Please don't create another topic.

 
kyupy: The following code generated an error even though no stop loss was set. The error codes are as follows

This has already be discussed on the forum multiple times. Please do a search before posting.

It is very easy: type something (what you need) in the search area (top right corner of the page) and search.

 

 
Also read the following ... Requirements and Limitations in Making Trades
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
  • book.mql4.com
Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial
 
By the way, there is also a Japanese forum if you prefer to communicate in Japanese.
kyupy
kyupy
  • 2023.05.06
  • www.mql5.com
トレーダーのプロファイル
 
Fernando Carreiro #:

Please don't post randomly in any section. MT4/mql4 has it's own section on the forum.

I have moved your topic to the correct section. Please don't create another topic.

I'm sorry. I'll be careful next time.
 
Fernando Carreiro #:

This has already be discussed on the forum multiple times. Please do a search before posting.

It is very easy: type something (what you need) in the search area (top right corner of the page) and search.

 

I tried looking for it but could not find it.
 
kyupy:
int buy = OrderSend(Symbol(), OP_BUYLIMIT, LOT, Open[0], SLIPPAGE, 0, 0, "buy", 9999, 0, clrRed);
  1. Always post all relevant code (using Code button) or attach the source file.
         How To Ask Questions The Smart Way. (2004)
              Be precise and informative about your problem

  2. We can't know what LOT, Open[0], SLIPPAGE are, or what the Bid was at the time you tried to make the order.

    At the first tick of a new bar, Open[0] equals Close[0] equals Bid. You can't create a pending order at the current market price.

    You can't create a pending order closer to market than the minimum: MODE_STOPLEVEL * _Point or SymbolInfoInteger(SYMBOL_TRADE_STOPS_LEVEL).
              Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial

    On some ECN type brokers, the value might be zero (the broker doesn't know). Use a minimum of two (2) PIPs.

    The checks a trading robot must pass before publication in the Market - MQL5 Articles (2016)

  3. There is no need to create pending orders in code.

    1. The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)

      Don't worry about it unless you're scalping M1 or trading news.

    2. Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.

 

Resolved, thank you. I am a beginner and didn't really understand the rules. Next time I will properly present all the codes involved in the code.