Advanced Adaptive Grid EA

MQL4 Experts

Termos de Referência

Project Overview: Advanced Adaptive Grid EA

This document outlines the development specifications for a sophisticated MQL4 Expert Advisor. The EA is designed to be a fully featured, institutional-grade trading tool employing an adaptive grid strategy with advanced risk management and user control.

Core Features

  1. Advanced Risk Control:

  • Equity Protection: Automatically closes all trades and halts trading if drawdown exceeds a user-defined percentage of the account balance.

  • Adaptive Lot Sizing: Automatically calculates lot sizes based on account equity, a fixed value, or a risk percentage per trade.

  • ATR-Based Stop Loss: Sets dynamic stop losses based on market volatility using the Average True Range (ATR) indicator.

  • Margin Limit: Prevents new trades if the used margin percentage exceeds a specified limit.

  1. Smarter Grid System:

  • Adaptive Grid Spacing: Dynamically adjusts the distance between grid orders using ATR or Bollinger Bands, widening the grid in volatile markets and tightening it in calm markets.

  • Asymmetric Spacing: Allows for different grid spacing for buy and sell trades.

  1. Intelligent Exit Logic:

  • Partial Profit-Taking: Closes a portion of a trade at a preliminary take profit level (TP1), letting the remainder run.

  • Equity-Based Trailing Basket: Trails a stop loss for the entire basket of trades (buys or sells) based on the total floating profit, locking in gains as the basket becomes more profitable.

  1. On-Chart Control & Transparency:

  • Quick Control Panel: Interactive buttons on the chart to immediately close all buys, close all sells, close all trades, or pause/resume new trading.

  • Expanded Dashboard: A comprehensive real-time display of account balance, equity, margin usage, floating P/L for buys and sells, current drawdown percentage, and EA status.

  1. Dynamic Market Adaptability:

  • Dynamic Slippage Handling: Automatically increases allowed slippage during periods of high volatility (e.g., news events) to ensure order execution.

  • News & Session Filters: Avoids trading during high-impact news events (requires external URL) and outside of specified trading sessions.

  1. Analysis & Optimization:

  • Detailed Trade Logs: Exports a detailed CSV log of every trading decision (order open, close, modify), including the reason, for easy performance review and optimization.

Part 1: EA Settings (Global extern Variables)

These inputs provide full control over the EA's behavior.

  • General Settings

  • MagicNumber: int - Unique identifier for the EA's trades.

  • TradeComment: string - Custom comment for trades.

  • Risk Management

  • LotSizing_Mode: enum - (EQUITY_BASED, FIXED_LOT, RISK_PERCENT)

  • Equity_Per_Lot: double - (e.g., 10000) Dollars of equity per 1.0 lot.

  • Lot_Size: double - Lot size to use(fixed,Equity percentage) 

  • Risk_Percent_Per_Trade: double - Risk % of balance for SL calculation if mode is RISK_PERCENT.

  • Max_Drawdown_Percent: double - The drawdown % of balance at which to close all trades and stop.

  • Stop_Trading_After_DD: bool - If true, the EA will not trade again after hitting the max drawdown.

  • Max_Margin_Usage_Percent: double - Maximum allowed margin level % before new trades are blocked.

  • ATR_SL_Period: int - Period for the ATR indicator for stop loss calculation.

  • ATR_SL_Multiplier: double - Multiplier for the ATR value to set the stop loss distance.

  • Grid Strategy

  • Grid_Spacing_Mode: enum - (ATR_BASED, BOLLINGER_BANDS, FIXED_POINTS)

  • Grid_ATR_Period: int - Period for the ATR indicator for grid spacing.

  • Grid_ATR_Multiplier_Buy: double - Multiplier for ATR to determine buy grid spacing.

  • Grid_ATR_Multiplier_Sell: double - Multiplier for ATR to determine sell grid spacing.

  • Grid_Fixed_Points: int - Grid spacing in points if mode is FIXED_POINTS.

  • Exit Strategy

  • Enable_Partial_Close: bool - Master switch for partial closing.

  • Partial_Close_TP1_Points: int - Profit in points to trigger the first partial close.

  • Partial_Close_Percent: double - Percentage of the trade to close at TP1 (e.g., 50.0).

  • Enable_Equity_Trail: bool - Master switch for basket equity trailing.

  • Equity_Trail_Start_Profit: double - Amount of profit in account currency to activate the trail.

  • Equity_Trail_Distance: double - Amount of profit to give back before the trail stops out the basket.

  • Filters & Slippage

  • Enable_Session_Filter: bool - Enable trading only during specific hours.

  • Session_Start_Hour, Session_End_Hour: int - Trading session hours (server time).

  • Base_Slippage: int - Normal slippage in points.

  • Volatility_Slippage_Multiplier: double - Multiplier for slippage during high volatility.

  • Volatility_ATR_Threshold: double - ATR value (as % of price) to trigger higher slippage.

  • Logging & Dashboard

  • Enable_CSV_Log: bool - Enable writing detailed logs to a CSV file.

  • CSV_Log_Filename: string - Filename for the log.

