Hedging Grid EA

MQL4 EA

작업 종료됨

실행 시간 7 일
피고용인의 피드백
Good client, good business
고객의 피드백
Good Job

명시

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.

파일:

응답함

1
개발자 1
등급
(269)
프로젝트
337
29%
중재
36
28% / 64%
기한 초과
10
3%
로드됨
2
개발자 2
등급
(108)
프로젝트
179
25%
중재
24
17% / 75%
기한 초과
16
9%
무료
3
개발자 3
등급
(16)
프로젝트
20
15%
중재
5
40% / 40%
기한 초과
0
무료
4
개발자 4
등급
(510)
프로젝트
977
74%
중재
27
19% / 67%
기한 초과
100
10%
무료
게재됨: 1 기고글, 6 코드
5
개발자 5
등급
(98)
프로젝트
137
52%
중재
5
40% / 60%
기한 초과
0
무료
6
개발자 6
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
7
개발자 7
등급
(68)
프로젝트
126
40%
중재
19
42% / 53%
기한 초과
33
26%
작업중
8
개발자 8
등급
(47)
프로젝트
67
37%
중재
5
40% / 40%
기한 초과
1
1%
무료
9
개발자 9
등급
(365)
프로젝트
507
40%
중재
159
17% / 74%
기한 초과
99
20%
로드됨
10
개발자 10
등급
(318)
프로젝트
565
35%
중재
81
31% / 44%
기한 초과
204
36%
무료
11
개발자 11
등급
(25)
프로젝트
31
13%
중재
13
0% / 77%
기한 초과
9
29%
무료
12
개발자 12
등급
(16)
프로젝트
35
23%
중재
4
0% / 50%
기한 초과
2
6%
작업중
13
개발자 13
등급
(12)
프로젝트
13
23%
중재
7
0% / 71%
기한 초과
3
23%
작업중
14
개발자 14
등급
(574)
프로젝트
945
47%
중재
309
58% / 27%
기한 초과
125
13%
무료
15
개발자 15
등급
(78)
프로젝트
246
74%
중재
7
100% / 0%
기한 초과
1
0%
무료
게재됨: 1 기고글
16
개발자 16
등급
(59)
프로젝트
91
43%
중재
4
0% / 100%
기한 초과
3
3%
작업중
17
개발자 17
등급
(13)
프로젝트
13
38%
중재
1
0% / 100%
기한 초과
1
8%
무료
18
개발자 18
등급
(1)
프로젝트
1
0%
중재
0
기한 초과
0
무료
19
개발자 19
등급
(43)
프로젝트
66
12%
중재
12
58% / 42%
기한 초과
1
2%
무료
20
개발자 20
등급
(8)
프로젝트
7
0%
중재
3
0% / 100%
기한 초과
2
29%
무료
21
개발자 21
등급
(271)
프로젝트
553
50%
중재
57
40% / 37%
기한 초과
227
41%
작업중
22
개발자 22
등급
(1)
프로젝트
2
0%
중재
2
0% / 50%
기한 초과
0
무료
23
개발자 23
등급
(10)
프로젝트
13
0%
중재
24
0% / 75%
기한 초과
4
31%
작업중
24
개발자 24
등급
(48)
프로젝트
58
34%
중재
15
27% / 60%
기한 초과
1
2%
작업중
25
개발자 25
등급
(2)
프로젝트
2
0%
중재
0
기한 초과
0
무료
비슷한 주문
Hola, traders e inversores: Desarrollamos soluciones de trading algorítmico para MetaTrader 4 y MetaTrader 5. Creamos bots, indicadores y herramientas a medida que convierten estrategias manuales en sistemas automáticos, configurables y orientados a una gestión de riesgo sólida. Hemos trabajado en automatizaciones que integran entradas y salidas por reglas, cálculo de lotaje, control de drawdown, filtros de horario y
Hello All, can someone help me to make an EA base on MACD, https://www.mql5.com/en/code/14669 and RSI. If you are able to make this than please get me in touch, i will appreciated Thanks and best Regards Kodj007
EA 45 - 205 USD
If EMA20 > EMA50 AND RSI > 55 AND No Open Position THEN Buy SL = 50 pips TP = 100 pips If Profit > 30 pips Move SL to Break Even If Profit > 50 pips Enable Trailing Stop
I am looking for an experienced MQL5 developer to modify an existing Expert Advisor by adding an automated hedging module. The existing EA is fully functional and already manages trade entries and exits. The objective of this enhancement is to introduce a risk management feature that automatically opens a hedge position when an existing trade reaches a predefined unrealized loss in USD. The hedge should remain active
automatic robo sell at bollinger band upwards breach and rsi should above 80 and buy when bollinger breach downwards and rsi is below 30, rsi shoould works only on Gold trade and none ofhe trades
Hello, I need a custom Expert Advisor for MetaTrader 5. I am trading from mobile only. **Account & Style:** - Capital: $5,000 - $10,000 - Risk: Moderate/Balanced - Trading Style: Scalping **Pairs & Timeframe:** - Symbols: EURUSD and XAUUSD - Timeframe: M5 **Strategy:** - BUY: RSI(14) < 30 AND Price > 20 EMA - SELL: RSI(14) > 70 AND Price < 20 EMA - Only 1 trade per symbol at a time - No Martingale / No Grid **Risk
am an auto trader that for Sierra chart that works but needs some cleaning up. I need some features added to it like two parent studies with different take profit, stops, quantities and also a parent study to add to the position with its own take profit, stops, quantities
We are seeking an experienced MQL4/MQL5 programmer to develop a high-performance, fully automated Expert Advisor (EA). The bot must execute a sophisticated multi-currency hedging strategy across correlated forex pairs. Key Responsibilities Develop Multi-Currency Logic : Build an EA capable of scanning and trading multiple currency pairs simultaneously from a single chart or setup. Implement Hedging Strategy : Code
I am seeking an elite, top-tier quantitative programmer to engineer a professional multi-strategy software suite for XAU/USD (Gold). This project will be executed under a single contract workspace, cleanly structured across sequential development milestones: Milestone 1: (M30/H1/H4 Swing Architecture) 2: (M1/M5/M15 High-Frequency Velocity Architecture) 3: (Integration Phase):(Unified All-In-One Parent Class Execution
Hi I want a trade copier for my ninja Trader 1. It should support at least 50 followers accounts. 2. Each follower should have its own configurable quantity/risk. 3. Copier should replicate entries, stops, and take profit, order medications, and order cancellations, ect. 4. It should copy both manual and strategy trades. (As long as the follower accounts are selected to follow, it should do the exact same as the

프로젝트 정보

예산
100 - 150 USD
기한
 7 일