For a year – 150 usd
No time limit – 300 usd

Strategy Description:

Hedging is the safest strategy on the market!
Expert Advisor based on correlation and co-integration of currency pairs.
Strategy description:
The robot works with smart hedging, the safest strategy on the market. He is hedging (insuring) orders of two highly correlated currency pairs, so no matter in which direction the market moves, the drawdown will be minimal, and the profit will be guaranteed! The sh expert Advisor trades on a split of currency pairs. When correlated instruments deviate from their course, the expert Advisor bets on a return to the correct rate.
Correlation (“correlation, correlation»), – statistical relationship of two or more random variables (or values that can be considered as such with some acceptable degree of accuracy). In this case, changes in the values of one value accompany a systematic change in the values of another value. The correlation coefficient is a mathematical measure of the correlation of two random variables.
Cointegration is a property of several non-stationary time series, which consists in the existence of a certain stationary linear combination of them. Co-integration is an important property of many economic variables, which means that despite the random (poorly predictable) nature of changes in individual economic variables, there is a long-term relationship between them, which leads to some joint, interrelated change.

How the strategy works:

We choose two currency pairs with a high correlation and cointegration coefficient. I have described how to choose pairs in several articles on this site. There is also a script for matching pairs of CORR. The Expert Advisor itself also has an algorithm for automatically selecting a pair. But more on that later.. If a pair of instruments has a high correlation, then most of the time the pair moves almost synchronously. But there are times when couples diverge from each other. At such a moment, the ADVISER opens counter positions as shown in the screenshot below:

the closing of transactions occurs when the currencies converge again and give a total profit. Let’s analyze the principle of hedging (insurance) in this example. We see that the sell position is open for GBPUSD, and the buy position is open for EURUSD. As long as the currencies run in parallel, their total profit will not change. If there is even a very long trend in one direction, for example, up, then we will get a loss for GBPUSD, and about the same profit for EURUSD. Thanks to this trading principle, we do not get large drawdowns. One deal always protects the other! The total profit for us occurs when the pairs approach each other. And at this moment, the adviser starts a profit trawl and takes the maximum possible profit.

These currency pairs are taken as an example only. This is not an ideal to look up to! But they show the principle of trading well because they often diverge and give a large number of transactions. Keep this in mind when choosing tools! If You want to get the most secure trading, you need to select pairs of instruments with a very high correlation. However, there will be very few transactions. Many people are tempted to put the correlation in the opposite direction. For example on EURUSD GBPUSD to trade in negative correlation or on-the-EURUSD-USDCHF – positive. This type of trading can bring a large profit in a short period of time. But it is this kind of trade that will sooner or later lead to a complete drain, since in this case, the pairs do not insure each other, but rather push the trade into the gap. If you want to trade safely, be sure to correctly consider the direction of correlation. The correlation coefficient on some pairs can show both positive and negative correlation on short sections. In this case, check the correlation sign for a longer period, such as 2000 candles. If the sign can change there, then it is better not to contact such pairs, since they most likely do not correlate with each other.

Expert Advisor parameters:

The first tool for trading, the Expert Advisor takes the one in the window of which it is installed.
Instrument_2 = “AUTO”;
The choice of the second instrument for trading. If you leave the field empty, the Expert Advisor offers a list of the most correlated instruments to choose from:

In this window, you need to select the second instrument that will be used for trading in the future. To prevent the EA from offering this menu again after restarting, enter the selected symbol in the Instrument_2 field. If you specify a specific instrument in the string Instrument_2, for example, USDCHF, then the Expert Advisor will work with it.
If you enter the word AUTO in the string Instrument_2, the Expert Advisor selects the second instrument based on the first one from the list provided in it:

At the same time, the Expert Advisor also changes the magic number for the convenience of analysis and trading in the basket. For example, you installed the Expert Advisor on a pair of USDCHF and set Instrument_2 = AUTO. The Expert Advisor selects the second EURUSD instrument and sets the magic number for all trades = 3.
The list of tools listed here may vary from version to version.
MAGIC = 100;
Unique position number. It is advisable to set it differently for each Expert Advisor so that the same pairs on different Expert Advisors do not overlap. If the Expert Advisor chooses a pair in AUTO mode, then it sets the magic itself and you don’t need to change it.
Correlation = AUTO;
Select the type of correlation between positive “+”, negative” -“, and automatic.
If you specify the Correlation = AUTO parameter, the Expert Advisor determines the type of correlation by the sign of the correlation coefficient at the time of opening positions.
The AUTO mode is recommended for advanced users. In AUTO mode, the corellia sign can change to the opposite in accordance with the behavior of currency pairs. And the direction of transactions depends on the corellia sign. If the sign change in AUTO mode occurs when a series of orders is open on the chart, then your top-ups may open in the wrong direction. This can be used in a strategy to accelerate the exit from the drawdown, but it may violate the basic principle of hedging. In most cases, it is recommended to fix the corellia sign ” + “or” -“, depending on the selected pairs.
Lot 1 Symbol (0-auto)= 0.01
Lot 2 Symbol (0-auto)= 0.01
Volume of the starting orders of the 1st and 2nd instruments. If set to 0, the Expert Advisor will calculate the lot of the second instrument based on their point value and volatility. (Automatic calculation is recommended only for advanced users). Do not confuse it with calculating the lot from the balance. It doesn’t depend on it!

