The Hull Moving Average (HMA), created by Alan Hull, is fast and smooth. It almost eliminates lag and improves smoothing at the same time. The HMA accomplishes this by incorporating weighted moving averages and a square root of the period to adjust for the lag. This robot will automatically open and close positions based on this indicator.
This Strategy works well with XAUUSD or GOLD using trading hours **
Traders use the Hull Moving Average to identify trends and potential reversal points in the price of an asset, as it is smoother than traditional moving averages and reacts faster to price changes, making it popular among traders who prefer less lag in their indicators.

You can purchase his book on Trading Tactics at Goodreads here.
How This cBot Opens and Closes Trades
The Hull Moving Average Strategy cBot makes trading decisions on the close of each bar, using changes in HMA direction to determine entries. It only opens a position when the trend flips and prevents duplicate trades in the same direction.
Entry logic
-
On a bullish HMA signal, the cBot prepares to open a long trade; on a bearish signal, it prepares to open a short trade.
-
Trades are only opened on the first bar after a signal change, tracked internally to prevent repeated entries.
-
Before placing an order, the cBot checks that auto-trading is enabled, the current spread is below the maximum allowed, and trading is within your defined sessions (if enabled).
Order placement and sizing
-
Orders are placed at the market price in the signal direction.
-
For crypto, the lot size is used directly; for other instruments, it is converted to the broker’s volume units and rounded to a valid size.
-
Stop loss and take profit are only applied if their values are greater than zero.
-
Alerts can be sent by email, pop-up, or Telegram, depending on your settings.
Duplicate trade prevention
Exit rules
-
Close on reverse: If enabled, the cBot closes an opposite position as soon as a new signal appears.
-
Stop loss and take profit: Positions are closed automatically if the price hits the protective levels you set.
-
Trailing stop: If enabled, the stop moves when price advances by the trigger amount, then adjusts in steps as the trade moves further into profit.
Risk and session controls
-
Spread filter: No trades are opened if the spread exceeds the maximum set.
-
Trading sessions: Up to two daily trading windows can be set; no new trades open outside these times.
-
News protection: When a flagged news event is approaching, the cBot pauses trading. If the close option is enabled, it will also close all open trades for the symbol until the event passes.
This ensures entries are based on confirmed trend changes, exits follow your chosen rules, and all trades are managed within your risk and time constraints.
How the Indicator Generates a Bullish Signal
The Hull Moving Average Signals indicator calculates a smoothed moving average line using a multi-step weighted moving average process. A bullish signal occurs when this line changes direction and begins to rise compared to the previous bar. This upward slope is detected by the algorithm and interpreted as a potential shift to upward market momentum.
When a bullish condition is identified:
-
The internal IsBullish
flag is set to true, and the IsBearish
flag is set to false.
-
The trend label changes to BUY and is displayed in green on the chart.
-
If arrow display is enabled, a green ▲ arrow appears below the bar at the point of the signal to highlight the new bullish condition visually.
This visual and programmatic change allows the cBot or a trader to instantly recognise the start of a potential uptrend and take action in line with their trading plan.
You Can Use It For Trading Signals
You can turn auto-trading off and use it as an alert system; it provides both a Windows pop-up and an email alert.
- Symbol: XAUUSD
- Timeframe: Hour
- Time: 12:34
- Price: 1325.00
- HMA Result value: 38
- Trade direction: Buy
How is the Hull MA Calculated?
The Hull Moving Average calculates the weighted moving average (WMA). First, you calculate the WMA with the period (n / 2) and multiply this by 2. Then, you calculate the WMA for the period “n” and subtract. The last step is calculating the weighted moving average with a period sqrt (n) using the data.
Hull MA= WMA (2*WMA (n/2) − WMA (n)), sqrt (n))
‘n’ is the period configurable based on the trader’s requirement.

How Do We Capture a Trend?
The robot will take a long position if prices are rising and the HMA is trending upwards, and it can take a short position if the prevailing trend is falling. It also works very well as a reversal filter, as the exit signals are reliable. The Hull MA is better than the other moving average indicators as it is more dynamic regarding price activity while maintaining a smooth curve.
Advanced Risk Management Features
An automated strategy that relies primarily on technical indicators will need protection against high-impact market events like news releases or even low liquidity when the spreads are so high that when new positions are opened, they could be many pips down from the start.
Features
- Max spread: You can set a limit so a position will not open if the symbol spread is too high.
- Stop loss and take profit.
- Trailing stop with pip step - when the price gains a set amount of pips to stop loss is moved (x) pips behind the price, and as the price increases, it is adjusted to a set amount of pips (step).
- Trading hours #1—You can set the hours you want the robot to open new positions. Sometimes it is best avoided, but open positions will still be managed, and this can be a morning session.
- Trading hours #2 - this can be the afternoon session.
Trading Hour Sessions Explained
We found that on certain symbols, the best results are achieved when using two trading sessions and avoiding lunchtimes and after 6 p.m. High-impact news releases or other market events can cause losses.
Instant Telegram Message Alerts
You can configure this trading robot to also send instant Telegram alerts directly to your PC, Tablet or mobile phone.
This Strategy Works With All Symbols
We ran back-tests on the following symbols using a broker that supports indices. If you use a different broker, you may need to change the symbol name when you load the example parameters.
Adjustable Settings & Features
We have ensured you are not buying a strategy that opens and closes positions when the indicators are oversold or overbought. We have included the most valuable risk management and alert features you will need to get the most out of this robot.
If you are trading a cryptocurrency, make sure you set the Trading Cryptocurrency parameter to Yes; for all other symbols, set this to No

Watch Hands-On Video Tutorials
The video has been uploaded in 1080p High Quality, so remember to set your YouTube video quality to 1080p HD.
Duration: 9 minutes

How To Optimize Robot Settings
With the advanced optimization feature of cTrader, you can find the optimal set of parameters for your cBot.
Duration: 10 minutes
How To Install & Remove
First, make sure you have the cTrader trading platform installed. Then, unzip the file and double-click it to install it on the platform automatically.
Any Questions?
If you have any questions, please first search our product help forum for the answer, and if you cannot find it, post a new question.
Need a Broker
If you are still looking for a trustworthy broker, look at our best cTrader broker site.
Need Coding Help?
If you need help creating your own customised automated trading system, contact our development team for a quote.