Advanced Adaptive Grid EA

MQL4 Esperti

Specifiche

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().


Con risposta

1
Sviluppatore 1
Valutazioni
(256)
Progetti
319
29%
Arbitraggio
34
26% / 65%
In ritardo
10
3%
Gratuito
2
Sviluppatore 2
Valutazioni
(106)
Progetti
173
25%
Arbitraggio
23
9% / 78%
In ritardo
16
9%
In elaborazione
3
Sviluppatore 3
Valutazioni
(15)
Progetti
19
16%
Arbitraggio
5
40% / 40%
In ritardo
0
Gratuito
4
Sviluppatore 4
Valutazioni
(22)
Progetti
29
3%
Arbitraggio
4
25% / 0%
In ritardo
3
10%
In elaborazione
5
Sviluppatore 5
Valutazioni
(52)
Progetti
66
41%
Arbitraggio
1
0% / 100%
In ritardo
7
11%
Gratuito
6
Sviluppatore 6
Valutazioni
(509)
Progetti
977
74%
Arbitraggio
27
19% / 67%
In ritardo
101
10%
Gratuito
Pubblicati: 1 articolo, 6 codici
7
Sviluppatore 7
Valutazioni
Progetti
2
0%
Arbitraggio
4
25% / 50%
In ritardo
1
50%
Gratuito
8
Sviluppatore 8
Valutazioni
(10)
Progetti
16
19%
Arbitraggio
3
33% / 67%
In ritardo
2
13%
In elaborazione
9
Sviluppatore 9
Valutazioni
(14)
Progetti
19
11%
Arbitraggio
1
0% / 100%
In ritardo
5
26%
Gratuito
10
Sviluppatore 10
Valutazioni
(13)
Progetti
13
38%
Arbitraggio
1
0% / 100%
In ritardo
1
8%
Gratuito
11
Sviluppatore 11
Valutazioni
(12)
Progetti
12
17%
Arbitraggio
2
0% / 50%
In ritardo
1
8%
Gratuito
12
Sviluppatore 12
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
13
Sviluppatore 13
Valutazioni
(111)
Progetti
139
43%
Arbitraggio
9
33% / 44%
In ritardo
6
4%
Gratuito
14
Sviluppatore 14
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
0
In ritardo
0
Gratuito
15
Sviluppatore 15
Valutazioni
(16)
Progetti
22
14%
Arbitraggio
8
38% / 63%
In ritardo
6
27%
Gratuito
16
Sviluppatore 16
Valutazioni
(271)
Progetti
553
50%
Arbitraggio
57
40% / 37%
In ritardo
227
41%
In elaborazione
17
Sviluppatore 17
Valutazioni
(156)
Progetti
197
59%
Arbitraggio
10
80% / 0%
In ritardo
0
In elaborazione
Pubblicati: 1 codice
18
Sviluppatore 18
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
2
0% / 0%
In ritardo
0
In elaborazione
19
Sviluppatore 19
Valutazioni
(77)
Progetti
243
74%
Arbitraggio
7
100% / 0%
In ritardo
1
0%
Gratuito
Pubblicati: 1 articolo
20
Sviluppatore 20
Valutazioni
(3)
Progetti
1
0%
Arbitraggio
5
0% / 100%
In ritardo
0
Gratuito
21
Sviluppatore 21
Valutazioni
(24)
Progetti
30
13%
Arbitraggio
12
0% / 75%
In ritardo
8
27%
In elaborazione
22
Sviluppatore 22
Valutazioni
(43)
Progetti
66
12%
Arbitraggio
12
58% / 42%
In ritardo
1
2%
Gratuito
23
Sviluppatore 23
Valutazioni
(3)
Progetti
3
0%
Arbitraggio
6
17% / 67%
In ritardo
0
Gratuito
24
Sviluppatore 24
Valutazioni
(9)
Progetti
13
0%
Arbitraggio
23
0% / 78%
In ritardo
4
31%
Gratuito
25
Sviluppatore 25
Valutazioni
(3)
Progetti
1
100%
Arbitraggio
3
0% / 100%
In ritardo
0
Gratuito
26
Sviluppatore 26
Valutazioni
(298)
Progetti
477
40%
Arbitraggio
105
40% / 24%
In ritardo
81
17%
Caricato
Pubblicati: 2 codici
27
Sviluppatore 27
Valutazioni
Progetti
1
0%
Arbitraggio
2
0% / 100%
In ritardo
0
Gratuito
28
Sviluppatore 28
Valutazioni
(193)
Progetti
249
20%
Arbitraggio
22
50% / 18%
In ritardo
0
Caricato
29
Sviluppatore 29
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
30
Sviluppatore 30
Valutazioni
(10)
Progetti
14
43%
Arbitraggio
0
In ritardo
3
21%
Gratuito
Ordini simili
I'm looking for a buy sell indicator that places signals at candle close doesn't repaint. Looking for strategy too as part of this project. Will want to see it before I create the contract. Please don't send me stuff you know isn't good. If done well will pay well and it can turn I to a long term collaboration
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

Informazioni sul progetto

Budget
100+ USD
Scadenze
da 2 a 5 giorno(i)