Hedging Grid EA

MQL4 Uzmanlar

İş tamamlandı

Tamamlanma süresi: 7 gün
Geliştirici tarafından geri bildirim
Good client, good business
Müşteri tarafından geri bildirim
Good Job

Şartname

Project Overview: Hedging Grid EA
The goal is to create an MQL4 Expert Advisor that employs a hedging grid strategy. This means it will open both buy and sell trades, often simultaneously, and will add to positions at predefined intervals as the price moves.
Core Strategy:
Grid Trading: The EA places new pending orders (BUYSTOP, SELLSTOP) at a set distance from existing trades.
Hedging: It manages buy and sell trades independently, allowing them to run at the same time.
Lot Sizing: It can use a multiplier (martingale-style) or a fixed increment to increase the lot size for new grid orders.
Profit/Loss Management: It closes trades based on several conditions:
Profit target for a single direction (e.g., close all buys).
Combined profit target for both directions (hedged basket).
A hard stop-loss based on total drawdown.
Dynamic Orders: It uses trailing stops on open positions and can also "trail" its pending orders, adjusting their entry price as the market moves.
Visual Interface: The EA displays key information directly on the chart, including profits, average entry prices, and trading signals.
Part 1: EA Settings (Global extern Variables)
These are the user-configurable inputs. The programmer needs to declare these at the top of the file so they appear in the EA's settings window in MetaTrader.
Order Management:
Magic: int - A unique magic number to distinguish this EA's trades from others.
slippage: int - The maximum allowed slippage in points for order execution.
Allow_BUY, Allow_SELL: bool - Master switches to enable or disable buy and sell trading.
Open_order_on_trend: bool - A setting to control grid order placement logic (either with or against the trend).
Lot Sizing:
Order_lotsize: double - The initial lot size for the first trade in a series.
Multiply_lotsize_by: double - A multiplier for the next lot size (e.g., 1.5 for a martingale strategy).
Increase_lotsize_by: double - A fixed amount to add to the next lot size (used if the multiplier is 1.0).
Round_lotsize_to_decimals: int - The number of decimal places to round the lot size to (e.g., 2 for standard lots).
Grid & Order Spacing:
First_step: int - The distance in points from the current price to place the first pending order.
Distance_between_orders: int - The minimum distance in points between orders in the grid.
Minimum_price_distance: int - The minimum distance from the current price for subsequent pending orders.
Move_step: int - The number of points the price must move before a pending order is trailed (modified).
Stop Loss & Take Profit:
Stoploss, Takeprofit: int - The initial Stop Loss and Take Profit in points for each individual order.
Trailing_type: int - The type of trailing stop to use (0 = disabled). The programmer will need to implement the logic for different types if required.
Trailing_step: int - The step, in points, for the trailing stop.
Minimum_trailing_profit: int - The minimum profit in points an order must have before the trailing stop is activated.
Basket Closing Conditions:
Profit_for_closing_1_direction: double - The profit amount in account currency to close all trades in one direction (e.g., close all buys when their total profit reaches $50).
Profit_for_closing_2_directions: double - The profit amount to close all trades (buys and sells) when the combined profit of the hedged basket reaches this target.
Loss_for_closing: double - A negative dollar amount that triggers the closing of all trades in one direction (e.g., close all buys if their total profit reaches -$100).
Maximum_allowed_loss: double - A negative dollar amount that prevents the EA from opening new trades in a direction.
Close_loss_by_drawdown: double - A profit threshold. If the profit of either side drops below this, the EA switches to its "hedged close" logic.
Auto_calculated_profit: double - A setting to automatically calculate the profit target based on lot size and tick value.
Indicators & Timing:
Opening_1_order_on_indicators: bool - If true, the very first order will only be placed if RSI conditions are met.
Timeframe_indicator: int - The timeframe to use for the RSI calculation.
RSI_Period, Oversold_zone, Overbought_zone: int - Standard RSI settings.
Delete_Orders: bool - Enable/disable the scheduled deletion of all orders.
DeleteHour: int - The server hour (0-23) to delete all orders.
Visuals:
Font_size: int - The font size for text displayed on the chart.
Color_information: color - The color for the informational text.
Part 2: Main Program Structure (OnInit, OnDeinit, OnTick)
int OnInit(): This function runs once when the EA is first attached to a chart. Its purpose is to set up the visual display. The programmer should write code here to create all the necessary text objects (OBJ_LABEL) on the chart for displaying Balance, Equity, Profits, etc.
void OnDeinit(const int reason): This function runs once when the EA is removed from the chart. It should contain a cleanup routine to delete all chart objects created in OnInit().
void OnTick(): This is the heart of the EA, running on every new price tick. The programmer should implement this function exactly as it appears in the refactored code, with the main logic flow calling the 9 helper functions in sequence.
Part 3: Helper Function Implementation
The programmer should create each of the 9 functions called by OnTick.
HandleScheduledOrderDeletion(): Simple function. Check the Delete_Orders setting and the current server hour. If they match DeleteHour, call a function to close/delete all orders.
ProcessOpenOrders(...): This is a critical data-gathering function. It must loop through all orders, filter them by the current symbol and magic number, and then calculate all the key metrics (counts, lots, profits, price points) needed by the other functions.
UpdateAveragePriceObjects(...): This function should first delete the old "SLb" and "SLs" arrows from the chart. Then, if buy or sell orders exist, it should create new arrows (OBJ_ARROW with SYMBOL_RIGHTPRICE) at the calculated averageBuyPrice and averageSellPrice.
ApplyTrailingStops(...): Loop through all open trades. For each trade, calculate the potential new trailing stop loss price. If this new price is better than the current one (higher for buys, lower for sells) and meets the minimum profit condition, modify the order using OrderModify().
ManageProfitAndLossClosing(...): Implement the series of if statements to check the various profit and loss conditions against the targets. If a condition is met, it should call the CloseOrders() function with the correct parameter (1 for buys, -1 for sells, 0 for all).
UpdateTradingSignals(...): This function updates the chart labels ("Char.b", "Char.s") that show if trading is allowed. It uses ObjectSetText() with special Wingdings font characters to display green checkmarks or red crosses.
ManagePendingOrders(...): Implement the logic to place new grid orders. This involves calculating the lot size, determining the entry price based on distance rules and RSI, and checking if there is enough free margin before calling OrderSend().
ModifyPendingOrders(...): Implement the "trailing pending order" logic. Calculate the ideal new price for the existing pending order and compare it to its current price. If the complex shouldModify condition is met, call OrderModify() to update the order's entry price.
UpdateChartInformation(...): Update all the informational text labels on the chart (Balance, Equity, ProfitB, etc.) with the latest values calculated in ProcessOpenOrders.
Part 4: Required Utility Functions
The programmer will also need to create the functions that perform the actual trading actions and calculations.
CloseOrders(int direction): This function will loop through all orders. Based on the direction parameter (1, -1, or 0), it will use OrderClose() on the matching trades.
DeleteOrders(): Similar to CloseOrders, but it will use OrderDelete() for pending orders and OrderClose() for open market orders.
TradingHours(): A function that checks the current server time against user-defined start and end hours to determine if the EA is within its allowed trading session.
CalculateTrailingStop(...): The logic to calculate the trailing stop price. This could be as simple as Bid - Trailing_Stop_Points for a buy order.
UpdateChartLabel(...): A small helper function to make creating and updating the text objects in OnInit and UpdateChartInformation cleaner and less repetitive.

