In today’s tutorial we will learn how to use the OrderSend function. OrderSend is an MQL4 trade function which is used to place Buy and Sell orders on the Forex Market. Once an order is placed you will be able to see it in Meta Trader 4 just like you can view any other position.
In this tutorial we will focus on the StopLoss and TakeProfit parameters. In the previous tutorial we learned how to use extern variables to allow input of parameters by the trader. The external values were used to calculate the StopLoss and TakeProfit levels, which we will use in the OrderSend function today.
Another important parameter is cmd variable, which is used to specify the direction of your intended trade. In the video below I will show you how to use the OP_BUY keyword to execute a Buy transaction. Similarly, OP_SELL can be used to execute Sell orders.
Here is a list of other parameters that the OrderSend function allows you to input:
string symbol, // symbol
int cmd, // operation
double volume, // volume
double price, // price
int slippage, // slippage
double stoploss, // stop loss
double takeprofit, // take profit
string comment=NULL, // comment
int magic=0, // magic number
datetime expiration=0, // pending order expiration
color arrow_color=clrNONE // color
We will discuss most of these parameters in today’s tutorial. However, more information can always be found on the MetaQuotes’ official website: OrderSend Reference
Alright! Let’s go ahead and send some orders with OrderSend.
Remember – the code for this tutorial is located beneath the video.
Enrol in the full course here: https://forexboat.com/learn-mql4