Техническое задание
![1 1](https://c.mql5.com/21/41/hedging1__1.png)
JOB DESCRIPTION (The final job is the delivery of the source code)
This EA is a typical Martingale Hedging EA.
It opens an order (for example: buy, 0.1 lot) and at the same time places a pending order in the opposite direction with a bigger lot size (for example: sell, 0.2 lot) at a certain distance (for example: 300 pips).
If the price descends 300 pips this second order will be activated. If the price keeps going down, at one point the first order (buy) will hit SL and the second order (sell) TP. As the second order has a larger lot size than the first order, the total outcome will be profit (or break even).
If the price does not hit TP and SL, and goes up again, then a new pending buy order will be activated at an even bigger lot size (0.3 lot). This process will go on until TP is hit and the hedge trading sequence closes.
- A new pending order will only be placed as soon as the last pending order is activated.
- A hedge trade sequence should ALWAYS be closed by TP and NEVER only by SL.
- All the existing trades in a hedge trade sequence will match their TP and SL values accroding to the latest activated trade (this is important in case the distance between the trade changes - "DistanceTrade"
- Where this EA differs a bit from a standard Hedging EA one is that it has relatively little automatisation and a lot of manual input fields.
- The EA works independent from the time frame it operates in.
- The EA should work with 5 digit as well as 4 digit brokers.
******************************************
INPUT FIELDS:
PauseAfterTP = true/false
- It pauses (soft stop) the EA after TP is obtained and a Hedge trading sequence is closed - if "PauseAfterTP=true". The EA stops trading for an INDEFINITE amount of time. It will start trading again as soon as the Trader puts back "PauseAfterTP=false"
MaxSlippage = …..
- the max slippage allowed for entering a trade
MaxTrades = …..
- the max. number of trades in a hedging trade sequence
Magic Number = …..
MinEquityLevel = false/true
MinEquityLevel = …..
- below this level the EA will not open new trade sequences (although it will allow already existing hedging trade sequences to continue and make new trades until they close with TP/SL)
- the value introduced is the % of the total account balance.
UseEquityStop = false/true
TotalEquityRisk = …..
- If the total Equity drops below this point the EA closes all the trades.
- the value introduced is the % of the total account balance.
DeleteAll_TP_SL_LastTrade = false/true
- When the last pending stop in a Hedge Trade Sequence is ACTIVATED we have the option that all the TP, SL and Trailing stops can be deleted. (DeleteAll_TP_SL_LastTrade = true)
- The max. number of trades in a hedge trading sequence is set by the "MaxTrades" parameter.
AutoLot = true/false
- IF “AutoLot = false”, THEN the size of the initial trading lot is equal to “StartLot”
- IF “AutoLot = true”, THEN the size of the initial trading lot is equal to: StartLot x RiskPercent x (Account Balance / 10.000)
RiskPercent = …..
StartLot = …..
InitialTrade = buy/sell
is related to:
- the first trade after starting up the EA.
- the first trade after the EA was paused by the “PauseAfterTP” setting.
InitialTrade_PendingOrderPips = …….
- the exact value in pips of the initial pending order.
- if “InitialTrade_PendingOrderPips” = 0 than no pending order will be used and the EA will open a new initial trade as soon as the EA starts up
- this value resets itself to 0 as soon as this pending order is activated
TralingStopStep = …..
- trailing stop step distance in pips
------------------------------------------
TP1 = …..
- the distance of the TP of the initial trade in pips (the lot size of this trade is calculated earlier in “StartLot”)
TrailingStop1 = …...
- trailing stop trailing distance.
- the Trailing stop is activated when the prices reaches TP1 value. If that happens TP1 is cancelled.
SL1 = …..
- the distance of the SL of the initial Trade in pips
------------------------------------------
DistanceTrade1-2 = …..
- the distance between the initial trade and the second (pending) order
Lotsize2 = …..
- the lot size for pending order 2 (the size is also calculated according to the “AutoLot” and “RiskPercent” settings)
TP2 = …..
- the TP distance for trade 2 in pips
TrailingStop2 = …...
- trailing stop trailing distance (for TP2)
SL2 = …..
- the SL distance for trade 2
-------------------------------------------
DistanceTrade2-3 = …..
- the distance between order 2 and 3
Lotsize3 = …..
- the lot size for pending order 3
TP3 = …..
- the TP distance for trade 3
TrailingStop3 = …...
SL3 = …..
- the SL distance for trade 3
-------------------------------------------
DistanceTrade3-4 = …..
- the distance between order 3 and 4
…….. etc
…….. etc
…….. until trade 12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++