目录

EA 交易编程

https://smartforexlearning.com/mt4-ea-course-first-forex-expert-advisor/

https://www.cashbackforex.com/academy/mt4-expert-advisor

https://forexwikitrading.com/forex-robot/day-trading-lab-ea-mt4-forex/

https://bestmt4ea.com/category/mt4/expert-advisors/page/2/

https://www.fxcracked.com/free-ea/force-grider-forex-mt4-ea-free-download/

https://mt4cracked.com/posts/pfx-multi-currency-scalper-robot-free-download

Types of Orders

Market Order

Pending Order

Stop Order

Price

Spread

Price Format

Point

Pip

Fractional pip

Long positions

Short positions

Trade volume

Trade volume cont'd

Slippage

Minimum distance

Order Placement

Bid, Ask & Spread

As a Forex trader, you're probably already familiar with the Bid and Ask prices. But you might not be aware of their role in order placement. It is very important to use the correct price when opening or closing orders.

The Bid price is what you see on the MetaTrader charts. It is usually what we think of when we think of the “current price.” The Ask price is generally just a few pips above the Bid price. The difference between the Bid and the Ask is the the spread, which is the broker's commission for placing the order.

The Ask price is where we open buy orders, and close sell orders. The Bid price is where we open sell orders, and close buy orders. You'll need to indicate the correct price when opening a market order, or when closing an order at market, so remember the difference between the two.

Order Types

There are three types of orders that can be placed in MetaTrader: market, stop and limit orders. Market orders are the most common. A market order opens a position immediately at the prevailing Bid or Ask price.

When placing a market order in MQL, we must specify an opening price (generally the latest Bid or Ask quote). If the specified opening price is outdated, due to a fast moving market or a delay in program execution, the terminal will attempt to place the order at the current market price, provided it is within the maximum slippage.

If you place a market order using the New Order dialog in MetaTrader, you'll see a setting at the bottom labeled “Enable maximum deviation from quoted price.” When this is checked, you can then specify the maximum deviation in pips. This is the maximum slippage.

If the current price falls outside of our specified opening price, plus or minus the slippage, a requote error will occur and the order will not be placed. You may have noticed this when attempting to place a market order during a fast moving market. Note that ECN/STP brokers do not use a slippage setting, and will always open market orders at the current price.

A stop order is a type of pending order. Pending orders are a request to open a market order at a certain price. A buy stop order is placed above the current price, while a sell stop order is placed below the current price. The expectation is that the price will eventually rise or fall to that level and continue in that direction, resulting in a profit.

A limit order is the opposite of a stop order. A buy limit order is placed below the current price, while a sell limit order is placed above the current price. The expectation is that the price will rise or fall to that level, triggering the order, and then reversing. Limit orders are not used very often in automated trading.

An expiration time can be set for pending orders. If the order is not filled by the expiration time, the order is automatically deleted. Not all brokers support trade expiration.

The Order Placement Process

The process of placing an order in MQL involves several steps. We must determine the following before placing the order:

The OrderSend() function is used to place orders in MQL. The syntax is as follows:

int OrderSend(string Symbol, int Type, double Lots, double Price, 
int Slippage, double StopLoss, double TakeProfit, string Comment = NULL, 
int MagicNumber = 0, datetime Expiration = 0, color Arrow = CLR_NONE);

The OrderSend() function returns the ticket number of the order that was just placed. If no order was placed, due to an error condition, the return value will be -1.

We can save the order ticket to a global or static variable for later use. If the order was not placed due to an error condition, we can analyze the error and take appropriate action based on the returned error code.