How to create an EA for three IADX values with MQL5

video
play-sharp-fill

 

  • Introduction and Objective:
    • The tutorial is dedicated to the adaptive directional movement index (iADX). The iADX is an indicator that helps identify the strength and direction of a trend. The tutorial aims to create a simplified version of the iADX expert advisor that calculates the current value for each of the three lines the indicator displays.
  • Initial Setup in MetaEditor:
    • Users are guided to open the MetaEditor by clicking a specific icon or pressing the F4 key.
    • A new file is initiated within the MetaEditor, named “simple iADX”.
  • Array Creation and Initialization:
    • Two arrays, “mypricearray0” and “mypricearray1”, are established to store price data for the last three candles.
    • The copyrates function is used to populate these arrays with price data.
  • iADX Definition and Calculation:
    • The iADX is defined using the built-in MQL5 function. It calculates based on the last thirteen candles.
    • The iADX values are stored in the arrays created earlier.
  • Signal Generation and Logic:
    • The expert advisor evaluates the iADX values. Depending on the iADX’s position relative to specific thresholds, it can indicate the strength and direction of a trend.
  • Testing and Visualization:
    • After coding, users are advised to compile the code.
    • The functionality is then tested in MetaTrader using the strategy tester, with visualization providing a real-time view of the expert advisor in action.
  • Conclusion and Further Learning:
    • The tutorial showcases the expert advisor’s capability to effectively calculate the iADX values for each of the three lines. This allows traders to understand the strength and direction of the market trend better.

By following this tutorial, users can effectively create an expert advisor that calculates the iADX values, providing insights into the market’s trend direction and strength.


Video Timestamps

  • 0:00 – Introduction to a simplified version of the Adaptive Directional Movement Index.
  • 0:30 – Explanation of the ADX value for each of the three lines of the indicator.
  • 1:00 – Hovering over the blue line to see the current ADX value.
  • 1:30 – Steps to create an Expert Advisor in MQL5 to calculate the ADX value.
  • 2:00 – Setting up the Expert Advisor in MetaEditor and initializing the code.
  • 2:30 – Creating a price information array and defining the ADX.
  • 3:00 – Explanation of the ADX indicator’s development in 1978 by J. Welles Wilder.
  • 3:30 – Sorting the price array and filling it with price data.
  • 4:00 – Calculating the ADX value for the current candle and outputting it on the chart.
  • 4:30 – Compiling the code in MetaEditor and ensuring no errors or warnings.
  • 5:00 – Testing the Expert Advisor in MetaTrader and observing the ADX value on the chart.

1. What is the primary focus of the tutorial?

  • The tutorial is dedicated to the adaptive directional movement index (iADX). The iADX is an indicator that helps identify the strength and direction of a trend. The tutorial’s goal is to create a simplified version of the iADX expert advisor that calculates the current value for each of the three lines the indicator displays.

2. How can users access the MetaEditor for coding?

  • Users can open the MetaEditor by clicking a specific icon or pressing the F4 key.

3. What is the purpose of the “simple iADX” file in MetaEditor?

  • The “simple iADX” file is initiated within the MetaEditor to code and develop the expert advisor that utilizes the iADX indicator for trading.

4. How are the arrays named “mypricearray0” and “mypricearray1” utilized in the tutorial?

  • The arrays “mypricearray0” and “mypricearray1” are designed to store price data for the last three candles. They are populated using the copyrates function.

5. How is the iADX oscillator defined and calculated?

  • The iADX is defined using the built-in MQL5 function and calculates based on the last thirteen candles.

6. How does the tutorial interpret the iADX values for trading signals?

  • The expert advisor evaluates the iADX values. Depending on the iADX’s position relative to specific thresholds, it can indicate the strength and direction of a trend.

7. What steps should be taken after coding the iADX-based expert advisor?

  • After the coding process, users should compile the code. The functionality of the created expert advisor is then tested in MetaTrader using the strategy tester, offering a real-time visualization of the expert advisor in action.

8. What is the significance of using the iADX indicator in MQL5?

  • The iADX indicator helps traders understand the strength and direction of the market trend better.

9. What can users achieve by following this tutorial?

  • By following this tutorial, users can effectively create an expert advisor that calculates the iADX values, providing insights into the market’s trend direction and strength.

10. Are there any suggestions for further learning?

  • The tutorial provides a comprehensive guide on using the iADX indicator in MQL5. Users can explore further customizations and applications of the iADX indicator in their trading strategies.