//+------------------------------------------------------------------+
//|                                                    3perekosa.mq4 |
//+------------------------------------------------------------------+
#property copyright "������� & aka KimIV"
#property link      "http://www.kimiv.ru"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2 Blue
#property indicator_color3 Red

//------- ���������� ���������� --------------------------------------

//------- ������� ��������� ���������� -------------------------------
extern string NameCross    = "GBPCHF"; // ������������ ������
extern string NameMain1    = "GBPUSD"; // ������������ �������� ���� 1
extern string NameMain2    = "USDCHF"; // ������������ �������� ���� 2

//------- ������ ���������� ------------------------------------------
double buf0[], buf1[], buf2[];
double P1=0,P2=0,P3=0;

//+------------------------------------------------------------------+
//| 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);
  SetIndexStyle (1, DRAW_LINE, STYLE_SOLID, 2);
  SetIndexEmptyValue(1, 0);

  SetIndexBuffer(2, buf2);
  SetIndexLabel (2, NameMain2);
  SetIndexStyle (2, DRAW_LINE, STYLE_SOLID, 2);
  SetIndexEmptyValue(2, 0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
  Comment("");
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void start() {
    P1=MarketInfo(NameMain1, MODE_BID)*MarketInfo(NameMain2, MODE_BID)-MarketInfo(NameCross, MODE_BID);
    P2=MarketInfo(NameMain1, MODE_BID)-MarketInfo(NameCross, MODE_BID)/MarketInfo(NameMain2, MODE_BID);
    P3=MarketInfo(NameMain2, MODE_BID)-MarketInfo(NameCross, MODE_BID)/MarketInfo(NameMain1, MODE_BID);
    buf0[0]=P1;
    buf1[0]=P2;
    buf2[0]=P3;
}
//+------------------------------------------------------------------+