DinamicnAMp

Author: Andrey Matvievskiy
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
DinamicnAMp
//+------------------------------------------------------------------+
//|                                                 Dinamic(AM)4.mq4 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Andrey Matvievskiy"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 2

#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_maximum 1
#property indicator_minimum -1

extern int AO_PeriodMA1 = 34;
extern int AO_PeriodMA2 = 5;
extern int AO_TypeMA1 = 0;
extern int AO_TypeMA2 = 0;
extern int AO_PriceMA1 = 4;
extern int AO_PriceMA2 = 4;
extern int AO_TF1 = 0;
extern int AO_TF2 = 0;
extern int AO_Shift1 = 0;
extern int AO_Shift2 = 0;

extern int AC_PeriodMA1 = 34;
extern int AC_PeriodMA2 = 5;
extern int AC_PeriodMA3 = 5;
extern int AC_TypeMA1 = 0;
extern int AC_TypeMA2 = 0;
extern int AC_TypeMA3 = 0;
extern int AC_PriceMA1 = 4;
extern int AC_PriceMA2 = 4;
extern int AO_AC_TF1 = 0;
extern int AO_AC_TF2 = 0;
extern int AO_AC_Shift1 = 0;
extern int AO_AC_Shift2 = 0;
extern int AO_AC_Shift3 = 0;




double ExtMapBuffer2[];
double ExtMapBuffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
   SetIndexStyle(0,DRAW_HISTOGRAM,0,4);
   SetIndexBuffer(0,ExtMapBuffer2);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(1,ExtMapBuffer3);
   
  
   SetIndexLabel(0,"D1");
   SetIndexLabel(1,"D2");
  
   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

 int start()
  {
//----
int    counted_bars=IndicatorCounted();
//----
   if(counted_bars>0)
        counted_bars--;
     
   int limit=Bars-counted_bars;
   
   for(int i=0;i<Bars;i++)
   {
     
     
     
      double X = iCustom(NULL, 0, "AO(AM)", AO_PeriodMA1, AO_PeriodMA2, AO_TypeMA1, AO_TypeMA2, AO_PriceMA1, AO_PriceMA2, AO_TF1, AO_TF2, AO_Shift1, AO_Shift2,0,i);
      double Y = iCustom(NULL, 0, "AO(AM)", AO_PeriodMA1, AO_PeriodMA2, AO_TypeMA1, AO_TypeMA2, AO_PriceMA1, AO_PriceMA2, AO_TF1, AO_TF2, AO_Shift1, AO_Shift2,0,i+1);
      double A = iCustom(NULL, 0, "AC(AM)", AC_PeriodMA1, AC_PeriodMA2, AC_PeriodMA3, AC_TypeMA1, AC_TypeMA2, AC_TypeMA3, AC_PriceMA1, AC_PriceMA2, AO_AC_TF1, AO_AC_TF2, AO_AC_Shift1, AO_AC_Shift2, AO_AC_Shift3,0,i);
      double B = iCustom(NULL, 0, "AC(AM)", AC_PeriodMA1, AC_PeriodMA2, AC_PeriodMA3, AC_TypeMA1, AC_TypeMA2, AC_TypeMA3, AC_PriceMA1, AC_PriceMA2, AO_AC_TF1, AO_AC_TF2, AO_AC_Shift1, AO_AC_Shift2, AO_AC_Shift3,0,i+1);
       
   
   
   if  (X<Y) 
        {
         ExtMapBuffer2[i]= -1;
        }
        else  
        {
         ExtMapBuffer2[i]= 1;
    
   }
    if  (A<B) 
        {
         ExtMapBuffer3[i]= -1;
        }
        else  
        {
         ExtMapBuffer3[i]= 1;
    
   }
   
   
  }
   
//--------------------   
  
   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 ---