Dosyalar:

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(258)
Projeler
323
30%
Arabuluculuk
34
26% / 65%
Süresi dolmuş
10
3%
Çalışıyor
2
Geliştirici 2
Derecelendirme
(107)
Projeler
175
25%
Arabuluculuk
23
13% / 78%
Süresi dolmuş
16
9%
Serbest
3
Geliştirici 3
Derecelendirme
(15)
Projeler
19
16%
Arabuluculuk
5
40% / 40%
Süresi dolmuş
0
Serbest
4
Geliştirici 4
Derecelendirme
(510)
Projeler
977
74%
Arabuluculuk
27
19% / 67%
Süresi dolmuş
100
10%
Serbest
Yayınlandı: 1 makale, 6 kod
5
Geliştirici 5
Derecelendirme
(98)
Projeler
137
52%
Arabuluculuk
5
40% / 60%
Süresi dolmuş
0
Serbest
6
Geliştirici 6
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
7
Geliştirici 7
Derecelendirme
(68)
Projeler
126
40%
Arabuluculuk
18
44% / 56%
Süresi dolmuş
33
26%
Çalışıyor
8
Geliştirici 8
Derecelendirme
(47)
Projeler
67
37%
Arabuluculuk
5
40% / 40%
Süresi dolmuş
1
1%
Serbest
9
Geliştirici 9
Derecelendirme
(365)
Projeler
507
40%
Arabuluculuk
159
17% / 74%
Süresi dolmuş
99
20%
Yüklendi
10
Geliştirici 10
Derecelendirme
(317)
Projeler
564
35%
Arabuluculuk
81
31% / 44%
Süresi dolmuş
204
36%
Serbest
11
Geliştirici 11
Derecelendirme
(25)
Projeler
31
13%
Arabuluculuk
13
0% / 77%
Süresi dolmuş
9
29%
Serbest
12
Geliştirici 12
Derecelendirme
(16)
Projeler
35
23%
Arabuluculuk
4
0% / 50%
Süresi dolmuş
2
6%
Çalışıyor
13
Geliştirici 13
Derecelendirme
(12)
Projeler
13
23%
Arabuluculuk
7
0% / 71%
Süresi dolmuş
3
23%
Çalışıyor
14
Geliştirici 14
Derecelendirme
(574)
Projeler
945
47%
Arabuluculuk
309
58% / 27%
Süresi dolmuş
125
13%
Serbest
15
Geliştirici 15
Derecelendirme
(77)
Projeler
244
74%
Arabuluculuk
7
100% / 0%
Süresi dolmuş
1
0%
Serbest
Yayınlandı: 1 makale
16
Geliştirici 16
Derecelendirme
(58)
Projeler
90
43%
Arabuluculuk
4
0% / 100%
Süresi dolmuş
3
3%
Çalışıyor
17
Geliştirici 17
Derecelendirme
(13)
Projeler
13
38%
Arabuluculuk
1
0% / 100%
Süresi dolmuş
1
8%
Serbest
18
Geliştirici 18
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
19
Geliştirici 19
Derecelendirme
(43)
Projeler
66
12%
Arabuluculuk
12
58% / 42%
Süresi dolmuş
1
2%
Serbest
20
Geliştirici 20
Derecelendirme
(8)
Projeler
7
0%
Arabuluculuk
3
0% / 100%
Süresi dolmuş
2
29%
Serbest
21
Geliştirici 21
Derecelendirme
(271)
Projeler
553
50%
Arabuluculuk
57
40% / 37%
Süresi dolmuş
227
41%
Çalışıyor
22
Geliştirici 22
Derecelendirme
(1)
Projeler
2
0%
Arabuluculuk
2
0% / 50%
Süresi dolmuş
0
Serbest
23
Geliştirici 23
Derecelendirme
(9)
Projeler
13
0%
Arabuluculuk
23
0% / 78%
Süresi dolmuş
4
31%
Serbest
24
Geliştirici 24
Derecelendirme
(48)
Projeler
56
34%
Arabuluculuk
15
27% / 60%
Süresi dolmuş
1
2%
Çalışıyor
25
Geliştirici 25
Derecelendirme
(2)
Projeler
2
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
Benzer siparişler
//+------------------------------------------------------------------+ //| Simple XAUUSD EA | //+------------------------------------------------------------------+ input double LotSize = 0.01; input int StopLoss = 500; // in points input int TakeProfit = 1000; // in points input int MAPeriod = 20; int maHandle; int OnInit() { maHandle = iMA(_Symbol, PERIOD_H1, MAPeriod, 0, MODE_SMA
Hello, I need a Python-based MT5 forex trading bot developed. The bot should connect to MetaTrader 5, execute trades based on a predefined strategy, and support standard risk management features such as stop loss, take profit, and position sizing. Requirements: MT5 integration using Python Automated trade execution based on provided strategy rules Configurable risk management settings Support for major forex pairs
Hi, I'm Barak, founder of FX Trade Africa, a trading automation company based in Africa. I'm looking for a serious EA developer for a long-term business partnership — not a one-time paid job. IMPORTANT: This is not a paid order. I am looking for a long-term partner who believes in the model and wants to build something serious together. Compensation will be based on profit sharing from funded accounts — details
### ** Main EA File** - `InstitutionalTrendPullbackScalper.mq5` **Core Features Implemented:** **Multi-Timeframe Analysis** - M15 trend filter (EMA20 > EMA50 for uptrends) - M5 entry signals with 5-condition confirmation - Independent indicator sets for both symbols **Advanced Entry Logic** - RSI reversal detection (crosses thresholds) - Price pullback zone validation - Bullish/bearish candle close confirmation -
I need developer who Can perfectly build me a layout of Ninjatrader 8 (NT8) to look and feel the same on SierraCharts? I currently use NT8 but I want to start using SierraCharts because its more robust than NT8, but I don't want to have to worry about programming SierraCharts. How much would this cost? Thank you
Automate my trading 100 - 300 USD
i want a trading bot that take trade auto and make 5% profit daily and stop with in 24 hours not more then that at least the bot give me more then 2% not less then that like a ai agent if it make any loss that agent have to take care of it i need only 5 % profit
I am looking for an EA for MT5 which is stable for long period. should make minimum 20% per month and DD should be less than 10% first send me your backtest reports for last 5 years with real ticks. budget is negotiable based on the quality of the EA. source code should be delivered at the end. Please dont apply without sending backtest report as mentioned above, in other case offers would be rejected
I do not have any startegy, and I want you to create one with your experience, you will provide me EA along with source code. you may use Grid or any logic, but the EA should keep generating profit during Newyourk and Asian session
I am looking for an experienced MQL5 developer to build a professional-grade Expert Advisor (EA) for MetaTrader 5. The strategy is based on liquidity sweeps, market structure (Break of Structure), and institutional concepts (order blocks), specifically optimized for XAUUSD (Gold). This is not a basic bot. I need a structured, optimized, and reliable system suitable for live trading after testing
I need an Ai trading bot for Binance and BTC on MT5 that also uses order flow data. It should also make use of TSI- Temporal indicator sampling and also it should make use of fundamental analysis in the process of signal generation

Proje bilgisi

Bütçe
100 - 150 USD
Son teslim tarihi
to 7 gün