How to identify doji candles with MQL5

video
play-sharp-fill

 

  • Introduction and Objective:
    • The tutorial addresses the topic of identifying a “Doji” candle pattern on a chart using MQL5. A Doji is a candlestick pattern where the open and close prices are virtually the same. The tutorial aims to create a simple expert advisor that can detect a Doji on a chart.
  • Initial Setup in MetaEditor:
    • Users are guided to open the MetaEditor and initiate a new file named “simple Doji”.
  • Array Creation and Initialization:
    • Two arrays, “mypricearray0” and “mypricearray1”, are created to store price data for the last three candles.
    • The copyrates function populates these arrays with the necessary data.
  • Doji Detection Logic:
    • The tutorial provides logic to determine if the last open price equals the last close price. If they are equal, it’s identified as a Doji. The expert advisor then outputs whether the last candle was a Doji or not.
  • Testing and Visualization:
    • Users are shown how to test the functionality in MetaTrader using the strategy tester. The visual mode displays the text “candle one is not a Doji” by default, but this changes whenever a Doji is detected on the chart.
  • Conclusion and Further Learning:
    • The tutorial demonstrates the capability to detect a Doji on a chart using MQL5. By following the steps, users can identify Doji patterns in real-time, aiding in their trading decisions.

By following this tutorial, users can effectively spot a Doji on their trading charts, providing a visual cue for potential market reversals or continuations.


Video Timestamps

  • 0:00 – Introduction to the topic of detecting candle patterns like Doji.
  • 0:30 – Explanation of what a Doji is and its significance in trading.
  • 1:00 – Different types of Doji: Grave Stone Doji and Dragon-Fly Doji.
  • 1:30 – Steps to create an Expert Advisor in MQL5 to detect a Doji on the chart.
  • 2:00 – Setting up the Expert Advisor, naming it, and initializing the code.
  • 2:30 – Using MQLrates to create an array for price information and sorting it.
  • 3:00 – Copying price data into the array and checking if the last open price equals the last close price.
  • 3:30 – Outputting the result on the chart to indicate if the last candle is a Doji or not.
  • 4:00 – Testing the Expert Advisor in MetaTrader and observing the results.

1. What is the primary focus of the tutorial?

  • The tutorial addresses the topic of identifying a “Doji” candle pattern on a chart using MQL5. A Doji is a specific candlestick pattern where the open and close prices are virtually the same.

2. How can users access the MetaEditor for coding?

  • Users are guided to open the MetaEditor and initiate a new file named “simple Doji”.

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

  • The “simple Doji” file is initiated within the MetaEditor to code and develop the expert advisor that detects a Doji candle pattern on a chart.

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 does the tutorial detect a Doji candle pattern?

  • The tutorial provides logic to determine if the last open price equals the last close price. If they are equal, it’s identified as a Doji. The expert advisor then outputs whether the last candle was a Doji or not.

6. How can users test the functionality of the Doji detection expert advisor?

  • Users are shown how to test the functionality in MetaTrader using the strategy tester. The visual mode displays specific text related to the detection of a Doji on the chart.

7. What is the significance of detecting a Doji candle pattern on a chart?

  • A Doji candle pattern can serve as a visual cue for potential market reversals or continuations, aiding traders in their decision-making process.

8. What default message is displayed in the visual mode of the strategy tester?

  • The visual mode displays the text “candle one is not a Doji” by default, but this changes whenever a Doji is detected on the chart.

9. What can users achieve by following this tutorial?

  • By following this tutorial, users can effectively spot a Doji on their trading charts, providing a visual cue for potential market reversals or continuations.