Range Breakout EA in MQL5 according to spec

Specification

I am looking for an EA in MQL5 that trades both sides of a range breakout and places a hedge order. Fairly straightforward!

Here is a specification:

Trading Strategy Specification: Range Breakout

Platform: Metatrader 5, Forex brokers

Default Chart: EURUSD, 5m chart

Quick overview

The strategy looks for an established range in the morning session and then trades breakouts above or below that range, by opening either a long trade above the range or a short trade below the range. Take-profit and stop-loss targets are immediately set. If one order has been hit, the other order is immediately terminated. If a trade ends in stop-loss, a hedge trade is opened immediately afterwards

 

Description of Algorithm

Input Parameters

Name

data type

default value

starttime

time

7:00am UTC+1

endtime

time

9:00am UTC+1

minimumrange

number

10 pips

maximumrange

number

150 pips

entrybuffer

number

5%

exitbuffer

number

2%

riskrewardratio

number

2

tradevolume

number

0.05 lots

hedgerangedivider

number

3

hedgevolumemultiplier

number

4

endtime

time

8:00pm UTC+1

Step 1: Establish range in the morning session

Record the highest and the lowest encountered price in the time interval between start time and end time in two variables and calculate the resulting range. Also apply a minimum and maximum range.

High = highest price encountered in interal between starttime and endtime

Low = lowest price encountered in interval between starttime and endtime

Range = High - Low

if Range is higher than maximum range, then set Range = maximumrange

if Range is lower than minimum range, then set Range = minimumrange

Step 2: Trade Entries

Calculate the entry prices by using the range, and a buffer. Set the orders immediately after the time interval of step 1 is over. First, calculate price levels:

bufferrangeentry = range * (1+entrybuffer)

bufferrangeexit = range * (1+exitbuffer)

rangedivider = range / riskrewardratio

Place two pending stop orders with the following parameters:

1) Short Order

Direction: short

Entry Price: Low - bufferrangeentry

stop loss: High + bufferrangeexit

take profit: Entry - rangedivider

2) Long Order:

Direction: long

Entry: High + bufferrangeentry

Set stop loss: Low - bufferrangeexit

Set take profit: Entry + rangedivider


If one of the orders is hit, delete the other open order.

 

Step 3: Hedge Orders

If a stop loss has been hit, on the first opened position, we try to re-coup our losses with a hedge. Therefore a hedge order is placed at the stop-loss of the first opened order. Calculate the range of the hedge:

hedgerange = Range / hedgerangedivider

Place Long Hedge Order if 1st opened position was a short:

Direction: Long

Entry: 1st order stop loss price, immediately after

Stop loss: 1st order entry price

Take Profit: entry + hedgerange

OR

Place Short Hedge Order if 1st opened position was a long:

Direction: Short

Entry: 1st order stop loss price

Set Stop loss: 1st order entry price

set Take Profit: entry - hedgerange

 

Step 4: Close at market price at a time at the end of the day

Close all orders and positions at the given time in the endtime parameter


Responded

