martingale breakdown expert advisor
Info
The martingale breakdown expert advisor is a Script for MetaTrader 4 that expert advisor implementing the martingale capital management method. the expert's feature is to increase the losing trade size, assuming the price will continue its movement rather than reverse.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Script works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Scripts folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use martingale breakdown expert advisor
1. Installation: Move your script file into the MQL/Scripts directory and restart the platform.
2. Execution: Drag the script onto a chart; it will perform a one-time action, such as closing all open orders or clearing chart objects.
3. Editing: Use MetaEditor (F4) to modify code, click "Compile," and verify no errors appear in the terminal before running.
4. Removing: Scripts stop automatically, but you can remove them manually by right-clicking the chart and choosing "Remove Script."
Frequently Asked Questions
Q: How are scripts different from EAs? A: Scripts execute a single action and then stop; EAs monitor the market and trade continuously.
Q: Can I assign a hotkey to a script? A: Yes, right-click the script in the Navigator, select "Set Hotkey," and define your preferred keyboard shortcut.
Q: Why did my script stop? A: Scripts are designed to stop immediately after finishing their programmed command; this is normal behavior.
What this tool does
expert advisor implementing the martingale capital management method.
Typical Use Case
This Script excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Script works on MetaTrader 4. Place the file in the MQL4/Scripts folder and restart the terminal.
Description & Settings
Related: strategy - set and forget (with anti-martingale system) mt4 - another powerful script for MetaTrader 4 traders.
expert advisor implementing the martingale capital management method.Also recommended: strategy - set and forget (with martingale system) mt4 - similar script with strong performance on MetaTrader 4.
the expert's feature is to increase the losing trade size, assuming the price will continue its movement rather than reverse. this is a breakout-oriented approach, making it more robust and stable than other variants.
several comments:
the logariphmicmm parameter (when mm is enabled) activates money management. as the deposit increases, the lot size grows, but at a slower rate than the deposit itself, thus reducing the load on the deposit. you only need to determine the riskfactor;
the profitpercent parameter defines the desired profit in percentage of the deposit. since series do not close at fixed levels and can be 200 points apart, if optimaltakeprofit is enabled, the required profit size increases by the square root of the maximum open lot. enabling optimaltakeprofit is recommended.
for those who wish to test the advisor on a live account, it is essential to enable close_on_tp. this closes the series based on take profits and stop losses. calculations for both bids and asks should be correct. if this parameter is disabled, orders close upon reaching the necessary profit.
parameter selection: for eur, the step should be around 20, and profitpercent around 0.3-0.5, according to preference. for gbp, the step should be around 30.
profitability increases as the step size decreases, and so does the risk.
initial orders are opened in both directions with a lot size of 0.1. these are solely for establishing the initial reference level.
a new version has been released. a reversal mode has been added (as opposed to breakout, when the equity/balance ratio is less than 0.7), along with a trailing stop for profitable positions. the code is extensively commented. parameters that work well for gbp include: step 20, trailingstop 30, profitpercent 0.5.
strategy tester report
martingail breakdowning
symbol
eurusd (euro vs. united states dollar)
period
1 minute (m1) 2004.06.16 10:55 - 2006.10.24 17:30 (2006.05.01 - 2006.11.27)
model
open prices (fast method on formed bars)
parameters
tradeallowed=true; shag=15; startlots=0.5; moneymanagement=true; logariphmicmm=true; riskfactor=6; profitpercent=3; optimaltakeprofit=true; close_on_tp=false; mode_close_on_tp=false; showlog=false;
bars in history
713938
ticks modeled
1427776
modeling quality
n/a
initial deposit
80000.00
net profit
791520.19
total profit
796801.28
total loss
-5281.08
profitability
150.88
expected payoff
3997.58
absolute drawdown
50.00
maximal drawdown
1864.31 (1.24%)
relative drawdown
1.24% (1864.31)
total trades
198
short positions (% profitable)
99 (53.54%)
long positions (% profitable)
99 (96.97%)
profitable trades (% of all)
149 (75.25%)
losing trades (% of all)
49 (24.75%)
largest
profitable trade
95980.82
losing trade
-1274.57
average
profitable trade
5347.66
losing trade
-107.78
maximal number of
consecutive wins (profit)
8 (44929.25)
consecutive losses (loss)
3 (-1864.31)
maximal
consecutive profit (number of wins)
157304.68 (6)
consecutive loss (number of losses)
-1864.31 (3)
average
consecutive win
3
consecutive loss
1
You may also like: calculate required margin for opening a position - excellent alternative for script users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#property link "https://robotfx.org"
#include <stdlib.mqh>
extern bool tradeallowed = true;
extern int step = 18;
extern string _ = "Параметры moneymanagement";
extern double startlots = 0.1;
extern bool moneymanagement = true;
extern bool logariphmicmm = true;
extern double riskfactor = 6;
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.