DIFF 2Pairs
- Indicators
- Sergiy Podolyak
- Version: 3.38
- Updated: 5 June 2024
- Activations: 10
DIFF-2Pairs detects divergences of correlated pairs considering lots balancing (+ built-in strategy tester).
The indicator has a system for measuring the divergence of correlated pairs by various methods to estimate the value of the differential curve:
- the system can measure performance.
- statistical analysis to determine the optimal SL and TP.
- exporting data to a CSV file.
Currently, the indicator supports the following deviations of the correlated pairs:
- The standard deviation is the measurement of the standard deviation (StdDev).
- MA - measuring the difference in deviation (Moving Average).
- Stochastic – stochastic value of the deviation difference - Stochastic.
The price deviation of correlated pairs (difference) is displayed as a curve. Once the price divergence goes beyond, you open a position and close it after returning to the average value (ideal value).
Optimal SL and TP: How to determine the optimal value for TP and SL? And how to minimize losses with maximum profit? The answer to this question lies in the analysis of MFE and MAE:
- MFE analysis (Maximum Favorable Excursion) - helps us determine the optimal Take Profit (TP). This is the maximum profit.
- MAE analysis (Maximum Adverse Excursion) - helps us determine the optimal Stop Loss (SL). This is the maximum loss.
The algorithm of the indicator
At a discrepancy there are 3 inputs (3 × 2 pos.). After login, the calculation of MAE and MFE. Using this method allows you to increase profits. The system is more advantageous than without SL and TP, and is more reliable.
Various methods of modeling on history can be exported to an Excel file. This is a kind of strategy tester for pair trading (trade results can be analyzed using Excel tools).
In the indicator, two characters are entered and it should be on the chart of the 1st symbol. The signals are given by the indicator in the form of an alert, and the chart shows, in which direction it is necessary to open the traded symbols of the correlated pairs and with what volume (Lot).
Inputs
- DIFF_PairI - 1 symbol
- DIFF_PairII - 2 symbol
- TFPeriod - Working timeframe
- DirectionType - Type of referral (ByCorrelation / Positive / Negative)
- CorelationD1Period - Number of correlation bars (D1)
- AutoMagicNumber - Auto detection Magic number
- MagicNumber - Magic (manual input with AutoMagicNumber = false)
- FilterSpread - Use spread filter
- SpreadMax - Maximum spread is 2 symbols
- UseCommentOnGraph - Output of information on the chart (false-output in the indicator window)
- Language - display language
- LotSize - lot size
- BalanceLotSize - lot calculation (by Volatility / by price)
- VOL_PeriodATR - ATR period
- DIFF_Type - Type of difference (Standart Deviation-StdDev / Moving Average-MA / Stochastic)
- StdDevPeriod - Standard deviation period
- MaPeriod - МА period
- Kperiod - Period of the line K
- Dperiod - Period of the line D
- Slowing - Slowdown
- TS - Difference calculation type
- SendAlert - Signal- Алерт
- SendEmail - Signal e-mail
- TradePercentInput - % divergence for entry
- TradePercentClose - % divergence for output
- TradePercRecalcBars - recalculation percent every N bars
- TradeValueInput - value divergence for entry
- TradeValueClose - value divergence for output
- Profit_Calculation = Simulation of profit calculation (output to the graph)
- Spread_Sym1 - Spread of 1 symbol
- Spread_Sym2 - Spread of 2 symbol
- PercentMAE - % for MAE, percentage of loss reduction (risk reduction)
- PercentMFE - % for MFE, percentage of profit increase
- ExportTradeToCsv - Writing data to a file
- ShowOnlyDiffCurve - show only the difference curve
- MaxBarCount - number of calculated bars, if 0 - then all
- ShowPriceLabel - Difference value indicator
- ResetAlertStatusAfterStart - Reset the last line status activation
- ColorBuy - color of the Buy symbol
- ColorSell - color of the Sell symbol
- Color_Correl – correlation
- Color_Text - text simulation of profit / loss calculation
- Color_BLevels - Buy entry levels
- Color_SLevels - Sell entry levels
- Color_Magic - magic
- Color_HourON - time on
- Color_HourOFF - time off
- Color_SpreadON - spread on
- Color_SpreadOFF - spread off
- Color_ProfitPlus - profit(+)
- Color_ProfitMinus - profit(-)
- Color_StopLevelLine - stop-level
- Color_ZeroLine - zero-line
- Color_TradeLine - trade-line
- Color_PriceLabel - price label