Author: Mns777
Y_effect_m
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Y_effect_m
//+------------------------------------------------------------------+
//| Web:                                                Y(Efekt).mq4 |
//|                                                           MNS777 |
//|                                                mns777.ru@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Mns777"
#property link      ""
//----
#property indicator_separate_window
#property indicator_buffers  2
#property indicator_minimum -1
#property indicator_maximum  1
//----
#property indicator_color1 Green
#property indicator_color2 Red

extern int        mode  = 2;
extern string     modes = "0LH 1HL 2HH 3CC";

//---- òîëùèíà èíäèêàòîðíûõ ëèíèé
#property indicator_width1 2
#property indicator_width2 2
//---- ïàðàìåòðû ãîðèçîíòàëüíûõ óðîâíåé èíäèêàòîðà
#property indicator_level1  0.5
#property indicator_level2  -0.5
#property indicator_levelcolor   SlateGray
//---- Âíåøíèå ïàðàìåòðû
//---- Áóôåðû èíäèêàòîðà
double IndexBuffer[];
double ExtBuffer1[];
double ExtBuffer2[];
//---- Ïåðåìåííûå
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(3);
 
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   
   SetIndexBuffer(0,ExtBuffer1);
   SetIndexBuffer(1,ExtBuffer2);
   SetIndexBuffer(2,IndexBuffer);

   
   IndicatorShortName("(Y) Effect m"+mode+" ");
   
   SetIndexLabel(0,"Y Effect Up");
   SetIndexLabel(1,"Y Effect Dn");
   SetIndexLabel(2,"");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
 {
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int i,limit;
   int counted_bars=IndicatorCounted();
//   datetime TimeBar;
//---- ïðîâåðêà íà âîçìîæíûå îøèáêè
   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
//---- îñíîâíîé öèêë

   for(i=limit;i>=0;i--)
     {
      //Çàäàíèå çíà÷åíèé èíäåêñà èíäèêàòîðà
   
       ExtBuffer1[i]=0.0;  ExtBuffer2[i]=0.0;  

IndexBuffer[i]=(High[i]-Low[i])+(High[i+1]-Low[i+1]) +(High[i+2]-Low[i+2]) +(High[i+3]-Low[i+3])  +(High[i+4]-Low[i+4]) ;
          
   double  x01,x02,x03,  x1,x2;
    
        x01=  Low[i]  - High[i+4];
        x02=  High[i] - Low [i+4];

        x03=  Close[i] - Close[i+4];
 
 
 if (mode==0)  {  x1= x01;    x2= x02; }
 if (mode==1)  {  x1=-x02;    x2=-x01; }      
 if (mode==2)  {  x1= x02;    x2= x01; }      
 if (mode==3)  {  x1= x03;    x2= x03; }
   
   if (mode>3)mode=3;



  if(x1>0)   ExtBuffer1[i]=(High[i]- Low[i+4] )/IndexBuffer[i];
  if(x2<0)   ExtBuffer2[i]=(Low[i] - High[i+4])/IndexBuffer[i];
      
      
      }

//---- done    
   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 ---