i-Cross&Main_v1
Download scriptThis tool is designed for traders who want to visualize the relationship between different currency pairs on a single chart. Instead of looking at multiple separate windows, it allows you to compare how specific "cross" currencies move in relation to "main" currency combinations.
How the Logic Works
The script performs two primary functions simultaneously to provide a comparative view of market behavior:
1. Direct Cross Tracking The tool identifies one specific currency pair (the "Cross") that you select as your primary point of reference. It pulls the closing prices for this pair and plots them as a solid line on your chart. This allows you to see the standard price action of that specific pair clearly.
2. Combined Main Pair Multiplication This is the unique analytical feature of the script. You can select two different "Main" currency pairs, and the tool will automatically multiply their closing prices together. By combining these two pairs into a single value, the script creates a composite line.
Purpose for the Trader
The goal of this logic is to reveal underlying correlations. By plotting the price of a "Cross" pair against the product of two "Main" pairs on the same scale:
- Correlation Identification: You can visually see if the Cross pair moves in harmony with the combined strength/weakness of the Main pairs.
- Simplified Analysis: It eliminates the need to flip between different charts, providing a side-by-side comparison of how different market dynamics influence one another.
- Customizable Range: You can define exactly how much historical data you want to view (the number of bars), making it easy to focus on recent trends or longer-term historical cycles.
In short, this script acts as a visual bridge, allowing you to see if the movements in your primary trade are being driven by the combined dynamics of other major currency pairs.
//+------------------------------------------------------------------+
//| 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