MA_Ishimoku

Author: Copyright � 2010, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
MA_Ishimoku
//+------------------------------------------------------------------+
//|                                                MA_Ishimoku.mq4 |
//|                      Copyright © 2010, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 LightCoral

//---- input parameters
extern int       period_a=3;   // ïåðèîä, èñïîëüçóåìûé äëÿ âû÷èñëåíèÿ íàèâûñøåãî çíà÷åíèÿ öåíû
extern int       period_b=5;   // ïåðèîä, èñïîëüçóåììûé äëÿ âû÷èñëåíèÿ íàèíèçøåãî çíà÷åíèÿ öåíû
extern int       period_c=8;   // ïåðèîä, èñïîëüçóåììûé äëÿ âû÷èñëåíèÿ ñêîëüçÿùåé ñðåäíåé 
extern int       mode_a=3;     // ïàðàìåòðû, èñïîëüçóåìûå äëÿ ïîèñêà íàèâûñøåé è íàèíèçøåé öåí: 
extern int       mode_b=3;     // 0- OPEN; 1- LOW; 2- HIGH; 3- CLOSE; 4- VOLUME.

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(2);
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,LightCoral);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer4);
   IndicatorShortName("MA_Ishimoku"+period_a+"  "+period_b+"  "+period_c);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   int i=Bars-counted_bars;
   if(counted_bars==0) i-=1+period_c;

   if(mode_a<0 || mode_a>4){mode_a=0;}
   if(mode_b<0 || mode_b>4){mode_b=0;}
   while(i>=0)
     {
      //----
      double ish_1=High[iHighest(NULL,0,mode_a,period_a,i)];
      double ish_2=Low[iLowest(NULL,0,mode_b,period_b,i)];
      ExtMapBuffer4[i]=(ish_1+ish_2)/2;

      double sum=0;
      for(int y=i;y<i+period_c;y++){sum=sum+ExtMapBuffer4[y];}
      ExtMapBuffer1[i]=sum/period_c;
      //----
      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments