i-Cross_Main
Download scriptThis technical indicator is designed to provide a visual comparison between two distinct types of currency relationships on a single chart. Instead of looking at just one currency pair, it allows you to monitor the price action of a specific "Cross Pair" against a mathematical product of two other "Main Pairs."
How the Logic Works
The tool functions by analyzing three different currency pairs simultaneously and plotting their data into a separate window below your main chart. Here is the breakdown of what happens behind the scenes:
- The Cross Pair: The script tracks the closing price of a primary pair you choose (for example, GBP/CHF). This represents the "base" movement you want to observe.
- The Combined Main Pairs: Simultaneously, the script looks at two other currency pairs (for example, GBP/USD and USD/CHF). Rather than showing them individually, it performs a mathematical calculation by multiplying the closing prices of these two pairs together.
- Visual Comparison: The indicator then plots both results as two separate lines on your screen.
Purpose and Use Case
The primary goal of this logic is to help traders identify correlations or divergences between different market instruments. By viewing the "Cross" price line directly against the "Multiplied Main" price line, you can more easily see:
- Synchronization: Whether the cross pair moves in harmony with the combined values of the main pairs.
- Relative Strength: How much one currency movement is being influenced by the underlying components of others.
- Trend Analysis: It simplifies complex multi-pair analysis into a single visual graph, making it easier to spot patterns that wouldn't be obvious if you were looking at three different charts at once.
You can customize which pairs are being compared and how much historical data is displayed through the indicator's settings menu, allowing for a tailored view of your specific trading strategy.
//+------------------------------------------------------------------+
//| i-Cross&Main.mq4 |
//| Ïîðó÷èê & aka KimIV |
//| http://www.kimiv.ru |
//| |
//| 07.01.2006 Èíäèêàòîð êðîññà è ïðîèçâåäåíèÿ îñíîâíûõ ïàð. |
//+------------------------------------------------------------------+
#property copyright "Ïîðó÷èê & aka KimIV"
#property link "http://www.kimiv.ru"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Blue
//------- Ãëîáàëüíûå ïåðåìåííûå --------------------------------------
//------- Âíåøíèå ïàðàìåòðû èíäèêàòîðà -------------------------------
extern string NameCross = "GBPCHF"; // Íàèìåíîâàíèå êðîññà
extern string NameMain1 = "GBPUSD"; // Íàèìåíîâàíèå îñíîâíîé ïàðû 1
extern string NameMain2 = "USDCHF"; // Íàèìåíîâàíèå îñíîâíîé ïàðû 2
extern int NumberOfBars = 1000; // Êîëè÷åñòâî áàðîâ îáñ÷¸òà (0-âñå)
//------- Áóôåðû èíäèêàòîðà ------------------------------------------
double buf0[], buf1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
SetIndexBuffer(0, buf0);
SetIndexLabel (0, NameCross);
SetIndexStyle (0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexEmptyValue(0, 0);
SetIndexBuffer(1, buf1);
SetIndexLabel (1, NameMain1+"*"+NameMain2);
SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, 2);
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--) {
buf0[sh]=iClose(NameCross, 0, sh);
buf1[sh]=iClose(NameMain1, 0, sh)*iClose(NameMain2, 0, sh);
}
}
//+------------------------------------------------------------------+
Comments