
Code an hma-based trend-following strategy using 10-period fast and 200-period slow hmas to enter on retracements and harvest profits as the trend persists, exiting on directional change.
Define ea parameters in mql5, including metric, symbol, timeframe, and slippage. Learn to implement the on initialization and on tick functions, create the ea file, compile, and customize chart appearance.
Create trade objects by including the trade library, instantiate the Seatrade class, attach position info and info objects, and set the expert advisor magic number with pips-to-points slippage.
Enable dynamic calculation interval by updating the ontick function only when a new bar appears, using digits, point, and symbol info to fetch ask and bid prices.
Learn to calculate trade volume in MQL5 advanced by implementing risk inputs and an enumerated lot sizing system, including fixed, martingale, and balance-based options.
Develop buy and sell entry logic for an hma trend-following mql5 strategy, enforcing one trade per trend, with trade management variables for lot size, prices, and comments.
Develop an mql5 modify positions routine that updates stop loss and optionally uses break-even by iterating through positions, validating symbol and type, and applying new stop losses converted from pips.
Implement void functions to partially close pie traits and cell traits, and to close all or whole pi and cell trades based on signals and position checks.
Implement the onClick function to neutralize time, support, and time sold, perform sells and partial closes, and then close all positions, while the initialization deletes the trait object.
test and refine an mql5 expert advisor implementing a hma trend following strategy, focusing on close signals, debugging, and profit optimization.
Conclude by applying an hma trend following strategy within MQL5 to enhance your expert advisors portfolio, test results show promise, and empower informed traders to develop personal projects.
Trend following strategies are trading strategies which seek to determine if a market will move up or down for an extended period of time allowing us to trade in that direction and stay in that trend for as long as possible to maximize profits.
These trading strategies are based on the hypothesis that markets tend to move in one direction for extended periods. This means that if a market is moving upwards, it is likely to continue moving upwards, and if it is moving downwards, it is likely to continue moving downwards. The trend following strategy seeks to capitalize on these movements by trading in a particular direction for as long as the trend continues.
In this course I want us to code a trend following strategy and evaluate its profitability using the MQL5 trading language. We shall start by explaining the strategy rules and the trading logic of the strategy that we shall code together.
We shall then begin coding our EA from scratch by including a custom chart appearance which ensures that we can aesthetically view the activities of our EA when it’s loaded onto any chart. We shall then code the entry and trade management signals of the EA which will ensure that we trade only at specific market signals and we manage our trades uniquely throughout each trade’s lifecycle. This will ensure that our EA only trades in a certain way when market conditions avail themselves.
For those that are still finding their way with MQL5, as long as you understand the basics of MQL5, this course is for you. We will patiently guide you through every step of the strategy development process and walk you through every line of code we shall craft. Hopefully, by the end of the course, you will have gained the necessary skills to code similar trading strategies and be able to appreciate how trend following can be an asset and develop a trading strategy based on the ideas that you have learnt from this course to improve your trading strategies portfolio.
So hit hard on that enroll button now and join me in this incredible journey of coding a trend following trading system.