Skip to content

ForexRobotEasy/Stock-Trader-Hedge-MT5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Stock Trader Hedge MT5 - ReadMe

Program Description:

This code is for the Stock Trader Hedge MT5 program developed by the Forex Robot Easy Team. The program is designed to perform automated trading in the MetaTrader 5 (MT5) platform. The program uses various technical indicators to determine trading conditions and executes trades accordingly.

For detailed reviews and trading results of this product, please visit forexroboteasy.com. Please note that ForexRobotEasy is not the official developer of this product. We are only providing a sample code that can work as described in this product. To find the official developer of this product, please refer to MQL5.

Libraries Used:

The program includes the following necessary library:

  • Trade.mqh: This library provides the necessary functions and classes for trading operations in MetaTrader.

Constants:

The program defines the following constants:

  • MAX_TRADES: Maximum number of trades allowed.
  • TRADE_VOLUME: Volume of each trade.

Trading Advisor Initialization:

The program initializes the trading advisor using the CTrade class:

CTrade HedgeTrader;

Trading Function:

The code defines a trading function named Trade(). This function is responsible for checking available margin, obtaining technical indicators, and executing trades based on the trading conditions.

The trading function performs the following steps:

  1. Checks if there is enough margin to open a trade.
  2. Retrieves the values of various technical indicators (moving average, average true range, commodity channel index, stochastic oscillator, and relative strength index).
  3. Checks if the trading conditions are met.
  4. Opens a long position using the HedgeTrader.Buy() function if the conditions are met.
  5. Prints a message indicating the success or failure of opening a position.

Main Function:

The code defines the main function named OnTick(). This function is triggered on every tick and is responsible for determining if enough time has passed since the last trade, and if so, calls the Trade() function to perform a trade.

The main function performs the following steps:

  1. Checks if enough time has passed since the last trade (24 hours in this case).
  2. Calls the Trade() function to perform a trade if enough time has passed.

Deinitialization Function:

The code defines the deinitialization function named OnDeinit(). This function is triggered when the program is being deinitialized and is responsible for closing all open trades.

The deinitialization function performs the following steps:

  1. Closes all open trades using the HedgeTrader.CloseAll() function.
  2. Prints a message indicating that all open trades have been closed.

Please note that this ReadMe file only provides a brief overview of the code. For detailed reviews, trading results, and the official developer of this product, please refer to forexroboteasy.com or MQL5.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published