WWMMACAU wrote:
I would like to request #4X 2010 EMA 50 Indicator from MQ4 to LUA.
- Code: Select all
// #4X 2010 EMA 50 \¦/
// Knowledge of the ancients (ò ó)
//______________________o0o___(_)___o0o_____
//___¦Xard777¦_____¦_____¦_____¦_____¦_2010_¦
#property indicator_chart_window
//+------------------------------------------------------------------+
#property indicator_buffers 2
#property indicator_color1 Crimson
#property indicator_color2 Blue
#property indicator_width1 4
#property indicator_width2 4
double buf0[], buf1[], buf2[];
extern int MA_Period1 = 50;
extern int MA_Method1 = 1;
extern int MA_Price1 = 0;
extern int MA_Shift1 = 0;
int init() {
IndicatorBuffers(3);
SetIndexBuffer(0, buf0);
SetIndexBuffer(1, buf1);
SetIndexBuffer(2, buf2);
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
return (0);
}
int start() {
for (int X4 = Bars - 10; X4 >= 0; X4--) buf2[X4] = iMA(NULL,0,MA_Period1,MA_Shift1,MA_Method1,MA_Price1,X4); //iMA(NULL, 0, PeriodX, 0, MODE_LWMA, PRICE_MEDIAN, X4);
for (int X8 = Bars - 10; X8 >= 0; X8--) {
buf0[X8] = buf2[X8]; buf1[X8] = buf2[X8];
if (buf2[X8] > buf2[X8 + 1]) {
buf0[X8] = EMPTY_VALUE; buf1[X8 + 1] = buf2[X8 + 1];
} else {
if (buf2[X8] < buf2[X8 + 1]) {
buf1[X8] = EMPTY_VALUE; buf0[X8 + 1] = buf2[X8 + 1];
}
}
}
return (0);
}
//--------------------------------------------Xard@hotmail.co.uk-----+
The indicator was revised and updated