Part 2: Program Structure

  • OnInit(): Initializes the EA. Creates the on-chart dashboard and control panel buttons. Opens the CSV file for logging if enabled.

  • OnDeinit(): Cleans up resources. Deletes all chart objects and closes the CSV file.

  • OnTick(): The main execution loop. The logic must be ordered carefully:

  1. Check if trading is globally stopped.

  2. Check for and handle any button clicks from the control panel.

  3. Run all safety checks: Max Drawdown, Margin Limit, Session Filter.

  4. Run all exit logic for existing trades: Equity Trailing, Partial Closing.

  5. Run all management for existing trades: Apply ATR-based Stop Losses.

  6. Run logic for placing new grid orders if conditions are met.

  7. Update the on-chart dashboard with the latest information.

  • OnChartEvent(...): Handles user interaction with the on-chart control panel buttons.

Part 3: Helper Function Implementation

This EA will be composed of many specialized functions to keep the code clean and manageable.

  • Risk & Lot Size Functions: CheckMaxDrawdown(), CalculateLotSize(), IsMarginLevelOK().

  • Grid & Order Placement Functions: CalculateGridSpacing(), PlaceNewGridOrders().

  • Trade Management Functions: ManageOpenTrades(), ApplyATRStopLossToAll(), HandlePartialClosing(), HandleEquityTrailing().

  • Filter Functions: IsInTradingSession().

  • Dashboard & Control Functions: CreateDashboard(), UpdateDashboard(), CreateControlPanel(), HandleButtonClicks().

  • Logging Functions: InitializeCSVLog(), LogTradeAction(...).

  • Utility Functions: CloseAllByDirection(...), GetBasketProfit(...), GetCurrentDrawdownPercent().


Arquivos anexados:

Respondido

