3end
Download scriptThis technical tool is designed to provide traders with a visual representation of how different currency pairs interact with one another, specifically focusing on identifying relative value and potential trends. Rather than looking at a single pair in isolation, the script calculates a customized "composite" value based on the relationship between three specific currency pairs.
How it Works
The logic operates by taking three distinct financial instruments (for example, GBPCHF, GBPUSD, and USDCHF) and performing a mathematical correlation between them. It looks at the closing prices of these pairs simultaneously to determine a balanced "pivot" point.
Specifically, the script:
- Calculates Interdependencies: It measures the distance between the primary currency pair and two other supporting pairs. This helps reveal if a currency is overextended or undervalued relative to its peers.
- Generates a Composite Value: It creates an average mathematical profile (a "Price" line) that represents the combined momentum of these three instruments.
- Identifies Deviations: By comparing the current price of your active chart against this calculated composite value, the tool highlights whether the market is currently trading above or below its historical relationship with the other pairs.
Visual Output
The indicator provides a clear visual guide in a separate window:
- The Main Line: Represents the calculated composite value of the three currency pairs.
- The Current Price Trace: Shows where your specific currency pair is currently trading in relation to that composite value.
- Signal Markers: The script automatically places visual dots or markers on the chart based on the position of the current price relative to the composite line.
- If the current price is lower than the calculated composite, one set of markers appears.
- If the current price is higher than the composite, a different set of markers appears.
Summary for the User
Essentially, this script tells you: "Based on how these three currencies usually move together, where 'should' the price be right now?" It allows you to see if your currency pair is deviating from its normal behavior, potentially helping you identify entry points where the price might return to its "fair" value or continue a trend based on external currency correlations.
//+------------------------------------------------------------------+
//| 3perekosa.mq4 |
//+------------------------------------------------------------------+
#property copyright "Ïîðó÷èê & aka KimIV"
#property link "http://www.kimiv.ru"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Aqua
#property indicator_color2 Yellow
#property indicator_color3 Green
#property indicator_color4 Red
//------- Ãëîáàëüíûå ïåðåìåííûå --------------------------------------
//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern string NameCross = "GBPCHF"; // Íàèìåíîâàíèå êðîññà
extern string NameMain1 = "GBPUSD"; // Íàèìåíîâàíèå îñíîâíîé ïàðû 1
extern string NameMain2 = "USDCHF"; // Íàèìåíîâàíèå îñíîâíîé ïàðû 2
extern int NumberOfBars = 1000; // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)
extern bool Perevorot = false; // Ïåðåâîðà÷èâàåò èíäþêà îòíîñèòåëüíî ãîðèçîíòàëüíîé îñè.
//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double buf0[], buf1[], buf2[], buf3[];
double C=0,P=0,P1=0,P2=0,P3=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
SetIndexBuffer(0, buf0);
SetIndexLabel (0, "P");
SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 1);
SetIndexEmptyValue(0, 0);
SetIndexBuffer(1, buf1);
SetIndexLabel (1, Symbol());
SetIndexStyle (1, DRAW_LINE, STYLE_DOT, 1);
SetIndexEmptyValue(1, 0);
SetIndexBuffer(2, buf2);
SetIndexLabel (2, "DOTS");
SetIndexStyle (2, DRAW_ARROW, 1,3);
SetIndexArrow (2,164);
SetIndexEmptyValue(1, 0);
SetIndexBuffer(3, buf3);
SetIndexLabel (3, "DOTS");
SetIndexStyle (3, DRAW_ARROW, 1,3);
SetIndexArrow (3,164);
SetIndexEmptyValue(1, 0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
void deinit() {
Comment("");
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start() {
int LoopBegin, sh;
if (NumberOfBars==0) LoopBegin=Bars-1;
else LoopBegin=NumberOfBars-1;
LoopBegin=MathMin(Bars-1, LoopBegin);
for (sh=LoopBegin; sh>=0; sh--) {
P1=(iClose(NameMain1, 0, sh)*iClose(NameMain2, 0, sh)-iClose(NameCross, 0, sh))*3;
P2=(iClose(NameMain1, 0, sh)-iClose(NameCross, 0, sh)/iClose(NameMain2, 0, sh))*3;
P3=(iClose(NameMain2, 0, sh)-iClose(NameCross, 0, sh)/iClose(NameMain1, 0, sh))*3;
if (Perevorot) {P1=P1*(-1);P2=P2*(-1);P3=P3*(-1);}
C=iClose(Symbol(), 0, sh);
P1=P1+C;
P2=P2+C;
P3=P3+C;
P=(P1+P2+P3)/3;
// Comment(P," ",P1," ",P2," ",P3);
buf0[sh]=P;
buf1[sh]=C;
if (P>C) buf2[sh]=C;
if (P<C) buf3[sh]=C;
}
}
//+------------------------------------------------------------------+
Comments