hello every one…
i have this indicator, but don’t know to input it to ea…
this is my indicator code:
extern int period = 15;
extern int method = 1;
extern int price = 0;
double g_ibuf_88[];
double g_ibuf_92[];
double g_ibuf_96[];
int init() {
IndicatorBuffers(3);
SetIndexBuffer(0, g_ibuf_88);
SetIndexBuffer(1, g_ibuf_92);
SetIndexBuffer(2, g_ibuf_96);
ArraySetAsSeries(g_ibuf_96, TRUE);
SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
IndicatorShortName(“Slope Direction Line(” + period + “)”);
return (0);
}
int deinit() {
return (0);
}
double WMA(int ai_0, int a_period_4) {
return (iMA(NULL, 0, a_period_4, 0, method, price, ai_0));
}
int start() {
double lda_16[];
double lda_20[];
int l_ind_counted_0 = IndicatorCounted();
if (l_ind_counted_0 < 0) return (-1);
int li_4 = 0;
int l_period_8 = MathSqrt(period);
int li_12 = Bars - l_ind_counted_0 + period + 1;
if (li_12 > Bars) li_12 = Bars;
ArrayResize(lda_16, li_12);
ArraySetAsSeries(lda_16, TRUE);
ArrayResize(lda_20, li_12);
ArraySetAsSeries(lda_20, TRUE);
for (li_4 = 0; li_4 < li_12; li_4++) lda_16[li_4] = 2.0 * WMA(li_4, period / 2) - WMA(li_4, period);
for (li_4 = 0; li_4 < li_12 - period; li_4++) g_ibuf_96[li_4] = iMAOnArray(lda_16, 0, l_period_8, 0, method, li_4);
for (li_4 = li_12 - period; li_4 >= 0; li_4–) {
lda_20[li_4] = lda_20[li_4 + 1];
if (g_ibuf_96[li_4] > g_ibuf_96[li_4 + 1]) lda_20[li_4] = 1;
if (g_ibuf_96[li_4] < g_ibuf_96[li_4 + 1]) lda_20[li_4] = -1;
if (lda_20[li_4] > 0.0) {
g_ibuf_88[li_4] = g_ibuf_96[li_4];
if (lda_20[li_4 + 1] < 0.0) g_ibuf_88[li_4 + 1] = g_ibuf_96[li_4 + 1];
g_ibuf_92[li_4] = EMPTY_VALUE;
} else {
if (lda_20[li_4] < 0.0) {
g_ibuf_92[li_4] = g_ibuf_96[li_4];
if (lda_20[li_4 + 1] > 0.0) g_ibuf_92[li_4 + 1] = g_ibuf_96[li_4 + 1];
g_ibuf_88[li_4] = EMPTY_VALUE;
}
}
}
return (0);
}
what about in the ea?
thx…