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
(274)
Projects
346
29%
Arbitration
36
28% / 64%
Overdue
10
3%
Loaded
2
Developer 2
Rating
(111)
Projects
182
25%
Arbitration
24
17% / 75%
Overdue
16
9%
Free
3
Developer 3
Rating
(22)
Projects
21
10%
Arbitration
4
25% / 75%
Overdue
0
Free
4
Developer 4
Rating
(160)
Projects
207
61%
Arbitration
10
80% / 0%
Overdue
0
Free
Published: 1 code
5
Developer 5
Rating
(329)
Projects
515
19%
Arbitration
35
46% / 31%
Overdue
34
7%
Working
6
Developer 6
Rating
(2)
Projects
3
33%
Arbitration
3
33% / 33%
Overdue
0
Free
7
Developer 7
Rating
(2343)
Projects
2948
63%
Arbitration
124
44% / 26%
Overdue
429
15%
Working
8
Developer 8
Rating
(33)
Projects
35
20%
Arbitration
5
40% / 40%
Overdue
0
Free
Published: 1 code
9
Developer 9
Rating
(320)
Projects
325
71%
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
(613)
Projects
716
33%
Arbitration
46
48% / 41%
Overdue
14
2%
Loaded
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
(434)
Projects
640
53%
Arbitration
34
62% / 21%
Overdue
6
1%
Working
16
Developer 16
Rating
(5)
Projects
8
13%
Arbitration
3
0% / 33%
Overdue
2
25%
Free
Published: 1 code
17
Developer 17
Rating
(366)
Projects
447
55%
Arbitration
23
57% / 17%
Overdue
30
7%
Loaded
18
Developer 18
Rating
(59)
Projects
92
42%
Arbitration
4
0% / 100%
Overdue
3
3%
Working
19
Developer 19
Rating
(162)
Projects
289
35%
Arbitration
18
22% / 61%
Overdue
43
15%
Free
20
Developer 20
Rating
(8)
Projects
9
56%
Arbitration
0
Overdue
0
Free
21
Developer 21
Rating
(618)
Projects
1429
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
(2674)
Projects
3412
68%
Arbitration
77
48% / 14%
Overdue
342
10%
Working
Published: 1 code
25
Developer 25
Rating
(513)
Projects
552
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, I Wanne have a trading robot that give me signals for short buy and sell. And only for all currency in forex trading and also can use it on mt5
the bot will be used for xauusd scalp trading , want the bor follow the trading indicator will SL and open another opposite order where i can customize the SL margin and risk management
​1. General Overview: I am looking for an experienced developer to build (or debug/optimize) an MQL5 Expert Advisor. The EA will primarily trade Gold (XAU/USD) and US Indices (US30, US100). ​2. Platform & Broker Requirements: ​Platform: MetaTrader 5 (MQL5) ​Broker: Must be fully compatible with XM Broker execution. ​Account Types: Must support both Standard and Micro lot sizing seamlessly. ​3. Technical & Skill
I Have an existing Mql5 Expert advisor (source code), I want a professional programmer to help me Modify the EA... so that it can stop taking new trades once it Gets to a Pacific Lots Size or Floating loss
Hi, can you define entry conditions based on 100 or 200 trades? If you need more history, i can give you more trades. It is EURUSD with great results! If you can do it, contact me
take your time better make it for days and have good bot than never benefits both of us. Make the bot have zero errors and backtest it for a 2 year period
Wise Legend 30 - 500 USD
I want this robot to alert me on a good entry point on the trading flat form ether to buy or to sell. And also alert me when to close the market. And alert me on market continuations
I have an existing MT5 Expert Advisor with the original MQ5 source code. I need an experienced MQL5 developer to review, debug and professionally improve the existing EA, not build an unrelated EA from scratch. The EA is mainly for XAUUSD and already contains entry signals, EMA filters, automatic lot sizing, basket profit management, spread/margin protection, news filtering and recovery logic. The main problem is the
I buy EA for USDEUR or XAUUSD for FTMO with proven backtest. Send me images with backtest reports where daily max dd is 1% on 200k account. I can buy several eas if you have them with proofs. Need images of backtesting for 5 years
Cerco uno sviluppatore MQL5 esperto per lavorare su un Expert Advisor (EA) XAUUSD per MetaTrader 5 già esistente , versione attuale XAU_V59.mq5 . L'obiettivo è modificare, correggere e sviluppare il codice esistente senza stravolgere la logica già presente , mantenendo le regole ei parametri già definiti, salvo le modifiche espressamente richieste. REQUISITI FONDAMENTALI Il codice deve essere scritto in MQL5 nativo e

Project information

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