Discussing the article: "Understanding order placement in MQL5"

 

Check out the new article: Understanding order placement in MQL5.

When creating any trading system, there is a task we need to deal with effectively. This task is order placement or to let the created trading system deal with orders automatically because it is crucial in any trading system. So, you will find in this article most of the topics that you need to understand about this task to create your trading system in terms of order placement effectively.

Order: is a request received by the trading server to open a buy or sell trade with a specific lot or volume at a specific price. There are two types of orders, the market order and the pending order.

  • Market order: an order that can be executed immediately at the current market price.
  • Pending order: an order that executes the trade at predetermined conditions concerning the price to execute the trade at its level and the time to execute the trade. 

These pending orders can be one of the following:

    • Buy stop: Place a buy pending order at a specific price that is above the current price in the market.
    • Buy limit: Place a buy pending order at a specific price that is below the current price in the market.
    • Sell stop: Place a sell pending order at a specific price that is below the current price in the market.
    • Sell limit: Place a sell pending order at a specific price that is above the current price in the market.

Once the order placed, regardless of whether it is a market or pending order, it can be found in the Trade tab of the Toolbox in the MetaTrader 5. The following is an example:

1- trade tab


When the order is closed or canceled without execution, we can find them in the History tab of the Toolbox.

2- history tab

When we want to modify a current position by MQL5, we need to deal with these orders the same as we will see later when handling order modifying.

Author: Mohamed Abdelmaaboud

 

hello,


great text, tyvm.

I have found 1 small bug:

in the box under   TRADE_ACTION_SLTP you have written twice request.sl, the second one should be request.tp, as indicated in the comment at the end of the line.


Best Regards,

Gunther

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Trade Operation Types
  • www.mql5.com
Trade Operation Types - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
gunther64 #:

hello,


great text, tyvm.

I have found 1 small bug:

in the box under   TRADE_ACTION_SLTP you have written twice request.sl, the second one should be request.tp, as indicated in the comment at the end of the line.


Best Regards,

Gunther

Hello,

Thanks for your kind comment. You are correct, it is a mistake and it will be considered.


Regards,