Discussing the article: "Introduction to MQL5 (Part 13): A Beginner's Guide to Building Custom Indicators (II)"
Hi Isreal,
Thanks for the blog, time and effort.
I would like ask you about your Heikin Ashi custom indicator code.
On the Heikin Ashi Open formula :
// HEIKIN ASHI OPEN FORMULA
HA_Open[i] = (HA_Open[i - 1] + HA_Close[i - 1]) / 2.0;
Since you have not compute the HA_Open[i - 1). Wouldn't this be 0?
My suggestion :
if (i == 1){
HA_Open[i] = (open[i - 1] + close[i - 1])/2.0; // On HA first bar just use the normal open/close data
}
else{
// HEIKIN ASHI OPEN FORMULA
HA_Open[i] = (HA_Open[i - 1] + HA_Close[i - 1]) / 2.0;
}
Hi Isreal,
Thanks for the blog, time and effort.
I would like ask you about your Heikin Ashi custom indicator code.
On the Heikin Ashi Open formula :
// HEIKIN ASHI OPEN FORMULA
HA_Open[i] = (HA_Open[i - 1] + HA_Close[i - 1]) / 2.0;
Since you have not compute the HA_Open[i - 1). Wouldn't this be 0?
My suggestion :
if (i == 1){
HA_Open[i] = (open[i - 1] + close[i - 1])/2.0; // On HA first bar just use the normal open/close data
}
else{
// HEIKIN ASHI OPEN FORMULA
HA_Open[i] = (HA_Open[i - 1] + HA_Close[i - 1]) / 2.0;
}
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Introduction to MQL5 (Part 13): A Beginner's Guide to Building Custom Indicators (II).
This article guides you through building a custom Heikin Ashi indicator from scratch and demonstrates how to integrate custom indicators into an EA. It covers indicator calculations, trade execution logic, and risk management techniques to enhance automated trading strategies.
Welcome back to our MQL5 series! Part 12 of this series explored the fundamentals of building custom indicators in MQL5. We created a Moving Average indicator from scratch, implementing its logic manually instead of relying on built-in functions. Then, we extended this knowledge by transforming it into a Moving Average in candle format, demonstrating how to manipulate graphical elements within an indicator.
Building on that foundation, this article will introduce more interesting concepts in indicator development. We will use a project-based approach as usual to make sure you understand topics by putting them into practice. The creation of a Heikin Ashi indicator and the calculation of a Moving Average utilizing its data will be the main objectives. After these indicators are built, we will develop an Expert Advisor that incorporates the Heikin Ashi and Moving Average indicators. Even those who are new to MQL5 can follow along because this is a beginner-friendly article. To assist you in understanding not only how the implementation functions but also why each step is required, every line of code will be thoroughly explained.
This article will cover a strategy that is solely intended for educational purposes. It is not meant to be a trading strategy that guarantees success or financial advice. Before using strategy in live trading, always test them in a risk-free setting.
Author: Israel Pelumi Abioye