1
Developer 1
Rating
(241)
Projects
303
28%
Arbitration
33
24% / 61%
Overdue
9
3%
Busy
2
Developer 2
Rating
(103)
Projects
160
22%
Arbitration
23
9% / 78%
Overdue
16
10%
Loaded
3
Developer 3
Rating
(22)
Projects
21
10%
Arbitration
4
25% / 75%
Overdue
0
Free
4
Developer 4
Rating
(152)
Projects
190
57%
Arbitration
10
80% / 0%
Overdue
0
Free
Published: 1 code
5
Developer 5
Rating
(323)
Projects
502
19%
Arbitration
33
42% / 30%
Overdue
33
7%
Loaded
6
Developer 6
Rating
(2)
Projects
3
33%
Arbitration
3
33% / 33%
Overdue
0
Free
7
Developer 7
Rating
(2293)
Projects
2887
63%
Arbitration
122
44% / 25%
Overdue
428
15%
Working
8
Developer 8
Rating
(33)
Projects
35
20%
Arbitration
5
40% / 40%
Overdue
0
Free
Published: 1 code
9
Developer 9
Rating
(302)
Projects
308
69%
Arbitration
2
100% / 0%
Overdue
0
Free
Published: 1 code
10
Developer 10
Rating
(1)
Projects
1
0%
Arbitration
1
0% / 100%
Overdue
0
Free
11
Developer 11
Rating
(6)
Projects
7
0%
Arbitration
2
0% / 100%
Overdue
0
Working
12
Developer 12
Rating
(540)
Projects
622
33%
Arbitration
37
38% / 51%
Overdue
11
2%
Busy
13
Developer 13
Rating
(45)
Projects
46
24%
Arbitration
34
9% / 85%
Overdue
10
22%
Free
14
Developer 14
Rating
Projects
0
0%
Arbitration
1
0% / 0%
Overdue
0
Working
Published: 2 codes
15
Developer 15
Rating
(428)
Projects
623
54%
Arbitration
30
53% / 23%
Overdue
6
1%
Busy
16
Developer 16
Rating
(5)
Projects
8
13%
Arbitration
3
0% / 33%
Overdue
2
25%
Free
Published: 1 code
17
Developer 17
Rating
(333)
Projects
401
52%
Arbitration
20
55% / 15%
Overdue
29
7%
Loaded
18
Developer 18
Rating
(57)
Projects
89
43%
Arbitration
4
0% / 100%
Overdue
3
3%
Working
19
Developer 19
Rating
(159)
Projects
284
35%
Arbitration
18
22% / 61%
Overdue
42
15%
Loaded
20
Developer 20
Rating
(8)
Projects
9
56%
Arbitration
0
Overdue
0
Free
21
Developer 21
Rating
(617)
Projects
1427
59%
Arbitration
31
81% / 0%
Overdue
10
1%
Free
22
Developer 22
Rating
(493)
Projects
1022
58%
Arbitration
30
27% / 23%
Overdue
133
13%
Working
23
Developer 23
Rating
(322)
Projects
499
67%
Arbitration
5
40% / 0%
Overdue
4
1%
Free
Published: 8 codes
24
Developer 24
Rating
(2629)
Projects
3341
67%
Arbitration
77
48% / 14%
Overdue
342
10%
Free
Published: 1 code
25
Developer 25
Rating
(511)
Projects
549
53%
Arbitration
13
69% / 15%
Overdue
3
1%
Free
26
Developer 26
Rating
(574)
Projects
945
47%
Arbitration
309
58% / 27%
Overdue
125
13%
Free
Similar orders
Hi developers, I need someone to help me create a simple EA with my indicators and trading plan... I will give you all parameters and you help me create... 2 moving averages, one candle pattern
Please a need a very good expert for this jou I want to create 2 robot one a trade manager Perfect — here’s a clean, professional order description you can post directly to an EA freelancer (MQL5). I’ve written it so it’s clear, serious, and attractive to skilled developers 👌 MQL5 Trade Manager EA – Development Request I am looking for an experienced MQL5 developer to build a robust Trade Manager Expert Advisor for
Henryy999 30 - 3000 USD
The Ai robot must help me with forex and I don't have money soon can the Ai robot give me some money and I will pay it back if the Ai robot does a good job making me rich
Hello developers. I would like to write an Expert Advisor (EA) for MT4 based on the RSI indicator. -Conditions for placing a buy order: when the RSI indicator shows a buy signal with divergence, the CCI indicator is less than -100, and the lowest price is below the lower Bollinger Band. - Conditions for placing a sell order: when the RSI indicator shows a sell signal with divergence . The CCI indicator is greater
Project Title: MT5 Algo Trading EA (Single Strategy + License Panel + Ownership + Manual Trade) --- Project Description I am looking for an experienced MT5 (MQL5) developer to create a clean, stable and professional Algo Trading EA for my company and future clients. This is a long-term business project, not a one-time personal EA. --- 1. Strategy Requirements - Only 1 single trading strategy - No martingale - No grid
write me a fast eurusd and btc scalping robot using ema trend filter m1 and m5 entries lowspread check, less trades, strict risk management fixed tp/sl ssesion filter and tick based exists
Is there someone who coded the PipJuice indicator? Here is the link: https://www.pipjuice.io/ Unfortunately, I don‘t have access to the indicator or the code. If someone have it please send me some screenshots
I want to create an intraday EA designed to trade RSI pullbacks in the direction of the dominant trend during sufficient volatility, scales out profits, and automatically stands aside when market conditions stop supporting its edge. It should have the following features and are based on the following indicators: Trade FX on M15 Enter based on RSI, EMA and ATR Scale out profits using a multi-TP structure Trade only
I need a marketer who can actively sell my MetaTrader EA and generate real purchases. Offer Upfront: $50 (to start work immediately) Commission: 30% per sale on NET price (after payment processor/platform fees; VAT/taxes excluded) Commission is paid only on verified sales tracked through unique links/coupons. Your Job (what “SELL” means here) You must: Bring targeted buyers (traders, forex/crypto communities
Strategy Development: Suggest a high-probability trading strategy based on Technical Analysis (using indicators like RSI, MACD, or Price Action). Risk Management: Explain how to calculate position sizing so I don't lose more than 1-2% of my capital per trade. Market Analysis: Teach me how to identify Support and Resistance levels and how to spot a trend reversal. Psychology: Give me 5 golden rules to maintain

Project information

Budget
100 - 200 USD
Deadline
to 5 day(s)