The ideal option for trading with this Expert Advisor is when it opens no more than 1 pair of positions and closes this pair for profit. Then the next cycle… But if there was a de-correlation or the instruments were chosen incorrectly, the Expert Advisor can open additional positions at more favorable prices. Positions are opened using virtual pending orders. At the start, the Expert Advisor shows a line on the chart and moves it behind the price at a specified distance. And on the pullback of the price, when it crosses the line, it opens the top-up.

OrderLotUp = 2 – With which order we start increasing the lot.
K_Lot = 2.00 – Coefficient of change of subsequent lots.
Maxlot = 1 – The maximum possible lot of the opened position
MaxOrders = 4-Limit the number of orders
Step = 15 – The first step of the top-up orders.

If after setting the first pair of orders, their loss in pips has become greater than the one specified in the Step parameter, then the next top-up is opened. On 5-digit quotes, the Expert Advisor increases Step by 10 times. The step value indicated on the graph itself is the true value already changed for the number of characters.

K_Step= 1.5 – The step coefficient of the top-up orders. With Step=100 and K=1.5, the second step will be 150, the third 225, etc…. I.e., with each new top-up, the step will increase.

Level_Tral = 10 – Distance to the virtual top-up order.
Top-up orders are not opened immediately when the drawdown is reached. They are placed as virtual pending orders at a distance of Level_Tral from the current price. Next, this virtual pending order moves behind the price at the same distance, until the price on the reverse movement opens it.

Calculation of the instrument divergence delta.

TIMEFRAMES = 5; – TF for which we calculate the correlation delta.
BarsCorrelation= 300; – The number of candlesticks to calculate the correlation
K_Min_Delta= 1.10; – The maximum delta division coefficient defines the minimum input delta as DELTA_MAX / K_Min_Points. Used to change the minimum entry delta of the first positions.
Min_Delta. – Minimum delta of opening the first positions. It will only open if the delta

SPREAD (spread filters)

NoOpenSpread= 1-filter spread (Delta > sum spread) Do
not open if the delta is less than NoOpenSpread. Example: spread on EURUSD = 2 spread on GBPUSD = 3. Total (3+2=5). Trades will only open if the delta is greater than 15 (5*NoOpenSpredDelta) NoOpenSpread
only affects the opening of the first pair of positions.
MaxSpread= 0-MaxSpread (0-off) Do
not open or close trades if the spread on one of the pairs has become greater than the specified one
The exception is the manual closing and operation of virtual pending orders

Trailing Profit (Profit Trawl)

close profit (0-auto) start of the profit trawl in the deposit currency
close trall (rollback of the profit trawl in%)
K_D= 5 – The coefficient by which we divide the profit during automatic calculation. Works only if close profit = 0. In this case, the initial profit of the trawl is calculated depending on the current delta divided by the coefficient and multiplied by the sum of the products of the total volume and the value of the point of each currency.
Profit = DELTA / K x (tick_value1 x L1+tick_value2 x L2)
tick_value – currency point value
L1 – total lot of all positions of the first currency
L1 – total lot of all positions of the second currency

The trawl will be activated when a profit is reached, for example, 10 USD, and when a rollback of 50% closes everything. If the profit immediately went down after the start, it will close at 5 USD. If the profit has increased to 150 USD, then the pullback will close at 75usd and will not go further minus. If you want the Expert Advisor to immediately close orders when the specified profit is reached without a trawl, then set the rollback of the trawl
close trall = 0.

Close Delta

CloseRevers= true-CloseDelta closing when crossing the delta if the profit is greater than Min_Profit
Min_Profit_Delta= 0.00-Min Profit (minimum profit in 0-off currency)

Close Loss

CloseLoss = false – Close Loss closing at a loss
Loss_Close = 0-lossprofit (loss in currency 0-off) closing when the loss is reached
Stop_Trade = true-StopTrade stops trading at the start

Close Time

MinuteClose= 1500 – Minute Loss Close (0 – off). In this parameter, specify the number of minutes after which the EA will try to close the position at the expense of the accumulated profit.


