MA_Ishimoku_Convert_Channel

Author: Copyright � 2010, MetaQuotes Software Corp.
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
MA_Ishimoku_Convert_Channel
//+------------------------------------------------------------------+
//|                                                MA_Ishimoku_2.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 3
#property indicator_color1 LightCoral
#property indicator_color2 DodgerBlue
#property indicator_color3 DodgerBlue
//---- 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.
extern double    percent_a=0.1; // ïðîöåíò îòêëîíåíèÿ îò ñðåäíåé äëÿ ïîñòðîåíèÿ âåðõíåé ãðàíèöû êàíàëà.
extern double    percent_b=0.1; // ïðîöåíò îòêëîíåíèÿ îò ñðåäíåé äëÿ ïîñòðîåíèÿ íèæíåé ãðàíèöû êàíàëà.
extern bool      line_up=false; // false - âåðõíÿ ãðàíèöà íå ñòðîèòñÿ  ; true- âåðõíÿÿ ãðàíèöà ñòðîèòñÿ;
extern bool      line_dw=false; // false-  íèæíÿÿ ãðàíèöà íå ñòðîèòñÿ  ; true- íèæíÿÿ ãðàíèöà ñòðîèòñÿ;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(4);
//---- indicators
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,LightCoral);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE,EMPTY,2,DodgerBlue);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE,EMPTY,2,DodgerBlue);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexBuffer(3,ExtMapBuffer4);

   IndicatorShortName("MA_Ishimoku_Convert_Channel");
//----
   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 limit=Bars-counted_bars;
   if(counted_bars==0) limit-=1+period_c;
   int i=limit;

// ArrayResize(Buffer2,Bars);
   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;
      if(line_up==true){ExtMapBuffer2[i]=(1+(percent_a/100))*ExtMapBuffer1[i];}
      if(line_dw==true){ExtMapBuffer3[i]=(1-(percent_b/100))*ExtMapBuffer1[i];}
      //----
      //Alert(sum);
      //Alert(period_c);

      i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---