Overlay Positive Hedging EA - MT4/MT5 Resources
Hello. I found this EA on another media. Below is the description given by the author. I just started trying this and will post my results. Introduction
This technique was introduced on another forum by fellow trader Meet Joe Black, Maidin, and a few others (sorry not named here). In appreciation of their contributions, I would like to thank and congratulate everyone involved in developing this trading technology.
The technology can be briefly explained as follows:
1. Concept
a) Often, some Forex instruments (trading instruments), so-called currency pairs, move in line with other currency pairs. GBP/USD (GU) and Euro/USD (EU), for example, generally move in the same direction. However, some of these currencies move in opposite directions, such as EURUSD and USDCHF. A currency pair that moves in the same direction is considered to have a positive correlation, while a pair that moves in the opposite direction has a negative correlation. If we enter the market by buying GU and selling EU at the same time, we are in a hedged or so-called locked-in position
b) Although GU and EU generally move in the same direction, the moving distance (in points) between GU and EU is different. Generally speaking, based on past records, GU changes more than EU. In order to balance out changes in the currency value of these currency pairs (e.g. USD currency), we use the ratio of the average daily range (ADR) between these currency pairs to determine the lot size to use during a trade. The average EU ADR to GU ratio over the past 365 days was approximately 0.8. This means that if GU moves 200 points in one day, EU is expected to move a total of 160 points (= 0.8x200). To get the proper balance for USD hedging, we use smaller lot sizes of GU. If we trade EU with 1.0 lots, then the lot size of GU should be 0.8 lots, which is the result of multiplying the ADR ratio (0.8) by the lot size of EU (1.0 lots).
2. In and out
Although GU and EU usually move in tandem most of the time, there are certain situations that can cause GU to move in the opposite direction to EU's. When a currency pair moves in the opposite direction, the number of pips moved in the opposite direction is called a gap. We can enter the market when the gap between the opposite direction moves of GU and EU is significantly large (recommended minimum gap is 100 pips). Assume that when there is a 100-point gap, the trend of GU is upward and the trend of EU is downward, then it is recommended that we sell GU and buy EU to enter the market at the same time (if the trend of GU is a downward trend, on the contrary, the trend of EU is an upward trend, we will buy GU and sell EU).
When GU and EU start moving in similar directions (or close the gap), our short position is considered to be in profit territory and we should exit the market. In order to close the gap from before where GU was up and EU was down, GU would have to go down, EU would have to go up, or GU would have to go down significantly, or another possibility is that EU would have to go up significantly.
The single lot quantity recommended on the market for pair 1 (e.g. GU, GU-EU pairing) is based on the ADR ratio between the two pairs. Therefore, if we use 1 lot for EU, then we assume 0.8 lot for GU.
3. Take Profit (TP) and Stop Loss (SL)
All open positions in this technology use open TP and open SL. You have to float the post until the float point or the profit in dollar value of both currency pairs becomes positive.
4. What should I do if the floating distance (gap) increases?
If the market goes against your opening position, you can enter a new post for GU and EU a second time (we call it the second level of your post), and so on, with a floating loss for each additional distance (in points). For the combination of GU and EU, it is recommended that the distance per layer is 100 points. If you have accumulated net profits on the currency pairs at the last level (recommended between 100-50 pips), you should close these profitable positions and float other positions.
5. Equity Management or Money Management (MM)
For $1k of equity, a lot size of 0.05 units to 0.1 units should be used per tier. (A trading lot of 0.1 units is often called a dime, and a movement of 1 pip has a monetary value of 10 cents). If using large 10 cent sizes in trading, your account should be able to withstand float losses of at least 10 levels or 1000 pips in the market.
6. Purpose of threads
To facilitate manual trading, a robot called "Overlay Forward Hedging" was developed. Since the robot is still in the testing and development stage, I started this post mainly to share its setup, ideas, bug debugging, or anything that can improve its functionality and performance. Any suggestions for modifying or upgrading the bot are very welcome. Discussion of this topic should focus on the development of robots.
The developed robot can be used for forward testing to verify whether the technology is a profitable method or to monitor its drawdown. The bot cannot be backtested because it involves two different pairs
The robot is based on overlay hedging technology. It can be used for pairs with positive correlation (e.g. GU vs. EU)
7. Settings
The parameter settings used by this robot are as follows:
Charts If you want to trade multiple GBPUSD-EURUSD two-way (overlay hedging), you should install the robot on two charts, the GU chart and the EU chart. This robot should be placed on the chart of currency pair 1 (GBPUSD) and the same robot should be placed on the chart of currency pair 2 (EURUSD). If you only trade one way, put the robot on only one chart, whether it is the chart of currency pair 1 (GBPUSD) or the chart of currency pair 2 (EURUSD)
Timeframe bots can be placed on any timeframe. However, the D1 timeframe of the chart belonging to the trading pair must be updated. This is necessary for the robot to correctly calculate the ADR ratio.
Two-way trading (overlay hedging)
Used for two-way trading or called overlay hedging (traditional hedging). The parameters of both robots must be set as follows:
1. In the chart of currency pair 1 (assuming GBPUSD):
a. TradeCouple1 = true
b. TradeCouple2 = False
2. In the chart of the 2nd currency pair (assuming EURUSD):
a. TradeCouple1 = False
b. TradeCouple2 = true
One-way transaction (overlay)
Place the robot into one of the charts (chart pair 1 or chart pair 2). If you want to buy Pair 1 and sell Pair 2, please set the robot parameters as follows
a. TradeCouple1 = true
b. TradeCouple2 = False
Alternatively, if you want to sell Pair 1 and buy Pair 2, set the robot parameters as follows
a. TradeCouple1 = False
b. TradeCouple2 = true
Robot parameter settings
1. Lot size = 0.1
The lot size of the second pair (Pair 2). Assume that Pair 1 and Pair 2 are set to GU and EU respectively. The lot size used for the first pair (Pair 1) is determined by the ratio of the average daily range (ADR) between the two pairs. Assume that the parameter of "lot size" is set to 0.1, then the lot size used by Pair 1, that is, GU is the "lot size" multiplied by the ADR ratio = 0.1 x 0.8 = 0.08 units. The lot size of the 2nd pair, i.e. EU = "lot size" = 0.1 units
2. Layer distance = 100
The distance in points between each layer or level to open the next few posts in a new layer.
3.UseTakeProfitByPip = true
If you want to close your post by getting ideas, set this parameter to TRUE. Otherwise FALSE if not used.
4. Take profit = 80
Defines the total profit (in pips) of the last level currency pair 1 and currency pair 2. Once the pair has achieved a defined profit in pips, the bot will close the post on the final level.
5.UseTakeProfitByUSD = false
If you want to turn off posts defined by a USD monetary value, set this parameter to TRUE. Otherwise FALSE if not used.
6. USD take profit = 100
Defines the total net profit (in dollars) of Pair 1 and Pair 2 at the last level. Once the pair has achieved the stated profit in USD, the bot will close the post on the final level
7. Maximum number of layers = 5
The maximum layer or level for the bot to open. There is no specific number for the maximum number of layers.
8. Pair1 = The symbol of GBP/USD currency pair 1 or the full name of the currency pair. The ADR of currency pair 1 must be greater than currency pair 2.
9. Pair2 = The symbol of EURUSD currency pair 2 or the full name of the currency pair. The ADR of currency pair 2 must be smaller than currency pair 1
10. Note1 = “Pairing 1: Buy Pair1, Sell Pair2”
As a reminder, "Couple 1" is the input of a buy for pair 1 and a sell for pair 2.
11. Note2 = “Pair 2: Sell Pair1, Buy Pair2”
As a reminder, "Couple 2" is the input of a sell for pair 1 and a buy for pair 2.
12. TradeCouple1 = True If you wish to trade by buying pair 1 and selling pair 2, set this parameter to TRUE.
13. TradeCouple2 = False.
If you wish to trade by selling pair 1 and buying pair 2, set this parameter to TRUE.
14.ADR_Day = 365
Defines the number of days for calculating the average daily range. The robot then uses the calculated ADR to obtain the ADR ratio between Pair 2 and Pair 1
15.UseManual_ADR_Ratio = true
If you want to calculate batches for Pair 1 based on the parameters set by ADR_Ratio, set this parameter to TRUE. Otherwise, the robot will determine the ADR ratio on its own.
16. ADR_ratio = 0.8
This is the ADR ratio between currency pair 2 and currency pair 1. If UseManual_ADR_Ratio = true, this ratio is used to calculate the trading lot size for currency pair 1.
17. Magic number = 90000
Couple identification number for each pair. For example, if you want to trade several GU-EU, the number should be set up similarly on the GU and EU charts. If you want to use a different pair in the trade, such as the AUDUSD-NZDUSD pair, you must change the parameters to a different number, such as 90001. Use the same parameter numbers in the AUDUSD and NZDUSD charts.
See Overlay Indicator to visualize overlay. http://www.forexfactory.com/showthread.php?t=158161
Not sure what kind of overlay the EA uses.
Edit: May 11, 2012 Thanks to the efforts of KingHigh, we have a readable translation of the original .ex4 decompilation.
Edited May 14, 2012: Removed errors from KingHigh's translation. Damn, does this sound biblical or something?
EDIT May 16, 2012 Version 3: Bug in SendSell(...) regarding returns (tickets) fixed, KingHigh.
EDIT 5/17/2012: Set up additional settings file for my local PC version. Originally recommended by Paulss
This technique was introduced on another forum by fellow trader Meet Joe Black, Maidin, and a few others (sorry not named here). In appreciation of their contributions, I would like to thank and congratulate everyone involved in developing this trading technology.
The technology can be briefly explained as follows:
1. Concept
a) Often, some Forex instruments (trading instruments), so-called currency pairs, move in line with other currency pairs. GBP/USD (GU) and Euro/USD (EU), for example, generally move in the same direction. However, some of these currencies move in opposite directions, such as EURUSD and USDCHF. A currency pair that moves in the same direction is considered to have a positive correlation, while a pair that moves in the opposite direction has a negative correlation. If we enter the market by buying GU and selling EU at the same time, we are in a hedged or so-called locked-in position
b) Although GU and EU generally move in the same direction, the moving distance (in points) between GU and EU is different. Generally speaking, based on past records, GU changes more than EU. In order to balance out changes in the currency value of these currency pairs (e.g. USD currency), we use the ratio of the average daily range (ADR) between these currency pairs to determine the lot size to use during a trade. The average EU ADR to GU ratio over the past 365 days was approximately 0.8. This means that if GU moves 200 points in one day, EU is expected to move a total of 160 points (= 0.8x200). To get the proper balance for USD hedging, we use smaller lot sizes of GU. If we trade EU with 1.0 lots, then the lot size of GU should be 0.8 lots, which is the result of multiplying the ADR ratio (0.8) by the lot size of EU (1.0 lots).
2. In and out
Although GU and EU usually move in tandem most of the time, there are certain situations that can cause GU to move in the opposite direction to EU's. When a currency pair moves in the opposite direction, the number of pips moved in the opposite direction is called a gap. We can enter the market when the gap between the opposite direction moves of GU and EU is significantly large (recommended minimum gap is 100 pips). Assume that when there is a 100-point gap, the trend of GU is upward and the trend of EU is downward, then it is recommended that we sell GU and buy EU to enter the market at the same time (if the trend of GU is a downward trend, on the contrary, the trend of EU is an upward trend, we will buy GU and sell EU).
When GU and EU start moving in similar directions (or close the gap), our short position is considered to be in profit territory and we should exit the market. In order to close the gap from before where GU was up and EU was down, GU would have to go down, EU would have to go up, or GU would have to go down significantly, or another possibility is that EU would have to go up significantly.
The single lot quantity recommended on the market for pair 1 (e.g. GU, GU-EU pairing) is based on the ADR ratio between the two pairs. Therefore, if we use 1 lot for EU, then we assume 0.8 lot for GU.
3. Take Profit (TP) and Stop Loss (SL)
All open positions in this technology use open TP and open SL. You have to float the post until the float point or the profit in dollar value of both currency pairs becomes positive.
4. What should I do if the floating distance (gap) increases?
If the market goes against your opening position, you can enter a new post for GU and EU a second time (we call it the second level of your post), and so on, with a floating loss for each additional distance (in points). For the combination of GU and EU, it is recommended that the distance per layer is 100 points. If you have accumulated net profits on the currency pairs at the last level (recommended between 100-50 pips), you should close these profitable positions and float other positions.
5. Equity Management or Money Management (MM)
For $1k of equity, a lot size of 0.05 units to 0.1 units should be used per tier. (A trading lot of 0.1 units is often called a dime, and a movement of 1 pip has a monetary value of 10 cents). If using large 10 cent sizes in trading, your account should be able to withstand float losses of at least 10 levels or 1000 pips in the market.
6. Purpose of threads
To facilitate manual trading, a robot called "Overlay Forward Hedging" was developed. Since the robot is still in the testing and development stage, I started this post mainly to share its setup, ideas, bug debugging, or anything that can improve its functionality and performance. Any suggestions for modifying or upgrading the bot are very welcome. Discussion of this topic should focus on the development of robots.
The developed robot can be used for forward testing to verify whether the technology is a profitable method or to monitor its drawdown. The bot cannot be backtested because it involves two different pairs
The robot is based on overlay hedging technology. It can be used for pairs with positive correlation (e.g. GU vs. EU)
7. Settings
The parameter settings used by this robot are as follows:
Charts If you want to trade multiple GBPUSD-EURUSD two-way (overlay hedging), you should install the robot on two charts, the GU chart and the EU chart. This robot should be placed on the chart of currency pair 1 (GBPUSD) and the same robot should be placed on the chart of currency pair 2 (EURUSD). If you only trade one way, put the robot on only one chart, whether it is the chart of currency pair 1 (GBPUSD) or the chart of currency pair 2 (EURUSD)
Timeframe bots can be placed on any timeframe. However, the D1 timeframe of the chart belonging to the trading pair must be updated. This is necessary for the robot to correctly calculate the ADR ratio.
Two-way trading (overlay hedging)
Used for two-way trading or called overlay hedging (traditional hedging). The parameters of both robots must be set as follows:
1. In the chart of currency pair 1 (assuming GBPUSD):
a. TradeCouple1 = true
b. TradeCouple2 = False
2. In the chart of the 2nd currency pair (assuming EURUSD):
a. TradeCouple1 = False
b. TradeCouple2 = true
One-way transaction (overlay)
Place the robot into one of the charts (chart pair 1 or chart pair 2). If you want to buy Pair 1 and sell Pair 2, please set the robot parameters as follows
a. TradeCouple1 = true
b. TradeCouple2 = False
Alternatively, if you want to sell Pair 1 and buy Pair 2, set the robot parameters as follows
a. TradeCouple1 = False
b. TradeCouple2 = true
Robot parameter settings
1. Lot size = 0.1
The lot size of the second pair (Pair 2). Assume that Pair 1 and Pair 2 are set to GU and EU respectively. The lot size used for the first pair (Pair 1) is determined by the ratio of the average daily range (ADR) between the two pairs. Assume that the parameter of "lot size" is set to 0.1, then the lot size used by Pair 1, that is, GU is the "lot size" multiplied by the ADR ratio = 0.1 x 0.8 = 0.08 units. The lot size of the 2nd pair, i.e. EU = "lot size" = 0.1 units
2. Layer distance = 100
The distance in points between each layer or level to open the next few posts in a new layer.
3.UseTakeProfitByPip = true
If you want to close your post by getting ideas, set this parameter to TRUE. Otherwise FALSE if not used.
4. Take profit = 80
Defines the total profit (in pips) of the last level currency pair 1 and currency pair 2. Once the pair has achieved a defined profit in pips, the bot will close the post on the final level.
5.UseTakeProfitByUSD = false
If you want to turn off posts defined by a USD monetary value, set this parameter to TRUE. Otherwise FALSE if not used.
6. USD take profit = 100
Defines the total net profit (in dollars) of Pair 1 and Pair 2 at the last level. Once the pair has achieved the stated profit in USD, the bot will close the post on the final level
7. Maximum number of layers = 5
The maximum layer or level for the bot to open. There is no specific number for the maximum number of layers.
8. Pair1 = The symbol of GBP/USD currency pair 1 or the full name of the currency pair. The ADR of currency pair 1 must be greater than currency pair 2.
9. Pair2 = The symbol of EURUSD currency pair 2 or the full name of the currency pair. The ADR of currency pair 2 must be smaller than currency pair 1
10. Note1 = “Pairing 1: Buy Pair1, Sell Pair2”
As a reminder, "Couple 1" is the input of a buy for pair 1 and a sell for pair 2.
11. Note2 = “Pair 2: Sell Pair1, Buy Pair2”
As a reminder, "Couple 2" is the input of a sell for pair 1 and a buy for pair 2.
12. TradeCouple1 = True If you wish to trade by buying pair 1 and selling pair 2, set this parameter to TRUE.
13. TradeCouple2 = False.
If you wish to trade by selling pair 1 and buying pair 2, set this parameter to TRUE.
14.ADR_Day = 365
Defines the number of days for calculating the average daily range. The robot then uses the calculated ADR to obtain the ADR ratio between Pair 2 and Pair 1
15.UseManual_ADR_Ratio = true
If you want to calculate batches for Pair 1 based on the parameters set by ADR_Ratio, set this parameter to TRUE. Otherwise, the robot will determine the ADR ratio on its own.
16. ADR_ratio = 0.8
This is the ADR ratio between currency pair 2 and currency pair 1. If UseManual_ADR_Ratio = true, this ratio is used to calculate the trading lot size for currency pair 1.
17. Magic number = 90000
Couple identification number for each pair. For example, if you want to trade several GU-EU, the number should be set up similarly on the GU and EU charts. If you want to use a different pair in the trade, such as the AUDUSD-NZDUSD pair, you must change the parameters to a different number, such as 90001. Use the same parameter numbers in the AUDUSD and NZDUSD charts.
See Overlay Indicator to visualize overlay. http://www.forexfactory.com/showthread.php?t=158161
Not sure what kind of overlay the EA uses.
Edit: May 11, 2012 Thanks to the efforts of KingHigh, we have a readable translation of the original .ex4 decompilation.
Edited May 14, 2012: Removed errors from KingHigh's translation. Damn, does this sound biblical or something?
EDIT May 16, 2012 Version 3: Bug in SendSell(...) regarding returns (tickets) fixed, KingHigh.
EDIT 5/17/2012: Set up additional settings file for my local PC version. Originally recommended by Paulss
























Attachment to original post (4)
📦 Summary of post attachments(39)
Below are all the files (39) shared in the reply.
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •