Discussing the article: "Custom Indicator: Plotting Partial Entry, Exit and Reversal Deals for Netting Accounts"

 

Check out the new article: Custom Indicator: Plotting Partial Entry, Exit and Reversal Deals for Netting Accounts.

In this article, we will look at a non-standard way of creating an indicator in MQL5. Instead of focusing on a trend or chart pattern, our goal will be to manage our own positions, including partial entries and exits. We will make extensive use of dynamic matrices and some trading functions related to trade history and open positions to indicate on the chart where these trades were made.

As the title of the article suggests, this indicator only makes sense to use on an account with a netting accounting system. In this system, only one position of the same symbol is allowed. If we trade in one direction, the position size will increase. If the trade is made in the opposite direction, then the open position will have three possible options:

  1. The new trade has a lower volume -> the position is decreased
  2. Volumes are equal -> the position is closed
  3. The new trade has a higher volume -> the position is reversed


For example, on a hedging account, we can make two one-lot EURUSD Buy trades, which will result in two different positions for the same instrument. Making two one-lot EURUSD Buy trades on a netting account will result in the creation of a single two-lot position with the weighted average price of the two trades. Since the volumes of both trades were equal, the position price is the arithmetic mean of the prices of each of the trades.

Author: Daniel Santos