//+------------------------------------------------------------------+
//|                                                          PIN.mq4 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window
#include "PIN.mqh"
PIN * pins[28];
  string symbols[] = { "AUDCAD", "EURUSD", "AUDUSD" };

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   for( int i=0;i<3;i++ )
   pins[i] = new PIN( symbols[i], 1 );
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
for( int i=0; i<3; i++ )
	pins[ i ].set( pin( i ) );

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

int pin( int i ) {
  double price[2];

   price[0] = iMA( symbols[ i ], 0, 16, 0, 3, 0, 0 );
   price[1] = iMA( symbols[ i ], 0, 16, 0, 3, 0, 1 );

	if ( price[ 0 ] > price[ 1 ] )
		return( 1 );
	if ( price[ 0 ] < price[ 1 ] )
		return( 2 );

return( 0 );
}