Klasternaya Mashka





//+------------------------------------------------------------------+
//|                                               Complex Mashka.mq4 |
//|                                Copyright © 2006,  Matist Krusoe. |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006,  Matist Krusoe."
#property link ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- indicator buffers
extern double Amplitude = 1;
extern double Sensitive = 1;
extern double KlasternCoff = 4;
double KlasternayaMashka[];
int MashkaPeriod;
//---- parameters
// for monthly
int mn_per = 12;
int mn_fast = 3;
// for weekly
int w_per = 9;
int w_fast = 3;
// for daily
int d_per = 5;
int d_fast = 3;
// for H4
int h4_per = 12;
int h4_fast = 2;
// for H1
int h1_per = 24;
int h1_fast = 8;
// for M30
int m30_per = 16;
int m30_fast = 2;
// for M15
int m15_per = 16;
int m15_fast = 4;
// for M5
int m5_per = 12;
int m5_fast = 3;
// for M1
int m1_per = 30;
int m1_fast = 10;
//----
int CountedBars;

/// Initialization function //

int init()
  {
   string short_name = "KM";
   int    draw_begin=MashkaPeriod-1;
   IndicatorShortName(short_name);

   SetIndexStyle(0,DRAW_LINE);
//---- indicator buffers mapping
   SetIndexBuffer(0, KlasternayaMashka);
//---- drawing settings
   SetIndexDrawBegin(0,draw_begin);
   SetIndexLabel(0,"Klasternaya Mashka");
//---- initialization done
   return(0);
  }
