InvestorsHub Logo
Followers 292
Posts 26480
Boards Moderated 2
Alias Born 06/17/2004

Re: Qui-Gon Kagi post# 121814

Friday, 08/30/2013 5:09:09 PM

Friday, August 30, 2013 5:09:09 PM

Post# of 140146


//+------------------------------------------------------------------+
//| MA_Shade.mq4 |
//| oromek |
//| oromeks@gmail.com |
//+------------------------------------------------------------------+
#property copyright "oromek"
#property link "oromeks@gmail.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_width1 3
#property indicator_width2 3

extern int MA1_Period=21;
extern int MA2_Period=50;
extern string MA_Method_Help="0-SMA, 1-EMA, 2-SMMA, 3-LWMA";
extern int MA_Method=1;

double MA1, MA2;
double MA1_Buffer[], MA2_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_DOT);
SetIndexBuffer(0,MA1_Buffer);

SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_DOT);
SetIndexBuffer(1,MA2_Buffer);
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();

int limit=Bars-counted_bars;
if(counted_bars>0) limit++;

for(int i=1; i<limit; i++)
{
MA1=iMA(NULL,0,MA1_Period,0,MA_Method,PRICE_CLOSE,i);
MA2=iMA(NULL,0,MA2_Period,0,MA_Method,PRICE_CLOSE,i);

MA1_Buffer=MA1;
MA2_Buffer=MA2;
}
//----

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

Join the InvestorsHub Community

Register for free to join our community of investors and share your ideas. You will also get access to streaming quotes, interactive charts, trades, portfolio, live options flow and more tools.