Trabalho concluído
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Termos de Referência
Overview:
We are seeking an experienced developer to create an Expert Advisor (EA) for a simple hedging strategy in the forex market.
The EA will utilize MACD, 200 EMA, and support and resistance levels to determine entry signals.
It will manage orders, including placing stop orders and adjusting lot sizes based on predefined conditions.
Responsibilities:
-
Develop EA Logic:
-
Implement the first order based on MACD signals, 200 EMA trend direction, and support/resistance levels.
-
Include parameters for customizable take profit and stop loss.
-
Order Management:
-
Automatically place a stop order upon initiating the first order.
-
Set entry price, take profit, and stop loss for the first order.
-
Note: The stop loss is saved as a variable for use in activating stop orders but will not be set when placing orders. It serves as a signal for activating stop orders.
-
Double the lot size for the second stop order, and use the first order's stop loss as the entry price.
-
Implement a third order with settings mirroring the first order if the first order’s entry price is hit again after the second stop order activation.
-
Indicator Integration:
-
Utilize the MACD indicator for buy/sell signals.
-
Ensure the EA checks the 200 EMA for trend direction.
-
Incorporate support and resistance levels to determine entry points.
-
User Inputs:
-
Provide input parameters for take profit (default 10 pips), stop loss (default 5 pips), and lot size (default 0.01).
-
Order Execution and Closure Logic:
-
Ensure proper logic for closing orders upon hitting take profit or activating subsequent stop orders.
-
Implement a function to reset variables and close all positions when a take profit level is reached.
-
Magic Number Utilization:
-
Use a magic number to track orders and ensure only one set of orders is placed at a time.
-
Include logic to check for existing orders with the magic number before placing new ones.
Detailed EA Specifications:
-
First Order:
-
Entry Price: Determined by MACD, 200 EMA, and support/resistance.
-
Take Profit: 10 pips (user adjustable).
-
Stop Loss: 5 pips (user adjustable, stored for use in stop order, no actual stop loss set when placing the order).
-
Lot Size: 0.01 (user adjustable).
-
Second Stop Order:
-
Entry Price: First order’s stop loss.
-
Take Profit: 10 pips (same as the first order, user adjustable).
-
Stop Loss: First order’s entry price (no actual stop loss set).
-
Lot Size: Double the first order’s lot size.
-
Third Stop Order:
-
Entry Price: First order’s entry price after second stop order activation.
-
Take Profit: 10 pips (same as the first order, user adjustable).
-
Lot Size: Same as the first order (no stop loss).
EA Logic Flow:
-
Entry:
-
Place the first order based on MACD, 200 EMA, and support/resistance.
-
Immediately place the second stop order.
-
Take Profit and Stop Loss Handling:
-
If the first order hits, take profit, close all orders.
-
If the first order hits stop loss, activate the second stop order.
-
If the second stop order hits its take profit, close all orders.
-
If the second stop order’s stop loss (first order’s entry price) is hit, place the third order.
-
Order Closure:
-
Close all orders when any take profit level is reached.
-
Magic Number Check:
-
Ensure no additional orders are placed if an order with the same magic number exists.
-
Reset variables and close positions when required.
Deliverables:
-
Fully functional EA with the described hedging strategy.
-
Well-documented code for maintainability.
-
User guide for setting parameters and understanding the EA's operations.
Requirements:
-
Proven experience in developing Expert Advisors for MetaTrader (MT4/MT5).
-
Strong understanding of forex trading strategies and technical indicators.
-
Proficiency in MQL4/MQL5 programming languages.
-
Ability to meet deadlines and provide support for initial setup and testing.