1
Desenvolvedor 1
Classificação
(256)
Projetos
319
29%
Arbitragem
34
26% / 65%
Expirado
10
3%
Livre
2
Desenvolvedor 2
Classificação
(106)
Projetos
173
25%
Arbitragem
23
9% / 78%
Expirado
16
9%
Trabalhando
3
Desenvolvedor 3
Classificação
(15)
Projetos
19
16%
Arbitragem
5
40% / 40%
Expirado
0
Livre
4
Desenvolvedor 4
Classificação
(22)
Projetos
29
3%
Arbitragem
4
25% / 0%
Expirado
3
10%
Trabalhando
5
Desenvolvedor 5
Classificação
(52)
Projetos
66
41%
Arbitragem
1
0% / 100%
Expirado
7
11%
Livre
6
Desenvolvedor 6
Classificação
(509)
Projetos
977
74%
Arbitragem
27
19% / 67%
Expirado
101
10%
Livre
Publicou: 1 artigo, 6 códigos
7
Desenvolvedor 7
Classificação
Projetos
2
0%
Arbitragem
4
25% / 50%
Expirado
1
50%
Livre
8
Desenvolvedor 8
Classificação
(10)
Projetos
16
19%
Arbitragem
3
33% / 67%
Expirado
2
13%
Trabalhando
9
Desenvolvedor 9
Classificação
(14)
Projetos
19
11%
Arbitragem
1
0% / 100%
Expirado
5
26%
Livre
10
Desenvolvedor 10
Classificação
(13)
Projetos
13
38%
Arbitragem
1
0% / 100%
Expirado
1
8%
Livre
11
Desenvolvedor 11
Classificação
(12)
Projetos
12
17%
Arbitragem
2
0% / 50%
Expirado
1
8%
Livre
12
Desenvolvedor 12
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
13
Desenvolvedor 13
Classificação
(111)
Projetos
139
43%
Arbitragem
9
33% / 44%
Expirado
6
4%
Livre
14
Desenvolvedor 14
Classificação
(1)
Projetos
1
0%
Arbitragem
0
Expirado
0
Livre
15
Desenvolvedor 15
Classificação
(16)
Projetos
22
14%
Arbitragem
8
38% / 63%
Expirado
6
27%
Livre
16
Desenvolvedor 16
Classificação
(271)
Projetos
553
50%
Arbitragem
57
40% / 37%
Expirado
227
41%
Trabalhando
17
Desenvolvedor 17
Classificação
(156)
Projetos
197
59%
Arbitragem
10
80% / 0%
Expirado
0
Trabalhando
Publicou: 1 código
18
Desenvolvedor 18
Classificação
(1)
Projetos
1
0%
Arbitragem
2
0% / 0%
Expirado
0
Trabalhando
19
Desenvolvedor 19
Classificação
(77)
Projetos
243
74%
Arbitragem
7
100% / 0%
Expirado
1
0%
Livre
Publicou: 1 artigo
20
Desenvolvedor 20
Classificação
(3)
Projetos
1
0%
Arbitragem
5
0% / 100%
Expirado
0
Livre
21
Desenvolvedor 21
Classificação
(24)
Projetos
30
13%
Arbitragem
12
0% / 75%
Expirado
8
27%
Trabalhando
22
Desenvolvedor 22
Classificação
(43)
Projetos
66
12%
Arbitragem
12
58% / 42%
Expirado
1
2%
Livre
23
Desenvolvedor 23
Classificação
(3)
Projetos
3
0%
Arbitragem
6
17% / 67%
Expirado
0
Livre
24
Desenvolvedor 24
Classificação
(9)
Projetos
13
0%
Arbitragem
23
0% / 78%
Expirado
4
31%
Livre
25
Desenvolvedor 25
Classificação
(3)
Projetos
1
100%
Arbitragem
3
0% / 100%
Expirado
0
Livre
26
Desenvolvedor 26
Classificação
(298)
Projetos
477
40%
Arbitragem
105
40% / 24%
Expirado
81
17%
Carregado
Publicou: 2 códigos
27
Desenvolvedor 27
Classificação
Projetos
1
0%
Arbitragem
2
0% / 100%
Expirado
0
Livre
28
Desenvolvedor 28
Classificação
(193)
Projetos
249
20%
Arbitragem
22
50% / 18%
Expirado
0
Carregado
29
Desenvolvedor 29
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
30
Desenvolvedor 30
Classificação
(10)
Projetos
14
43%
Arbitragem
0
Expirado
3
21%
Livre
Pedidos semelhantes
Hello, professional programmers! I'd like to request a special service. I need a trading bot like the one in the video, one that works on real accounts. My only request is that I don't pay any money until the bot is built and tested. Thank you very much
Auto trading system on mobile with high probability win rate. Trades and auto trading system that works well on gold and forex, most important risk reward ratio. It must be 1:3 or more then that whenever possible
I want to buy proven profitable EA, any kind of strategy is considerable, working on any forex pairs or XAUUSD. I don't want to build from the scratch, so only apply if you already have profitable EA. Please send your EX4 file in advance with your application (MANDATORY), with additional information as below : - Pair and timeframe to use, minimum initial capital requirement, and so on - Type of EA (scalping, in day
### What I'm looking for / Qué busco I am not looking for someone to code an idea I have. I am looking for someone who **already has a profitable and consistent strategy on XAUUSD** and needs a partner to scale it. No busco a alguien que programe una idea mía. Busco a alguien que **ya tenga una estrategia rentable y consistente en XAUUSD** y necesite un socio para escalarla. --- ### The deal / El trato - I will
Auto trading system with hi probability win rate. Trades and auto trading system works well on gold and forex most important risk reward ratio. It must be 1:3 or more then that
Hello, i would like to have a ninjatrader indicator. I wanna to have a footprint indicator with delta, imbalances and big trades identifiable. Also I wanna sell it on whop. And it should be fully customisable in NT8
Intraday Trade Ninja EA Indicators used: Price Border(TMA) MA-X Arrows xSuperTrend Candles EMA 49 & 89- Per Candle Color Switching Lemansignal 200 SMA Major Criteria to consider before a trade setup or condition is taken · The price must have touched/tested the upper or
Panda101 500+ USD
//+------------------------------------------------------------------+ //| Simple Moving Average Crossover EA | //+------------------------------------------------------------------+ #property strict input int ShortMA = 10; input int LongMA = 50; input double LotSize = 0.01; int shortMAHandle; int longMAHandle; //+------------------------------------------------------------------+ int OnInit() { shortMAHandle =
I need an experienced MQL5 developer to build a custom MT5 Expert Advisor for XAUUSD. Strategy Overview: Trend-following using EMA 50/200 on H4 and H1 Pullback entries on M5 using RSI + candle confirmation No martingale, no averaging down Controlled scaling only when trades are already in profit Maximum 2–3 positions per direction Risk Management: Daily loss limit (%) Equity hard stop (%) Consecutive loss pause
I need a ready-made professional trading EA similar to my current scalping bot, but improved for consistent profit and better risk control. Requirements: - Works on XAUUSD (M5 timeframe) - Fixed lot option (start with 0.01) - Opens only one trade at a time (no multiple positions) - Small, fast entries (scalping style) - Better risk-reward (SL must NOT be bigger than TP) - Breakeven function - Trailing stop to secure

Informações sobre o projeto

Orçamento
100+ USD
Prazo
de 2 para 5 dias