Xmaster (XHMaster) MT5 formula indicator | Forex indicator download - MetaTrader 5 resources
The Xmaster formula indicator combines Moving Average (MA) and MACD to identify trend strength and direction. The Xmaster Formula Metatrader 5 indicator uses green and red arrows to provide traders with entry signals.
A member of the TradingFinder development team stated:
"Some users mistakenly searched for XHmaster instead of Xmaster (designed for market trend identification). This error led to some confusion about its functionality and accessibility. The correct name of the tool is Xmaster."
Xmaster formula specification sheet
Specifications of Xmaster Formula Indicator are shown in the table below:
| Indicator categories: | Oscillator MT5 Indicator MT5 Volatility Indicator Bands and Channels MT5 Indicators |
| Platforms: | MetaTrader 5 Indicators |
| Trading Skills: | Elementary |
| Indicator Types: | Inverse MT5 Indicator |
| Time frame: | Multi Time Frame MT5 Indicators |
| Trading Style: | Intraday MT5 Indicators |
| Trading Tools: | Forex MT5 Indicator Cryptocurrency MT5 Indicator Stock MT5 Indicator Commodity MT5 Indicator Index MT5 Indicator Forward MT5 Indicator Stock MT5 Indicator |
Xmaster formula code
The following is part of the Xmaster (XHMaster) formula code for MT5:
The code provided is intended for educational purposes to demonstrate concepts and logic and is not intended to be a final or ready-to-use version.
//+------------------------------------------------------------------+ENUM_MA_METHOD ma_method = MODE_SMMA ;
//| XMaster formula|
//|all rights reserved© tradefinder.com 2023 -2025 |
//+------------------------------------------------------------------+
# property index_alone_window
# property indicator_buffers 6
# property indicator_plots 4
# property indicator_color1 clrLime
# property indicator_color2 clrRed
# property indicator_color3 clrYellow
# property indicator_color4 clrYellow
# include < MovingAverages . mqh >
// === Inputs ===
input bool alert_on = true ;
input bool alert_sound = false ;
input bool alert_email = false ;
// === Buffers ===
double tmp [ ] , line [ ] , green_line [ ] , red_line [ ] , up_arrow [ ] , down_arrow [ ] ;
// === global variables===
int period1 = 40 ;
int period2 , period3 , ma1_handle , ma2_handle , digs ;
ENUM_APPLIED_PRICE applied_price = PRICE_LOW ;
datetime last_alert = 0 ;
int stoploss_points = 200 ;
//+------------------------------------------------------------------+
//|Initialization|
//+------------------------------------------------------------------+
int OnInit ( ) {
IndicatorSetString ( INDICATOR_SHORTNAME , "Master X Formula" ) ;
SetIndexBuffer ( 0 , green_line , INDICATOR_DATA ) ; PlotIndexSetInteger ( 0 , PLOT_DRAW_TYPE , DRAW_ARROW ) ; PlotIndexSetInteger ( 0 , PLOT_ARROW , 108 ) ;
SetIndexBuffer ( 1 , red_line , INDICATOR_DATA ) ; PlotIndexSetInteger ( 1 , PLOT_DRAW_TYPE , DRAW_ARROW ) ; PlotIndexSetInteger ( 1 , PLOT_ARROW , 108 ) ;
SetIndexBuffer ( 2 , up_arrow , INDICATOR_DATA ) ; PlotIndexSetInteger ( 2 , PLOT_DRAW_TYPE , DRAW_ARROW ) ; PlotIndexSetInteger ( 2 , PLOT_ARROW , 225 ) ; PlotIndexSetInteger ( 2 , PLOT_LINE_WIDTH , 5 ) ;
SetIndexBuffer ( 3 , down_arrow , INDICATOR_DATA ) ; PlotIndexSetInteger ( 3 , PLOT_DRAW_TYPE , DRAW_ARROW ) ; PlotIndexSetInteger ( 3 , PLOT_ARROW , 226 ) ; PlotIndexSetInteger ( 3 , PLOT_LINE_WIDTH , 5 ) ;
SetIndexBuffer ( 4 , line , indicator calculation ) ;
SetIndexBuffer ( 5 , tmp , indicator calculation ) ;
for ( int i = 0 ; i < 6 ; i ++ ) PlotIndexSetInteger ( i , PLOT_DRAW_BEGIN , period1 + 1 ) ;
period2 = MathFloor ( period1 / 1.9 ) ;
period3 = ( int ) MathFloor ( MathSqrt ( period1 ) ) ;
digs = Digits ( ) ;
ma1_handle = iMA ( _Symbol , _Period , period1 , 0 , ma_method , applied_price ) ;
ma2_handle = iMA ( _Symbol , _Period , period2 , 0 , ma_method , applied_price ) ;
return INIT_SUCCEEDED ;
}
//+------------------------------------------------------------------+
//|Main calculation loop|
//+------------------------------------------------------------------+
int OnCalculate ( const int rates_total , const int prev_calculated ,
const datetime time [ ] , const double open [ ] ,
const double high [ ] , const double low [ ] , const double close [ ] ,
const long tick_volume [ ] , const long volume [ ] , const int spread [ ] ) {
int st = prev_calculated > 0 ? prev_calculated - 1 : 1 ;
for ( int i = st ; i < rates_total ; i ++ ) {
green_line [ i ] = red_line [ i ] = up_arrow [ i ] = down_arrow [ i ] = EMPTY_VALUE ;
double ma1 [ ] , ma2 [ ] ;
if ( CopyBuffer ( ma1_handle , 0 , rates_total -1 - i , 1 , ma1 ) < 1 || CopyBuffer ( ma2_handle , 0 , rates_total -1 - i , 1 , ma2 ) < 1 ) continue ;
tmp [ i ] = 2 * ma2 [ 0 ] - ma1 [ 0 ] ; // Custom MA logic
line [ i ] = i > 50 ? SmoothedMA ( i , period3 , line [ i -1 ] , tmp ) : tmp [ i ] ;
if ( line [ i ] > line [ i -1 ] ) green_line [ i ] = line [ i ] ;
if ( line [ i ] < line [ i -1 ] ) red_line [ i ] = line [ i ] ;
// Signal detection alarm logic
if ( green_line [ i ] != EMPTY_VALUE green_line [ i -1 ] == EMPTY_VALUE ) {
up_arrow [ i ] = line [ i ] ;
if ( iTime ( _Symbol , _Period , 0 ) != last_alert ) {
last_alert = iTime ( _Symbol , _Period , 0 ) ;
double entry = SymbolInfoDouble ( _Symbol , SYMBOL_ASK ) ;
string msg = "Xmaster Purchase:" + _Symbol + " @ " + DoubleToString ( entry , digs ) ;
if ( alert_on ) Alert ( msg ) ; if ( alert_email ) SendMail ( "Xmaster" , msg ) ; if ( alert_sound ) PlaySound ( "alert.wav" ) ;
}
}
if ( red_line [ i ] != EMPTY_VALUE red_line [ i -1 ] == EMPTY_VALUE ) {
down_arrow [ i ] = line [ i ] ;
if ( iTime ( _Symbol , _Period , 0 ) != last_alert ) {
last_alert = iTime ( _Symbol , _Period , 0 ) ;
double entry = SymbolInfoDouble ( _Symbol , SYMBOL_BID ) ;
string msg = "Xmaster SELL:" + _Symbol + " @ " + DoubleToString ( entry , digs ) ;
if ( alert_on ) Alert ( msg ) ; if ( alert_email ) SendMail ( "Xmaster" , msg ) ; if ( alert_sound ) PlaySound ( "alert.wav" ) ;
}
}
}
return rates_total ;
}
Uptrend Conditions
The AUD/USD price chart on the 1 minute time frame is shown below. Green arrow signals are short-term trend reversals and indicate bullish signals.
In this case, traders can use the green arrow as an entry signal to open a buy position.

downtrend conditions
The price chart below shows the Nikkei 225 Index (NIKKEI) on a 5-minute time frame.
The red arrow indicates a trend reversal and a bearish signal, allowing traders to enter a Sell position .

Indicator Settings
The image below shows the modifications and settings of the Formula Xmaster indicator:

- Chart theme: Chart theme
- Alert on: Enable alerts
- Alert sound: Sound alert
- Alert email: Email alert
Conclusion
The Xmaster (XHMaster) Formula This indicator combines two powerful tools (MA and MACD) to identify trends and find entry points for trades.
This tool performs well in volatile markets, providing traders with reliable signals. It is worth mentioning that the XMaster formula indicator MetaTrader 4 can be effectively used in trading.
📦 Download attachments/Download Files
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •