Framework & template · MT4

HpFX Framework

by mbelgin

High Performance Forex (hpFX) is an indicator-agnostic framework for MetaTrader 4 designed for large-scale backtesting and strategy automation.

GitHub stars1
Forks0
Last update3 months ago29 May 2026
LicenceMIT

Overview

HpFX Framework allows traders to define complex rules by combining up to ten custom indicators as entry signals, confirmation filters, or exit triggers using a flexible string-based encoding. The system includes ATR-based risk management for dynamic stop loss and take profit levels, break-even logic, and spread protection. It is specifically optimized for batch testing across multiple currency pairs to identify effective indicator combinations while eliminating manual simulation effort and psychological bias.

Details

Author

mbelgin on GitHub

Type

Framework & template

Platform

MetaTrader 4 (MQL4)

Strategy

Trend following, Indicator crossover, Multi-strategy

Markets

Forex

Timeframes

Any timeframe

Risk Profile

No grid, martingale or hedging logic was found in its code or README. That says nothing about how it performs: backtest it first.

Input Parameters

Read from hpFX_Engine.mq4. Defaults are the author's; change them in the EA's Inputs tab.

NameTypeDefaultDescription
indi_defs_1stringIndicator #1 definition
indi_usage_1t_indi_usageDISABLEDIndicator #1 usage
indi_defs_2stringIndicator #2 definition
indi_usage_2t_indi_usageDISABLEDIndicator #2 usage
indi_defs_3stringIndicator #3 definition
indi_usage_3t_indi_usageDISABLEDIndicator #3 usage
indi_defs_4stringIndicator #4 definition
indi_usage_4t_indi_usageDISABLEDIndicator #4 usage
indi_defs_5stringIndicator #5 definition
indi_usage_5t_indi_usageDISABLEDIndicator #5 usage
indi_defs_6stringIndicator #6 definition
indi_usage_6t_indi_usageDISABLEDIndicator #6 usage
Show all 40 inputs
NameTypeDefaultDescription
indi_defs_7stringIndicator #7 definition
indi_usage_7t_indi_usageDISABLEDIndicator #7 usage
indi_defs_8stringIndicator #8 definition
indi_usage_8t_indi_usageDISABLEDIndicator #8 usage
indi_defs_9stringIndicator #9 definition
indi_usage_9t_indi_usageDISABLEDIndicator #9 usage
indi_defs_10stringIndicator #10 definition
indi_usage_10t_indi_usageDISABLEDIndicator #10 usage
div2string----------------------TRADING CONDITIONS
min_before_candle_closeint5Trading window before candle close (min)
max_spread_pipsdouble10.0Max spread to take trades
max_slippage_pointsint100Max allowed slippage in points
div3string----------------------RISK MANAGEMENT
risk_percentdouble2Risk per trade (percent)
opt_first_order_riskdouble100.01st order risk % (use 100.0 for single trade)
opt_1st_sl_atr_multiplierdouble1.51st SL ATR multiplier
opt_1st_tp_atr_multiplierdouble3.01st TP ATR multiplier (0 to leave it open)
opt_2nd_sl_atr_multiplierdouble1.52nd SL ATR multiplier
opt_2nd_tp_atr_multiplierdouble3.02nd TP ATR multiplier (0 to leave it open)
no_indiexit_on_first_tradeboolfalseDo NOT check exit conditions on the first trade
add_spread_to_tpboolfalseAdd current spread to TP
require_matching_candleboolfalseRequire matching candle to trade
sl_to_be_Rdouble0.0R to move SL->BE
div4string----------------------VARIOUS
debug_outputboolfalseDebug output (enables banner/debug logs)
repaint_checkboolfalse(BETA) Perform a repaint check and exit instead of running tests
doji_percentdouble10.0Percent of daily range for a candle to be considered 'doji'
div5string----------------------ROULETTE MM

How to Install It

  1. 1Download the sourceUse "Download source (.zip)" above, or clone mbelgin/hpFX from GitHub, and unzip it.
  2. 2Open the data folderIn MetaTrader choose File, then Open Data Folder, and go to MQL4/Experts.
  3. 3Copy the filesCopy the .mq4 file into Experts.
  4. 4Compile in MetaEditorOpen the file in MetaEditor and press Compile. Fix any missing includes the compiler reports.
  5. 5Test before you tradeRun it in the Strategy Tester, then attach it to a demo chart and allow algorithmic trading.
Third-party code. ForexR did not write, test or endorse this EA, and the summary above was generated automatically from its README and code. ForexR lists only repositories with readable source code and never hosts files. Read the code, backtest it and use a demo account first; automated trading can lose money quickly.

Similar Expert Advisors

Framework4o

by Capital-Advisory-Technology
2 stars

Framework4o is a modular system building framework and expert advisor for MetaTrader 4. It provides a structured environment for developing trading models with pre-defined modules for position and risk management. The core functionality handles entry and exit logic using indicators like DEMA, EMA, and RSI. It includes

MT4 Framework & template Trend followingIndicator crossover
Updated 2 years ago GPL-3.0 GitHub repository of Framework4o

Swing NNFX Framework

by BenoitDurandIndep
2 stars

This MetaTrader 4 framework provides a modular environment for developing and backtesting expert advisors based on the No Nonsense Forex methodology. It includes functional swing trading robots that utilize baseline indicators, multiple confirmation layers, and volatility filters to identify entries. The system feature

MT4 Framework & template Trend followingMulti-strategy
Updated 3 years ago GPL-3.0 GitHub repository of Swing NNFX Framework
2 stars

This MetaTrader 4 expert advisor and modular framework provides advanced trade management and position scaling capabilities. It features a linear trailing stop that triggers at a predefined profit level and a pyramiding system to add positions to winning trades using a lot multiplier. The code is structured as a librar

MT4 Framework & template Trend followingIndicator crossoverGrid High risk

Gartal Inc

by bsAmirHeydar
1 stars

Gartal Inc is a modular trading automation framework and strategy development template for MetaTrader 4. It provides a structured environment for testing various entry and exit logic, including Fair Value Gaps, moving average crossovers, and Donchian channels. The repository focuses on backtesting workflows, featuring

MT4 Framework & template SMC / ICT / price actionIndicator crossoverTrend following
Updated 3 months ago None stated GitHub repository of Gartal Inc
16 stars

This framework provides MQL5 header files and example expert advisors designed to trade on non-time-based Range Bar charts within MetaTrader 5. It includes template robots for moving average crossovers and Super Trend strategies. The included code manages trade execution with configurable stop loss, take profit, break-

MT5 Framework & template Indicator crossoverTrend following

Orchard Simple EA Template

by OrchardForexTutorials
13 stars

This collection provides educational templates for building MetaTrader 5 Expert Advisors. It includes demonstration robots that interface with indicators like MACD and Parabolic SAR using the iCustom function. The repository serves as a learning resource for structuring MQL5 code and handling trade execution. Each exam

MT5 Framework & template Indicator crossoverTrend following

More frameworks and templates

Need a Broker for MT4?

Compare regulated brokers that support MetaTrader, with spreads, minimum deposits and leverage side by side.

Compare brokers