Elder_Impuls_sistem

Indicators Used
Moving average indicatorMACD Histogram
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Elder_Impuls_sistem
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_width1 2
#property indicator_color2 Green
#property indicator_width2 2
#property indicator_color3 Red
#property indicator_width3 2
#property indicator_color4 Red
#property indicator_width4 2 
#property indicator_color5 Aqua
#property indicator_width5 2
#property indicator_color6 Aqua
#property indicator_width6 2
extern int period = 13;
extern int ma_shift = 0;
extern int ma_method = 1;//0-3
extern int fast_ema_period = 12;
extern int slow_ema_period = 26;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
 
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_HISTOGRAM);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_HISTOGRAM);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_HISTOGRAM);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_HISTOGRAM);
   SetIndexBuffer(5,ExtMapBuffer6);
//----
   return(0);
  }
 
int start()
  {
   int i,counted_bars=IndicatorCounted();
//----
   i=Bars-counted_bars-1;
   while(i>=0)  
      {
      double MA_0   = iMA(NULL,0,period,ma_shift,ma_method,PRICE_CLOSE,i);
      // applied_price_ma - ïî êàêîé öåíå ðàñùèòûâàòü ñðåäíþþ
      // i - ñäâèã îòíîñèòåëüíî òåêóùåãî áàðà
      double MA_1   = iMA(NULL,0,period,ma_shift,ma_method,PRICE_CLOSE,i+1);
      double MACD_main1 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,PRICE_CLOSE,MODE_MAIN,i);
      double MACD_signal1 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,PRICE_CLOSE,MODE_SIGNAL,i);
      double MACD_main2 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,PRICE_CLOSE,MODE_MAIN,i+1);
      double MACD_signal2 = iMACD(NULL,0,fast_ema_period,slow_ema_period,9,PRICE_CLOSE,MODE_SIGNAL,i+1);
       // MODE_MAIN - îñíîâíàÿ ëèíèÿ MACD, MODE_SIGNAL - ñèãíàëüíàÿ
       
      if(MA_0>MA_1 && (MACD_main1-MACD_signal1)>(MACD_main2-MACD_signal2) && ((MACD_main1-MACD_signal1)>0))
         {
         ExtMapBuffer1[i]=High[i];
         ExtMapBuffer2[i]=Low[i];
         }
      if(MA_0<MA_1 && (MACD_main1-MACD_signal1)<(MACD_main2-MACD_signal2) && ((MACD_main1-MACD_signal1)<0))
         {
         ExtMapBuffer3[i]=High[i];
         ExtMapBuffer4[i]=Low[i];
         }
      if(MA_0<=MA_1 && (MACD_main1-MACD_signal1)>0)
         {
         ExtMapBuffer5[i]=High[i];
         ExtMapBuffer6[i]=Low[i];
         } 
      if(MA_0<=MA_1 && (MACD_main1-MACD_signal1)>(MACD_main2-MACD_signal2))
         {
         ExtMapBuffer5[i]=High[i];
         ExtMapBuffer6[i]=Low[i];
         } 
      if(MA_0>=MA_1 && (MACD_main1-MACD_signal1)<0)
         {
         ExtMapBuffer5[i]=High[i];
         ExtMapBuffer6[i]=Low[i];
         }      
      if(MA_0>=MA_1 && (MACD_main1-MACD_signal1)<(MACD_main2-MACD_signal2))
         {
         ExtMapBuffer5[i]=High[i];
         ExtMapBuffer6[i]=Low[i];
         }                                                 
      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 ---