Grids MRI
- Experts
- Thiago Nunes Bianchi
- Version: 1.0
- Activations: 5
This Expert Advisor implements the grid strategy.
The strategy consists of placing orders at different price levels above and/or below the opening price of the position, in quantity and distance defined by the user.
In this EA, the user has the option to choose between 3 types of grid:
1) Grid behind the initial position with orders in the same direction (average price)
If the asset price moves in the opposite direction of the initial position, at each new level reached, a new position will be opened, resulting in an increase in volume bought or sold at a temporary loss (famous average price). If the asset price returns to previous levels, open positions on the way out are closed on the way back with the respective profits. If the price does not return and continues on its way, the user has the option to set a financial stoploss.
2) Grid in front of the starting position with orders in the same direction (scale in)
If the asset price moves in the same direction as the initial position, at each new level reached, an order in the same direction will be placed on the previous level. If the price continues on its way without looking back, the position will continue with the same volume until it reaches the takeprofit, if defined by the user. If the price moves in the same direction as the initial position and returns to some previous level, a new position will be opened. New open positions will remain in this condition until the price moves again to new levels in the same direction as the initial position, when they will be closed with profit, or when stoploss or takeprofit is reached, if defined by the user.
3) Grid in front of the starting position with orders in the opposite direction
If the asset price moves in the same direction as the initial position, then at the first new level you will find an order in the opposite direction that will reverse the position. In the case of a long position, it will be closed with the profit defined by the user and a short position will be opened. At this moment, if the price continues its one-way movement, towards the initial position, the grid above the initial position will behave like grid type 1. If the price makes its way back and goes in the opposite direction of the initial position, again the grid will behave like type 3 and so on, until the position reaches stoploss or takeprofit.
The type 1 grid is cumulative with the other grids. Type 2 and 3 grids are alternatively, only one at a time can be used.
The user has the option of automating the entries of initial positions from the direction of a moving average, if it is pointed up it is a buy and if it is pointed up it is a sell. If the user wants to use the grid only for manual entries, he must select "false" in the "Use moving average for entries" parameter.
Grid strategies, in general, offer a high risk of financial losses, we recommend testing them in demo environments before using them on the real account, as well as using stoplosses.
Parameters:
//Lot size = Lot size
//Size of grid (each side) = For each side of the position, how many order lines
//Distance between grid (points) = Distance between each of the orders in points
//Grid behind of initial position = True to use Grid type 1
//Grid ahead of initial position = True to use Grids type 1 or 2
//Type of grid ahead = sameDirection for Grid type 2 and contraryDirection for Grid type 3
//Allow trades from this time (hh:mm) = Hour and minute from which the EA is allowed to work
//Don't trame from this time (hh:mm) = Hour and minute when the EA is no longer authorized to work
//Close all positions at this time (hh:mm) = Hour and minute when all positions are automatically closed
//Use fixed takeProfit = True to use fixed level of takeprofit
//Use monetary takeProfit = True to use takeprofit by value of profit
//Value of monetary takeProfit (profit) = Value of profit
//Use fixed stopLoss = True to use fixed level of stoploss
//Use monetary stopLoss = True to use stoploss by value of loss
//Value of monetary stopLoss (loss) = Value of loss
//Use moving average for entries = True to enter in positions automaticaly by direction of moving average
//Moving average periods = Number of moving avg periods
//Moving average method = Method of moving avg