Download MetaTrader 5

Macd aspray indicator

To add comments, please log in or register
Thousands of developers have already published their products in the Market. Join them!
akose
66
akose 2014.06.24 20:20 

hi friends 

I looking for macd aspray indicator but i can't found that indicator setup or code.

if you have macd aspray code or setup please share us.?

qjol
3243
qjol 2014.06.24 21:46  
what's macd aspray can you explain + upload a picture
akose
66
akose 2014.06.25 08:15  
Aspray and the MACD-Histogram

In the fall of 1986, Tom Aspray completed work on a new indicator: the MACD Histogram/Momentum. The MACD, or Convergence/Divergence, is an excellent indicator, but its signals often lag when run on weekly data. Convergence/Divergence was developed by Gerald Appel, who has created many excellent technical tools. 

Tom first presented his work on the MACD at a CompuTrac conference in 1984. At that time, very few analysts were aware of it, much less using it on the commodity markets. Now it is a widely used technical tool.

Tom did some work on optimizing the MACD by testing various combinations of inputs for the three exponential moving averages. Then, by altering the moving average variables, the results are dramatically different.

For example, the default for silver ( 12 days, 26 days and 9-period exponential average of the difference) were not always profitable, while the (10, 20, 9) combination was profitable 54% of the time, with an average profit of 67.5 points and an average loss of only 34 points.

After studying and using MACD for almost five years, Tom felt that, besides optimization, a method of anticipating crossovers would be a distinct advantage. After looking at (and testing) several alternatives, he found that by running a 10-day momentum (with 3-day smoothing) of the MACD in histogram form (MACD-H), the results were quite good."
qjol
3243
qjol 2014.06.25 13:39  

so, your'e talking about "MACD"

you have it under \\MQL4\Indicators

(in the terminal you can find it under "Custom Indicators" ---> MACD)

akose
66
akose 2014.06.25 15:48  

my metatrader not have that indicator.

Show me  difference between two indicator upload photo.

qjol
3243
qjol 2014.06.25 16:34  

do it yourself very easy

MACD Line: (12-day EMA - 26-day EMA) 

Signal Line: 9-day EMA of MACD Line

MACD Histogram: MACD Line - Signal Line
akose
66
akose 2014.06.25 18:46  
//+------------------------------------------------------------------+
//|                                                  Custom MACD.mq4 |
//|                   Copyright 2005-2014, MetaQuotes Software Corp. |
//|                                              https://www.mql4.com |
//+------------------------------------------------------------------+
#property copyright   "2005-2014, MetaQuotes Software Corp."
#property link        "https://www.mql4.com"
#property description "Moving Averages Convergence/Divergence"
#property strict

#include <MovingAverages.mqh>

//--- indicator settings
#property  indicator_separate_window
#property  indicator_buffers 2
#property  indicator_color1  Silver
#property  indicator_color2  Red
#property  indicator_width1  2
//--- indicator parameters
input int InpFastEMA=12;   // Fast EMA Period
input int InpSlowEMA=26;   // Slow EMA Period
input int InpSignalSMA=9;  // Signal SMA Period
//--- indicator buffers
double    ExtMacdBuffer[];
double    ExtSignalBuffer[];
//--- right input parameters flag
bool      ExtParameters=false;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit(void)
  {
   IndicatorDigits(Digits+1);
//--- drawing settings
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,InpSignalSMA);
//--- indicator buffers mapping
   SetIndexBuffer(0,ExtMacdBuffer);
   SetIndexBuffer(1,ExtSignalBuffer);
//--- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+IntegerToString(InpFastEMA)+","+IntegerToString(InpSlowEMA)+","+IntegerToString(InpSignalSMA)+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
//--- check for input parameters
   if(InpFastEMA<=1 || InpSlowEMA<=1 || InpSignalSMA<=1 || InpFastEMA>=InpSlowEMA)
     {
      Print("Wrong input parameters");
      ExtParameters=false;
      return(INIT_FAILED);
     }
   else
      ExtParameters=true;
//--- initialization done
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Moving Averages Convergence/Divergence                           |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,
                 const int prev_calculated,
                 const datetime& time[],
                 const double& open[],
                 const double& high[],
                 const double& low[],
                 const double& close[],
                 const long& tick_volume[],
                 const long& volume[],
                 const int& spread[])
  {
   int i,limit;
//---
   if(rates_total<=InpSignalSMA || !ExtParameters)
      return(0);
//--- last counted bar will be recounted
   limit=rates_total-prev_calculated;
   if(prev_calculated>0)
      limit++;
//--- macd counted in the 1-st buffer
   for(i=0; i<limit; i++)
      ExtMacdBuffer[i]=iMA(NULL,0,InpFastEMA,0,MODE_EMA,PRICE_CLOSE,i)-
                    iMA(NULL,0,InpSlowEMA,0,MODE_EMA,PRICE_CLOSE,i);
//--- signal line counted in the 2-nd buffer
   SimpleMAOnBuffer(rates_total,prev_calculated,0,InpSignalSMA,ExtMacdBuffer,ExtSignalBuffer);
//--- done
   return(rates_total);
  }
//+------------------------------------------------------------------+
akose
66
akose 2014.06.25 18:50  

this normal macd in metatrader code, and that not same buffer .

How will add onto the original MACD, buffer lacking.   is not same .

qjol
3243
qjol 2014.06.25 21:22  

like i said it's very easy




it took me less than 5 min.

akose
66
akose 2014.06.25 21:31  
then may you share this codes?
qjol
3243
qjol 2014.06.25 21:44  

here is the one i made (in 2010) for B600 <

for B600 > i leave you a bit to do

12
To add comments, please log in or register