You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Dear Sir Thank you for the clarification.
See this picture, which painted dots what the role of the Yellow Line. Please, all four colors appear with penetrating yellow line and match the original index
See the values
It is a long known fact that built in macd is using SMA for signal line while the original has to use EMA (as described in the link you have been provided). So, you are trying to compare things that can not be compared
See the values
It is a long known fact that built in macd is using SMA for signal line while the original has to use EMA (as described in the link you have been provided). So, you are trying to compare things that can not be compared
Sir, this is a values
Sir, this is a values
Please, the values of macd and signal line, not the parameters
Dragon
At your picture, after the names of the indicators, there are some numbers.
Those are the values. Compare those values (not the mql code either)
Dragon
At your picture, after the names of the indicators, there are some numbers.
Those are the values. Compare those values (not the mql code either)
Sir, this your own index.
There have two options of conversion.
The default option, which I want them to work with four colors.
//------------------------------------------------------------------
#property copyright "www.forex-tsd.com"
#property link "www.forex-tsd.com"
//------------------------------------------------------------------
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_plots 2
#property indicator_label1 "MACD"
#property indicator_type1 DRAW_COLOR_LINE
#property indicator_color1 LimeGreen,PaleVioletRed
#property indicator_width1 2
#property indicator_label2 "Signal"
#property indicator_type2 DRAW_LINE
#property indicator_color2 Gold
//
//
//
//
//
enum enPrices
{
pr_close, // Close
pr_open, // Open
pr_high, // High
pr_low, // Low
pr_median, // Median
pr_typical, // Typical
pr_weighted, // Weighted
pr_haclose, // Heiken ashi close
pr_haopen , // Heiken ashi open
pr_hahigh, // Heiken ashi high
pr_halow, // Heiken ashi low
pr_hamedian, // Heiken ashi median
pr_hatypical, // Heiken ashi typical
pr_haweighted, // Heiken ashi weighted
pr_haaverage // Heiken ashi average
};
input int InpFastEMA = 12; // Fast EMA period
input int InpSlowEMA = 26; // Slow EMA period
input int InpSignalEMA = 9; // Signal EMA period
input enPrices InpAppliedPrice = pr_close; // Price to use
input bool ColorOnSlope = false; // Change MACD color on slope change
//
//
//
//
//
double macd[];
double macdColor[];
double signal[];
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
void OnInit()
{
SetIndexBuffer(0,macd ,INDICATOR_DATA);
SetIndexBuffer(1,macdColor,INDICATOR_COLOR_INDEX);
SetIndexBuffer(2,signal ,INDICATOR_DATA);
IndicatorSetString(INDICATOR_SHORTNAME,"MACD original("+string(InpFastEMA)+","+string(InpSlowEMA)+","+string(InpSignalEMA)+")");
}
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
double emas[][2];
#define _fast 0
#define _slow 1
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[])
{
if (ArrayRange(emas,0)!=rates_total) ArrayResize(emas,rates_total);
//
//
//
//
//
double alphafa = 2.0 / (1.0 +InpFastEMA);
double alphasl = 2.0 / (1.0 +InpSlowEMA);
double alphasi = 2.0 / (1.0 +InpSignalEMA);
for (int i=(int)MathMax(prev_calculated-1,0); i<rates_total; i++)
{
double price = getPrice(InpAppliedPrice,open,close,high,low,i,rates_total);
if (i==0)
{
emas[i][_fast] = price;
emas[i][_slow] = price;
macd[i] = 0;
signal[i] = 0;
continue;
}
//
//
//
//
//
emas[i][_fast] = emas[i-1][_fast]+alphafa*(price-emas[i-1][_fast]);
emas[i][_slow] = emas[i-1][_slow]+alphasl*(price-emas[i-1][_slow]);
macd[i] = emas[i][_fast]-emas[i][_slow];
signal[i] = signal[i-1]+alphasi*(macd[i]-signal[i-1]);
macdColor[i] = macdColor[i-1];
if (ColorOnSlope)
{
if (macd[i]>macd[i-1]) macdColor[i] = 0;
if (macd[i]<macd[i-1]) macdColor[i] = 1;
}
else
{
if (macd[i]>signal[i]) macdColor[i] = 0;
if (macd[i]<signal[i]) macdColor[i] = 1;
}
}
//
//
//
//
//
return(rates_total);
}
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
double workHa[][4];
double getPrice(enPrices pricet, const double& open[], const double& close[], const double& high[], const double& low[], int i, int bars)
{
//
//
//
//
//
if (pricet>=pr_haclose && pricet<=pr_haaverage)
{
if (ArrayRange(workHa,0)!= bars) ArrayResize(workHa,bars);
//
//
//
//
//
double haOpen;
if (i>0)
haOpen = (workHa[i-1][2] + workHa[i-1][3])/2.0;
else haOpen = open[i]+close[i];
double haClose = (open[i] + high[i] + low[i] + close[i]) / 4.0;
double haHigh = MathMax(high[i], MathMax(haOpen,haClose));
double haLow = MathMin(low[i] , MathMin(haOpen,haClose));
if(haOpen <haClose) { workHa[i][0] = haLow; workHa[i][1] = haHigh; }
else { workHa[i][0] = haHigh; workHa[i][1] = haLow; }
workHa[i][2] = haOpen;
workHa[i][3] = haClose;
//
//
//
//
//
switch (pricet)
{
case pr_haclose: return(haClose);
case pr_haopen: return(haOpen);
case pr_hahigh: return(haHigh);
case pr_halow: return(haLow);
case pr_hamedian: return((haHigh+haLow)/2.0);
case pr_hatypical: return((haHigh+haLow+haClose)/3.0);
case pr_haweighted: return((haHigh+haLow+haClose+haClose)/4.0);
case pr_haaverage: return((haHigh+haLow+haClose+haOpen)/4.0);
}
}
//
//
//
//
//
switch (pricet)
{
case pr_close: return(close[i]);
case pr_open: return(open[i]);
case pr_high: return(high[i]);
case pr_low: return(low[i]);
case pr_median: return((high[i]+low[i])/2.0);
case pr_typical: return((high[i]+low[i]+close[i])/3.0);
case pr_weighted: return((high[i]+low[i]+close[i]+close[i])/4.0);
}
return(0);
}
Sir, this your own index.
There have two options of conversion.
The default option, which I want them to work with four colors.
Dragon
Man,is it not possible for you to keep clean this thread for what it was started,i means for Elite indicators MT5 version only and shift your problem,matter or issue to related thread for example request and idea or coding help ..... you have to know,boss dislike variant and congested topics in unrelated thread.
regards
dragon,
Which exact macd are you trying to duplicate and why?
dragon,
Which exact macd are you trying to duplicate and why?
Dear Sir Yes it is MACD .
You need to work with a couple of options.
MACD works with four colors .
But made it work one option.
Dragon
Man,is it not possible for you to keep clean this thread for what it was started,i means for Elite indicators MT5 version only and shift your problem,matter or issue to related thread for example request and idea or coding help ..... you have to know,boss dislike variant and congested topics in unrelated thread.
regards
Dear just tell you the words of one here is not the arena for the show muscle.