int start(){
   int limit;
   int Price=6;
   int Mode=3;
   double OPEN,HIGH,LOW,CLOSE,BAZZA;

   limit=Bars-CountedBars;
   int per1,per2;
// Indicator Period
      switch(Period())
        {
         case 1:     per1 = m1_per; per2 = m1_fast; break;
         case 5:     per1 = m5_per; per2 = m5_fast; break;
         case 15:    per1 = m15_per;per2 = m15_fast; break;
         case 30:    per1 = m30_per;per2 = m30_fast; break;
         case 60:    per1 = h1_per; per2 = h1_fast; break;
         case 240:   per1 = h4_per; per2 = h4_fast; break;
         case 1440:  per1 = d_per;  per2 = d_fast; break;
         case 10080: per1 = w_per;  per2 = w_fast; break;
         case 43200: per1 = mn_per; per2 = mn_fast; break;
        }
/*      switch(Period())
        {
         case 1:     MashkaPeriod = 30; break;  // m1
         case 5:     MashkaPeriod = 12; break;  // m5
         case 15:    MashkaPeriod = 16; break;  // m15
         case 30:    MashkaPeriod = 16; break;  // m30
         case 60:    MashkaPeriod = 24; break;  // h1
         case 240:   MashkaPeriod = 12; break;  // h4
         case 1440:  MashkaPeriod = 5;  break;  // daily
         case 10080: MashkaPeriod = 9;  break;  // weekly
         case 43200: MashkaPeriod = 12; break;  // mountly
        }*/
   per1*=Amplitude*Sensitive;
   per2*=Sensitive;     
   MashkaPeriod = per1;

   if(Bars<=MashkaPeriod) return(0);
   CountedBars=IndicatorCounted();
// Initial Zero
   if(CountedBars<1)
     {
      for(int k=1; k<=MashkaPeriod; k++) KlasternayaMashka[Bars-k]=0;
     }
// ïîñëåäíèå áûðà áóäóò ïåðåñ÷èòàíû
   if(CountedBars>0) CountedBars--;//-=250;
   if(Bars<=MashkaPeriod) return(0);

/// Garnd Circle //

   for(int i=0; i<limit; i++){
      if (Symbol() == "EURUSD"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURUSD",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "EURGBP"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-GBP(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-GBP(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-GBP(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-GBP(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURGBP",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "EURCHF"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURCHF",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "EURJPY"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURJPY",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "GBPUSD"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPUSD",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "GBPCHF"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPCHF",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "GBPJPY"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPJPY",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "USDCHF"){
               OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=USD(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("USDCHF",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "USDJPY"){
               OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=USD(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("USDJPY",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "CHFJPY"){
               OPEN=CHF(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=CHF(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=CHF(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=CHF(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("CHFJPY",0,MashkaPeriod,0,Mode,Price,i);
      }
      if (Symbol() == "NZDUSD"){
               OPEN=NZD(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=NZD(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=NZD(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=NZD(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("NZDUSD",0,MashkaPeriod,0,Mode,Price,i);
      }
      KlasternayaMashka[i] = BAZZA*(1 + (OPEN+HIGH+LOW+CLOSE)/KlasternCoff);
   }

   return(0);
  }
///////////////////////////////////////////////////////
double USD(int Mode, int Price, int i, int per1, int per2)
   {
   return(
            (iMA("EURUSD",0,per1,0,Mode,Price,i)-
            iMA("EURUSD",0,per2,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPUSD",0,per1,0,Mode,Price,i)-
            iMA("GBPUSD",0,per2,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDUSD",0,per1,0,Mode,Price,i)-
            iMA("NZDUSD",0,per2,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("USDCHF",0,per2,0,Mode,Price,i)-
            iMA("USDCHF",0,per1,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("USDJPY",0,per2,0,Mode,Price,i)-
            iMA("USDJPY",0,per1,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
          );   
}   

double NZD(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("NZDUSD",0,per2,0,Mode,Price,i)-
            iMA("NZDUSD",0,per1,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPNZD",0,per2,0,Mode,Price,i)-
            iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDCHF",0,per1,0,Mode,Price,i)-
            iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURNZD",0,per1,0,Mode,Price,i)-
            iMA("EURNZD",0,per2,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDJPY",0,per2,0,Mode,Price,i)-
            iMA("NZDJPY",0,per1,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
          );
   
}

double EUR(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("EURUSD",0,per2,0,Mode,Price,i)-
            iMA("EURUSD",0,per1,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURGBP",0,per2,0,Mode,Price,i)-
            iMA("EURGBP",0,per1,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
            +
            (iMA("EURCHF",0,per2,0,Mode,Price,i)-
            iMA("EURCHF",0,per1,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURNZD",0,per2,0,Mode,Price,i)-
            iMA("EURNZD",0,per1,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURJPY",0,per2,0,Mode,Price,i)-
            iMA("EURJPY",0,per1,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double GBP(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("GBPUSD",0,per2,0,Mode,Price,i)-
            iMA("GBPUSD",0,per1,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURGBP",0,per1,0,Mode,Price,i)-
            iMA("EURGBP",0,per2,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPCHF",0,per2,0,Mode,Price,i)-
            iMA("GBPCHF",0,per1,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPNZD",0,per2,0,Mode,Price,i)-
            iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPJPY",0,per2,0,Mode,Price,i)-
            iMA("GBPJPY",0,per1,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double CHF(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("USDCHF",0,per1,0,Mode,Price,i)-
            iMA("USDCHF",0,per2,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURCHF",0,per1,0,Mode,Price,i)-
            iMA("EURCHF",0,per2,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPCHF",0,per1,0,Mode,Price,i)-
            iMA("GBPCHF",0,per2,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDCHF",0,per1,0,Mode,Price,i)-
            iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("CHFJPY",0,per2,0,Mode,Price,i)-
            iMA("CHFJPY",0,per1,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double JPY(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("USDJPY",0,per1,0,Mode,Price,i)-
            iMA("USDJPY",0,per2,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("EURJPY",0,per1,0,Mode,Price,i)-
            iMA("EURJPY",0,per2,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPJPY",0,per1,0,Mode,Price,i)-
            iMA("GBPJPY",0,per2,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDJPY",0,per1,0,Mode,Price,i)-
            iMA("NZDJPY",0,per2,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("CHFJPY",0,per1,0,Mode,Price,i)-
            iMA("CHFJPY",0,per2,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
          );
   
}   
//+------------------------------------------------------------------+ */



/*
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- indicator parameters
int MashkaPeriod;
//---- indicator buffers
double ComplexMashka[];
//---- parameters
// for monthly
int mn_per = 12;
int mn_fast = 3;
// for weekly
int w_per = 9;
int w_fast = 3;
// for daily
int d_per = 5;
int d_fast = 3;
// for H4
int h4_per = 12;
int h4_fast = 2;
// for H1
int h1_per = 24;
int h1_fast = 8;
// for M30
int m30_per = 16;
int m30_fast = 2;
// for M15
int m15_per = 16;
int m15_fast = 4;
// for M5
int m5_per = 12;
int m5_fast = 3;
// for M1
int m1_per = 30;
int m1_fast = 10;
//----
int CountedBars;
//+------------------------------------------------------------------+
//| Initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name = "SCoMA";
   int    draw_begin=MashkaPeriod-1;
   IndicatorShortName(short_name);

   SetIndexStyle(0,DRAW_LINE);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
//---- indicator buffers mapping
   SetIndexBuffer(0,ComplexMashka);
//---- drawing settings
   SetIndexDrawBegin(0,draw_begin);
   SetIndexLabel(0,"Tenkan Sen");
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start(){
   int limit;
   int Price=6;
   int Mode=3;
   double OPEN,HIGH,LOW,CLOSE,BAZZA;
   if(Bars<=MashkaPeriod) return(0);
   CountedBars=IndicatorCounted();
   //---- ïðîâåðêà íà âîçìîæíûå îøèáêè
   if (CountedBars<0) return(-1);
   //---- ïîñëåäíèå áûðà áóäóò ïåðåñ÷èòàíû
   if(CountedBars>0) CountedBars--;//=250;
   limit=Bars-CountedBars;
   int per1,per2;
   //---- indicator period
      switch(Period())
        {
         case 1:     per1 = m1_per; per2 = m1_fast; break;
         case 5:     per1 = m5_per; per2 = m5_fast; break;
         case 15:    per1 = m15_per;per2 = m15_fast; break;
         case 30:    per1 = m30_per;per2 = m30_fast; break;
         case 60:    per1 = h1_per; per2 = h1_fast; break;
         case 240:   per1 = h4_per; per2 = h4_fast; break;
         case 1440:  per1 = d_per;  per2 = d_fast; break;
         case 10080: per1 = w_per;  per2 = w_fast; break;
         case 43200: per1 = mn_per; per2 = mn_fast; break;
        }
/*      switch(Period())
        {
         case 1:     MashkaPeriod = 30; break;  // m1
         case 5:     MashkaPeriod = 12; break;  // m5
         case 15:    MashkaPeriod = 16; break;  // m15
         case 30:    MashkaPeriod = 16; break;  // m30
         case 60:    MashkaPeriod = 24; break;  // h1
         case 240:   MashkaPeriod = 12; break;  // h4
         case 1440:  MashkaPeriod = 5;  break;  // daily
         case 10080: MashkaPeriod = 9;  break;  // weekly
         case 43200: MashkaPeriod = 12; break;  // mountly
        }*/
/*   MashkaPeriod = per1;
//+------------------------------------------------------------------+
//| Simple Complex Moving Average                                    |
//+------------------------------------------------------------------+
////////////////////////////////////////////////////////////
   for(int i=0; i<limit; i++)
       {
         if (Symbol() == "EURUSD"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURUSD",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "EURGBP"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-GBP(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-GBP(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-GBP(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-GBP(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURGBP",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "EURCHF"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURCHF",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "EURJPY"){
               OPEN=EUR(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=EUR(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=EUR(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=EUR(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("EURJPY",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "GBPUSD"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPUSD",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "GBPCHF"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPCHF",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "GBPJPY"){
               OPEN=GBP(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=GBP(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=GBP(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=GBP(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("GBPJPY",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "USDCHF"){
               OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-CHF(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-CHF(Mode,PRICE_HIGH,i,per1,per2);
               LOW=USD(Mode,PRICE_LOW,i,per1,per2)-CHF(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-CHF(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("USDCHF",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "USDJPY"){
               OPEN=USD(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=USD(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=USD(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=USD(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("USDJPY",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "CHFJPY"){
               OPEN=CHF(Mode,PRICE_OPEN,i,per1,per2)-JPY(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=CHF(Mode,PRICE_HIGH,i,per1,per2)-JPY(Mode,PRICE_HIGH,i,per1,per2);
               LOW=CHF(Mode,PRICE_LOW,i,per1,per2)-JPY(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=CHF(Mode,PRICE_CLOSE,i,per1,per2)-JPY(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("CHFJPY",0,MashkaPeriod,0,Mode,Price,i);
         }
         if (Symbol() == "NZDUSD"){
               OPEN=NZD(Mode,PRICE_OPEN,i,per1,per2)-USD(Mode,PRICE_OPEN,i,per1,per2);
               HIGH=NZD(Mode,PRICE_HIGH,i,per1,per2)-USD(Mode,PRICE_HIGH,i,per1,per2);
               LOW=NZD(Mode,PRICE_LOW,i,per1,per2)-USD(Mode,PRICE_LOW,i,per1,per2);
               CLOSE=NZD(Mode,PRICE_CLOSE,i,per1,per2)-USD(Mode,PRICE_CLOSE,i,per1,per2);
               BAZZA = iMA("NZDUSD",0,MashkaPeriod,0,Mode,Price,i);
         }
        ComplexMashka[i]=High[i];//BAZZA + BAZZA*(OPEN+HIGH+LOW+CLOSE)/4;
//----
   return(0);
   }
}   
///////////////////////////////////////////////////////
double USD(int Mode, int Price, int i, int per1, int per2)
   {
   return(
            (iMA("EURUSD",0,per1,0,Mode,Price,i)-
            iMA("EURUSD",0,per2,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPUSD",0,per1,0,Mode,Price,i)-
            iMA("GBPUSD",0,per2,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDUSD",0,per1,0,Mode,Price,i)-
            iMA("NZDUSD",0,per2,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("USDCHF",0,per2,0,Mode,Price,i)-
            iMA("USDCHF",0,per1,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("USDJPY",0,per2,0,Mode,Price,i)-
            iMA("USDJPY",0,per1,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
          );   
}   

double NZD(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("NZDUSD",0,per2,0,Mode,Price,i)-
            iMA("NZDUSD",0,per1,0,Mode,Price,i))/iMA("NZDUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPNZD",0,per2,0,Mode,Price,i)-
            iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDCHF",0,per1,0,Mode,Price,i)-
            iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURNZD",0,per1,0,Mode,Price,i)-
            iMA("EURNZD",0,per2,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDJPY",0,per2,0,Mode,Price,i)-
            iMA("NZDJPY",0,per1,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
          );
   
}

double EUR(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("EURUSD",0,per2,0,Mode,Price,i)-
            iMA("EURUSD",0,per1,0,Mode,Price,i))/iMA("EURUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURGBP",0,per2,0,Mode,Price,i)-
            iMA("EURGBP",0,per1,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
            +
            (iMA("EURCHF",0,per2,0,Mode,Price,i)-
            iMA("EURCHF",0,per1,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURNZD",0,per2,0,Mode,Price,i)-
            iMA("EURNZD",0,per1,0,Mode,Price,i))/iMA("EURNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURJPY",0,per2,0,Mode,Price,i)-
            iMA("EURJPY",0,per1,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double GBP(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("GBPUSD",0,per2,0,Mode,Price,i)-
            iMA("GBPUSD",0,per1,0,Mode,Price,i))/iMA("GBPUSD",0,per1,0,Mode,Price,i)
            +
            (iMA("EURGBP",0,per1,0,Mode,Price,i)-
            iMA("EURGBP",0,per2,0,Mode,Price,i))/iMA("EURGBP",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPCHF",0,per2,0,Mode,Price,i)-
            iMA("GBPCHF",0,per1,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPNZD",0,per2,0,Mode,Price,i)-
            iMA("GBPNZD",0,per1,0,Mode,Price,i))/iMA("GBPNZD",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPJPY",0,per2,0,Mode,Price,i)-
            iMA("GBPJPY",0,per1,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double CHF(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("USDCHF",0,per1,0,Mode,Price,i)-
            iMA("USDCHF",0,per2,0,Mode,Price,i))/iMA("USDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("EURCHF",0,per1,0,Mode,Price,i)-
            iMA("EURCHF",0,per2,0,Mode,Price,i))/iMA("EURCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPCHF",0,per1,0,Mode,Price,i)-
            iMA("GBPCHF",0,per2,0,Mode,Price,i))/iMA("GBPCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDCHF",0,per1,0,Mode,Price,i)-
            iMA("NZDCHF",0,per2,0,Mode,Price,i))/iMA("NZDCHF",0,per1,0,Mode,Price,i)
            +
            (iMA("CHFJPY",0,per2,0,Mode,Price,i)-
            iMA("CHFJPY",0,per1,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
          );
   
}   

double JPY(int Mode, int Price, int i, int per1, int per2){
   return(
            (iMA("USDJPY",0,per1,0,Mode,Price,i)-
            iMA("USDJPY",0,per2,0,Mode,Price,i))/iMA("USDJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("EURJPY",0,per1,0,Mode,Price,i)-
            iMA("EURJPY",0,per2,0,Mode,Price,i))/iMA("EURJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("GBPJPY",0,per1,0,Mode,Price,i)-
            iMA("GBPJPY",0,per2,0,Mode,Price,i))/iMA("GBPJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("NZDJPY",0,per1,0,Mode,Price,i)-
            iMA("NZDJPY",0,per2,0,Mode,Price,i))/iMA("NZDJPY",0,per1,0,Mode,Price,i)
            +
            (iMA("CHFJPY",0,per1,0,Mode,Price,i)-
            iMA("CHFJPY",0,per2,0,Mode,Price,i))/iMA("CHFJPY",0,per1,0,Mode,Price,i)
          );
   
}   
//+------------------------------------------------------------------+ */



Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: