How to create a Demarker Expert Advisor with MQL5

video
play-sharp-fill

 

  • Introduction and Objective:
    • The tutorial introduces the DeMarker indicator and its application in creating an expert advisor. The DeMarker indicator is designed to determine the strength of a trend. When the indicator line crosses the upper line, it might indicate the end of a trend, and when it’s below the lower line, it suggests a weak trend.
  • Initial Setup in MetaEditor:
    • Users are guided to open the MetaEditor by clicking on a specific icon or pressing the F4 key.
    • A new file is initiated within the MetaEditor, named “simple demarker”.
  • Array Creation and Initialization:
    • An array, “price data”, is established to store price data for the last three candles.
    • The copyrates function is used to populate the array with price data.
  • DeMarker Definition and Calculation:
    • The DeMarker indicator is defined using the built-in function. It calculates based on the last thirteen candles.
    • An array, “mypricearray”, is set up to store the DeMarker values.
  • Signal Generation and Logic:
    • The expert advisor evaluates the DeMarker values. When the indicator line is above the upper line, it might suggest the end of a trend. When it’s below the lower line, it indicates a weak trend.
    • The indicator’s value and its position relative to the price are displayed on the MetaTrader chart.
  • 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 trade based on the DeMarker indicator in MQL5. The DeMarker is a versatile tool that can be combined with other indicators to enhance trading strategies.

By following this tutorial, users can effectively create an expert advisor that trades based on the DeMarker indicator, allowing for informed trading decisions based on the indicator’s signals.


Video Timestamps

  • 0:00 – Introduction to the Demarker indicator and its significance in trading.
  • 0:30 – Explanation of the two levels in the Demarker indicator: 0.3 (weak trend) and 0.7 (strong trend).
  • 1:00 – The significance of the indicator line crossing the upper line, indicating the end of a trend.
  • 1:30 – Steps to create an Expert Advisor using the Demarker indicator in MetaTrader 5.
  • 2:00 – Setting up the Expert Advisor in MetaEditor and initializing the code.
  • 2:30 – Defining the properties of the Demarker indicator and creating a price array.
  • 3:00 – Sorting the price array and filling it with data using the Copy Buffer function.
  • 3:30 – Extracting the Demarker value for the current candle and displaying it on the chart.
  • 4:00 – Compiling the Expert Advisor and testing it in MetaTrader.
  • 4:30 – Observing the Demarker indicator’s movement on the chart and its trading implications.
  • 5:00 – Conclusion on creating an Expert Advisor using the Demarker indicator with MQL5 code.

Related Questions and Answers:

  1. What is the primary focus of the tutorial?
    • The tutorial is centered on the DeMarker indicator and its application in creating an expert advisor in MQL5. The DeMarker indicator is used to determine the strength of a trend.
  2. How can users access the MetaEditor for coding?
    • Users can open the MetaEditor by clicking on a specific icon or pressing the F4 key.
  3. What is the purpose of the “simple demarker” file in MetaEditor?
    • The “simple demarker” file is initiated within the MetaEditor to code and develop the expert advisor that trades based on the DeMarker indicator signals.
  4. How is the array named “price data” utilized in the tutorial?
    • The “price data” array is designed to store price data for the last three candles. It is populated using the copyrates function.
  5. How is the DeMarker indicator defined and calculated in the tutorial?
    • The DeMarker indicator is defined using a built-in function and is calculated based on the last thirteen candles. An array named “mypricearray” is set up to store the DeMarker values.
  6. How does the expert advisor generate trading signals based on the DeMarker indicator?
    • The expert advisor evaluates the DeMarker values. When the indicator line is above the upper line, it might suggest the end of a trend. When it’s below the lower line, it indicates a weak trend. This signal and its position relative to the price are displayed on the MetaTrader chart.
  7. How are the results of the expert advisor displayed to the user?
    • The results, including the indicator’s value and its position relative to the price, are displayed directly on the MetaTrader chart.
  8. What steps should be taken after coding the expert advisor?
    • After coding, users should compile the code. The functionality is then tested in MetaTrader using the strategy tester, with a visual mode providing a real-time view of the expert advisor in action.
  9. How does the tutorial view the DeMarker indicator in the context of broader trading strategies?
    • The DeMarker is a versatile tool that can serve as a standalone indicator, but the tutorial mentions that it’s often paired with other indicators to enhance trading strategies.
  10. What can users achieve by following this tutorial?
  • By following this tutorial, users can effectively create an expert advisor that trades based on the DeMarker indicator, allowing for informed trading decisions based on the indicator’s signals.