G#MACD_Bars

Author: Copyright � 2008, cja.
Indicators Used
MACD Histogram
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
G#MACD_Bars
//+------------------------------------------------------------------+
//|                                              Guppy MACD Bars.mq4 |
//|                            Copyright © 2008, cjatradingtools.com |
//|                                      http://cjatradingtools.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, cja."
#property link      "http://cjatradingtools.com/"

#property indicator_separate_window
#property indicator_buffers 7

#property indicator_color6 Red  
#property indicator_color7 Blue 
#property indicator_width6 3
#property indicator_width7 3

#property indicator_maximum 1
#property indicator_minimum 0

//---- input parameters
 
extern int       FastEMA=8;
extern int       FFastEMA=7;
extern int       FFFastEMA=6;
extern int       SlowEMA=17;
extern int       SSlowEMA=16;
extern int       SSSlowEMA=15;
extern int       SignalSMA=9;
extern int       SSignalSMA=8;
extern int       SSSignalSMA=7;




//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];
double ExtMapBuffer7[];




//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_NONE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_NONE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_NONE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_NONE);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_NONE);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_HISTOGRAM);
   SetIndexBuffer(5,ExtMapBuffer6);
   SetIndexStyle(6,DRAW_HISTOGRAM);
   SetIndexBuffer(6,ExtMapBuffer7);
   
   SetIndexLabel(1,"");
   SetIndexLabel(2,"");
   SetIndexLabel(6,"");
   SetIndexLabel(5,"");
   
   IndicatorShortName("GMACD Bars"); 
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();

//----
   for(int i=Bars;i>=0;i--){
      ExtMapBuffer2[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_MAIN,i); 
      ExtMapBuffer3[i]=iMACD(NULL,0,FastEMA,SlowEMA,SignalSMA,PRICE_CLOSE,MODE_SIGNAL,i);  
      ExtMapBuffer4[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_MAIN,i); 
      ExtMapBuffer5[i]=iMACD(NULL,0,FFastEMA,SSlowEMA,SSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i);  
      ExtMapBuffer6[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_MAIN,i); 
      ExtMapBuffer7[i]=iMACD(NULL,0,FFFastEMA,SSSlowEMA,SSSignalSMA,PRICE_CLOSE,MODE_SIGNAL,i); 
   
      ExtMapBuffer7[i]=ExtMapBuffer2[i] > ExtMapBuffer3[i];
      ExtMapBuffer6[i]=ExtMapBuffer2[i] < ExtMapBuffer3[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 ---