下载MetaTrader 5
要添加评论,请登录注册
出售您的CPU能效并获利!
ω
9
ω 2010.09.04 10:34 

指标说明:这是一个多周期均线警戒指标,价格收盘在警戒均线上方显示绿色,价格收盘在警戒均线下方显示绿色。要求在某一时间图上,四个周期由不同颜色同时出现绿色信号或红色信号时报警。请高手帮忙!!!

源代码如下:

#property indicator_separate_window

#property indicator_minimum 1.0

#property indicator_maximum 4.2

#property indicator_buffers 8

#property indicator_color1 Lime

#property indicator_color2 Magenta

#property indicator_color3 Lime

#property indicator_color4 Magenta

#property indicator_color5 Lime

#property indicator_color6 Magenta

#property indicator_color7 Lime

#property indicator_color8 Magenta


extern int TimeFrame1 = 5;

extern int TimeFrame2 = 15;

extern int TimeFrame3 = 30;

extern int TimeFrame4 = 60;

extern int N = 21;

double g_ibuf_96[];

double g_ibuf_100[];

double g_ibuf_104[];

double g_ibuf_108[];

double g_ibuf_112[];

double g_ibuf_116[];

double g_ibuf_120[];

double g_ibuf_124[];


int init() {

IndicatorBuffers(8);

SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(2, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(3, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(4, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(5, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(6, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(7, DRAW_ARROW, EMPTY, 1);

SetIndexBuffer(0, g_ibuf_96);

SetIndexBuffer(1, g_ibuf_100);

SetIndexBuffer(2, g_ibuf_104);

SetIndexBuffer(3, g_ibuf_108);

SetIndexBuffer(4, g_ibuf_112);

SetIndexBuffer(5, g_ibuf_116);

SetIndexBuffer(6, g_ibuf_120);

SetIndexBuffer(7, g_ibuf_124);

SetIndexArrow(0, 110);

SetIndexArrow(1, 110);

SetIndexArrow(2, 110);

SetIndexArrow(3, 110);

SetIndexArrow(4, 110);

SetIndexArrow(5, 110);

SetIndexArrow(6, 110);

SetIndexArrow(7, 110);

return (0);

}


int deinit() {

return (0);

}


int start() {

int lia_4[];

int lia_8[];

int lia_12[];

int lia_16[];

int li_unused_0 = 1;

int l_index_32 = 0;

int l_index_36 = 0;

int l_index_40 = 0;

int l_index_44 = 0;

int l_ind_counted_48 = IndicatorCounted();

ArrayCopySeries(lia_4, 5, Symbol(), TimeFrame1);

ArrayCopySeries(lia_8, 5, Symbol(), TimeFrame2);

ArrayCopySeries(lia_12, 5, Symbol(), TimeFrame3);

ArrayCopySeries(lia_16, 5, Symbol(), TimeFrame4);

int li_28 = Bars - l_ind_counted_48;

int l_index_20 = 0;

l_index_32 = 0;

l_index_36 = 0;

l_index_40 = 0;

l_index_44 = 0;

while (l_index_20 < li_28) {

if (Time[l_index_20] < lia_4[l_index_32]) l_index_32++;

if (Time[l_index_20] < lia_8[l_index_36]) l_index_36++;

if (Time[l_index_20] < lia_12[l_index_40]) l_index_40++;

if (Time[l_index_20] < lia_16[l_index_44]) l_index_44++;

if (iMA(NULL, TimeFrame1, N, 0, MODE_EMA, PRICE_CLOSE, l_index_32 + 0) > iMA(NULL, TimeFrame1, N, 0, MODE_EMA, PRICE_CLOSE, l_index_32 + 1)) {

g_ibuf_96[l_index_20] = 1.5;

g_ibuf_100[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_96[l_index_20] = EMPTY_VALUE;

g_ibuf_100[l_index_20] = 1.5;

}

if (iMA(NULL, TimeFrame2, N, 0, MODE_EMA, PRICE_CLOSE, l_index_36 + 0) > iMA(NULL, TimeFrame2, N, 0, MODE_EMA, PRICE_CLOSE, l_index_36 + 1)) {

g_ibuf_104[l_index_20] = 2;

g_ibuf_108[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_104[l_index_20] = EMPTY_VALUE;

g_ibuf_108[l_index_20] = 2;

}

if (iMA(NULL, TimeFrame3, N, 0, MODE_EMA, PRICE_CLOSE, l_index_40 + 0) > iMA(NULL, TimeFrame3, N, 0, MODE_EMA, PRICE_CLOSE, l_index_40 + 1)) {

g_ibuf_112[l_index_20] = 2.5;

g_ibuf_116[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_112[l_index_20] = EMPTY_VALUE;

g_ibuf_116[l_index_20] = 2.5;

}

if (iMA(NULL, TimeFrame4, N, 0, MODE_EMA, PRICE_CLOSE, l_index_44 + 0) > iMA(NULL, TimeFrame4, N, 0, MODE_EMA, PRICE_CLOSE, l_index_44 + 1)) {

g_ibuf_120[l_index_20] = 3;

g_ibuf_124[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_120[l_index_20] = EMPTY_VALUE;

g_ibuf_124[l_index_20] = 3;

}

l_index_20++;

}

return (0);

}

ω
9
ω 2010.09.14 12:49  
timertune:

指标说明:这是一个多周期均线警戒指标,价格收盘在警戒均线上方显示绿色,价格收盘在警戒均线下方显示绿色。要求在某一时间图上,四个周期由不同颜色同时出现绿色信号或红色信号时报警。请高手帮忙!!!

源代码如下:

#property indicator_separate_window

#property indicator_minimum 1.0

#property indicator_maximum 4.2

#property indicator_buffers 8

#property indicator_color1 Lime

#property indicator_color2 Magenta

#property indicator_color3 Lime

#property indicator_color4 Magenta

#property indicator_color5 Lime

#property indicator_color6 Magenta

#property indicator_color7 Lime

#property indicator_color8 Magenta


extern int TimeFrame1 = 5;

extern int TimeFrame2 = 15;

extern int TimeFrame3 = 30;

extern int TimeFrame4 = 60;

extern int N = 21;

double g_ibuf_96[];

double g_ibuf_100[];

double g_ibuf_104[];

double g_ibuf_108[];

double g_ibuf_112[];

double g_ibuf_116[];

double g_ibuf_120[];

double g_ibuf_124[];


int init() {

IndicatorBuffers(8);

SetIndexStyle(0, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(1, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(2, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(3, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(4, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(5, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(6, DRAW_ARROW, EMPTY, 1);

SetIndexStyle(7, DRAW_ARROW, EMPTY, 1);

SetIndexBuffer(0, g_ibuf_96);

SetIndexBuffer(1, g_ibuf_100);

SetIndexBuffer(2, g_ibuf_104);

SetIndexBuffer(3, g_ibuf_108);

SetIndexBuffer(4, g_ibuf_112);

SetIndexBuffer(5, g_ibuf_116);

SetIndexBuffer(6, g_ibuf_120);

SetIndexBuffer(7, g_ibuf_124);

SetIndexArrow(0, 110);

SetIndexArrow(1, 110);

SetIndexArrow(2, 110);

SetIndexArrow(3, 110);

SetIndexArrow(4, 110);

SetIndexArrow(5, 110);

SetIndexArrow(6, 110);

SetIndexArrow(7, 110);

return (0);

}


int deinit() {

return (0);

}


int start() {

int lia_4[];

int lia_8[];

int lia_12[];

int lia_16[];

int li_unused_0 = 1;

int l_index_32 = 0;

int l_index_36 = 0;

int l_index_40 = 0;

int l_index_44 = 0;

int l_ind_counted_48 = IndicatorCounted();

ArrayCopySeries(lia_4, 5, Symbol(), TimeFrame1);

ArrayCopySeries(lia_8, 5, Symbol(), TimeFrame2);

ArrayCopySeries(lia_12, 5, Symbol(), TimeFrame3);

ArrayCopySeries(lia_16, 5, Symbol(), TimeFrame4);

int li_28 = Bars - l_ind_counted_48;

int l_index_20 = 0;

l_index_32 = 0;

l_index_36 = 0;

l_index_40 = 0;

l_index_44 = 0;

while (l_index_20 < li_28) {

if (Time[l_index_20] < lia_4[l_index_32]) l_index_32++;

if (Time[l_index_20] < lia_8[l_index_36]) l_index_36++;

if (Time[l_index_20] < lia_12[l_index_40]) l_index_40++;

if (Time[l_index_20] < lia_16[l_index_44]) l_index_44++;

if (iMA(NULL, TimeFrame1, N, 0, MODE_EMA, PRICE_CLOSE, l_index_32 + 0) > iMA(NULL, TimeFrame1, N, 0, MODE_EMA, PRICE_CLOSE, l_index_32 + 1)) {

g_ibuf_96[l_index_20] = 1.5;

g_ibuf_100[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_96[l_index_20] = EMPTY_VALUE;

g_ibuf_100[l_index_20] = 1.5;

}

if (iMA(NULL, TimeFrame2, N, 0, MODE_EMA, PRICE_CLOSE, l_index_36 + 0) > iMA(NULL, TimeFrame2, N, 0, MODE_EMA, PRICE_CLOSE, l_index_36 + 1)) {

g_ibuf_104[l_index_20] = 2;

g_ibuf_108[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_104[l_index_20] = EMPTY_VALUE;

g_ibuf_108[l_index_20] = 2;

}

if (iMA(NULL, TimeFrame3, N, 0, MODE_EMA, PRICE_CLOSE, l_index_40 + 0) > iMA(NULL, TimeFrame3, N, 0, MODE_EMA, PRICE_CLOSE, l_index_40 + 1)) {

g_ibuf_112[l_index_20] = 2.5;

g_ibuf_116[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_112[l_index_20] = EMPTY_VALUE;

g_ibuf_116[l_index_20] = 2.5;

}

if (iMA(NULL, TimeFrame4, N, 0, MODE_EMA, PRICE_CLOSE, l_index_44 + 0) > iMA(NULL, TimeFrame4, N, 0, MODE_EMA, PRICE_CLOSE, l_index_44 + 1)) {

g_ibuf_120[l_index_20] = 3;

g_ibuf_124[l_index_20] = EMPTY_VALUE;

} else {

g_ibuf_120[l_index_20] = EMPTY_VALUE;

g_ibuf_124[l_index_20] = 3;

}

l_index_20++;

}

return (0);

}

ω
9
ω 2010.09.14 12:49  
这个指标用好了是非常有用的,高手帮顶啊。
WANGGUANG
81
WANGGUANG 2010.09.24 10:16  

在你条件满足的地方直接加上

Alert( ...)
就可以报警了,你也可以直接加上PlaySound("alert.wav");
其中声音你也可以自己选择比较好听的声音,比如:你可以直接在网上下载你喜欢听的音乐,注意文件格式不要搞错了。

如果还不了解,请联系: 1031130533

/
要添加评论,请登录注册