GM Grid MT5 is a trading robot developed by the Forex Robot Easy Team. It is designed to implement a trading strategy based on Price Action signals. This code can be used as a sample to understand how the robot works.
To use this code, you need to have the following libraries installed:
- Trade.mqh
- ArrayObj.mqh
The code defines the following constants:
SYMBOLS_ALLOWED
: An array of symbols allowed for trading. Only symbols present in this array will be considered for trading.MIN_DEPOSIT_WITH_SL
: The minimum account balance required with a stop loss.MIN_DEPOSIT_WITHOUT_SL
: The minimum account balance required without a stop loss.
The code defines the following global variables:
trade
: An instance of theCTrade
class used for trading operations.symbolList
: An array to store the allowed symbols for trading.accountBalance
: The current account balance.
The OnInit
function is called when the robot is initialized. It performs the following tasks:
- Checks if the symbol is allowed for trading.
- Adds the allowed symbol to the
symbolList
array. - Checks the account balance.
- If stop loss is required, checks if the account balance is sufficient.
- If stop loss is not required, checks if the account balance is sufficient.
If the account balance is insufficient, an error message is printed and the initialization fails.
The IsStopLossRequired
function is called to determine if stop loss is required for trading. The logic to determine this requirement should be implemented in this function. The function should return true
if stop loss is required, and false
otherwise.
The TradePriceAction
function is called to implement the trading strategy based on Price Action signals. The trading strategy should be implemented in this function. It should determine entry and exit points, stop loss and take profit levels, and position sizing calculations.
In this sample code, the Buy
and Sell
functions of the CTrade
class are used to place trade orders. The symbol, volume, stop loss, and take profit levels are set to default values.
The OnTick
function is called on each tick of the market. It checks if the current symbol is in the symbolList
array, and if so, calls the TradePriceAction
function to execute the trading strategy.
The OnDeinit
function is called when the robot is deinitialized. It performs any necessary cleanup and finalizes the trading robot.
Note: ForexRobotEasy is not the official developer of this product. This code is provided as a sample that can work as described in the product. To find the official developer of this product, please use MQL5.
For detailed reviews and trading results of this product, please visit Forex Robot Easy - GM Grid MT5 Review.