Scalping-closing the last two trades when the profit is reached. This feature is disabled initially and I do not recommend using it without much experience as it can delay the process of closing the series. Its essence is that it tracks the last pair of transactions and when this pair in total makes a profit more than specified in ProfitSkalping, it closes only this pair without touching the rest. It only works when opening the second or subsequent pairs of orders.
ProfitSkalping = 0.0; – Scalping profit. (Total profit of the last 2 positions)


CorrOpen = 0.0; – Correlation open. Minimum correlation size
CorrClose = 0.0; – Correlation Close (0-off) (close if the correlation is lower and the profit is greater than Min_Profit
Min_Profit_Correlation = -10.0; – Min Profit (minimum profit in the deposit currency)
BarsControlCorrelation = 300; – Bars Control Correlation


Cointegration = false; – enables the cointegration filter
CoiOpen = 0.0; – cointegration open (0 – off) minimum cointegration size
CoiClose = 0.0; – cointegration Close (0-off) (close if cointegration is lower and profit is greater Min_Profit _Coi = -10.0; – Min Profit (minimum profit in the deposit currency)
PercentProfit = 10.0; – % profit closing (% profit on closing long-distance and decreasing correlation )

TIME (filter by time)

TimeStart = 1; – TimeStart (start time of the EA)
TimeEnd = 23; – timeEnd (end time of the EA)
The first trades are opened only in the time period from TimeStart to timeEnd. If you specify a timeEnd less than TimeStar, the EA will trade at night.
TimeNoOpenStart = 23: 30; / / TimeNoOpenStart (start time of the trade ban)
TimeNoOpenEnd = 01: 30; / / TimeNoOpenEnd (end time of the trade ban)
In this example, no trades will be opened from 23: 30 to 01: 30


Start_Lock_Orders = 0; – Start Lock Orders, 0-off (number of open knees for opening a lock order)
PercentLock = 100.0; – % Lock (%volume overlap) MinProfitLock
= 1.0; – MinProfitLock (minimum profit of the lock overlap)
Level_Lock = 10; – Level Lock (distance to the lock order)
The locking order is placed for the same currency pair for which the EA opened the specified number of main orders ( Start_Lock_Orders ). The Expert Advisor summarizes the profit of the locking order with the loss of the very first position of the same currency. If this amount reaches the MinProfitLock value, the EA closes the lock and 1 far position. Please note that it does not close in pairs, but only in the currency in which the lock was placed. The skew that occurred after this, the Expert Advisor restores at the expense of a virtual order.
The LOCK function is very dangerous and should not be used unnecessarily!

Equity Profit (closing when equity increases)

EquityProfit = 0.0; – Equity profit (closing on equity gain in currency) 0-off
The Expert Advisor closes all trades as soon as the equity increases by the specified amount. The function is intended more for the tester as its correct operation is possible only when trading on 1 Expert Advisor without a basket and without trading on other pairs.
At the start of the Expert Advisor. EquityProfit = 10 Balance = 1000 Equity = 1000.
In the course of trading, there was a drawdown on pairs of 100 USD. The current balance is 1105 USD and the equity is 1005. This is possible if the Expert Advisor worked by scalping or you yourself closed profitable trades not in pairs. As soon as the equity becomes 1010 USD, the EA will close all positions. The balance and equity in this case will become 1010 USD. That is, it will reduce the balance, but will bring the equity to a level higher than the starting one by 10 usd.

Filter GEP (filter for sudden jumps)

Filter_GEP = true; – If the delta has increased by more than 2 times on one bar, then we prohibit opening positions.
During a GAP or just a sharp jump in one of the currencies, there is a sharp expansion of the delta. This filter is necessary so that the Expert Advisor does not open positions in a turbulent market.

Other parameters

Slippage = 50; – Slippage, Price slippage
StringLines = 50; – String lines The number of lines in the information field in the center of the screen.
WindSize = 1.2; – Selection of the parameter for the size of the information depending on the type of monitor (set the value between 0.5 and 3)
SleepAfteOpenClose = 1000; – Delay after opening and closing positions in milliseconds.
AlertTime = 60; – Alert delay
time ask_open_close = true; – Ask again before opening and closing trades after clicking the buttons.
drawLine = true; – Show order lines on the screen

Additional functions of the Expert Advisor

If you click on the open position icon, the Expert Advisor offers to close it. At the same time, it shows all the data on it, including the current profit, taking into account the commission and swaps. You can close positions of any currency, not necessarily the one with the icon in the window.

About its acquisition, write to me

The adviser has a telegram channel

How to install the adviser.

You can download the Expert Advisor itself here:

SH 3.3
SH 3.3
Version: 3.3
189.2 KiB
SH 3.3
SH 3.3
Version: 3.3
249.1 KiB