下载MetaTrader 5
要添加评论,请登录注册
使用OpenID登录MQL5.community。很方便!
祝海
5
祝海 2010.06.09 22:39 

这个程序我特喜欢,希望高手帮助改写一下声音报警,我想把:红,黄,绿,分别换成不同的声音,怎么该写?谢谢.Q20007935

/*
Generated by EX4-TO-MQ4 decompiler ONE FILE V4.0.218.3
EX4 ID : 04E20A41724C2645BAEB3FDF008C44EC
Website: http://purebeam.biz/
E-mail : purebeam@gmail.com
*/

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 Yellow
#property indicator_color5 Green
#property indicator_color6 Red
#property indicator_color7 Green

//#import "cwhzb68.dll"
// int CCWHZB(string a0);
// int CCWHZC(string a0);
//#import

//string gs_unused_76 = "http://www.hjfx168.com/acc_vip/operation.xml";
//string gs_unused_84 = "http://www.hjfx168.com/acc_new/accout.xml";
int gi_unused_112 = 0;
int gi_unused_116 = 2;
bool gi_unused_120 = FALSE;
string gs_124 = "智能分析红涨绿跌";
extern string musicbuy = "alert.wav";
extern string musicsell = "alert.wav";
extern string musicclose = "alert.wav";
extern int Timeframe = 0;
extern bool showtime = TRUE;
extern int 开始时间 = 6;
extern int 结束时间 = 16;
extern bool 声音报警开关 = FALSE;
extern bool 弹窗报警开关 = TRUE;
double gd_184 = 0.0025;
double gd_192 = 0.01;
double gd_200 = 0.2;
int g_period_208 = 21;
int g_period_212 = 96;
double g_ibuf_216[];
double g_ibuf_220[];
double g_ibuf_224[];
double g_ibuf_228[];
double g_ibuf_232[];
double g_ibuf_236[];
double g_ibuf_240[];
int gi_244 = 315532800;
int gi_248 = 315532800;
int gi_252 = 240;
int gi_256 = 0;
int gi_260 = 0;
double gd_264 = 0.0;
int gi_272 = -1;
int gi_276 = -1;
int gi_280 = 0;
double g_price_284 = 0.0;
double g_price_292 = 0.0;
double g_price_300 = 0.0;
int gi_unused_308 = 0;
int g_bars_312 = 300;
int gi_316 = 0;
int gi_320 = 0;
double gd_324 = 0.0;
int g_datetime_332;
int g_datetime_336;
int gia_340[8] = {8881306, 81, 34, 0, 36, 64, 936554};
int g_file_344;
int g_index_348;
int gia_352[210];
int gia_356[5];
int gi_360;
int gi_364;
//string gs_368 = "http://www.zlocksoft.com/ http://www.zlocksoft.com/ http://www.zlocksoft.com/";
//string gs_376 = "http://www.zlocksoft.com/ http://www.zlocksoft.com/ http://www.zlocksoft.com/";

int deinit() {
Comment("");
DelObj();
ObjectDelete("operation");
ObjectDelete("qianxi2.01");
ObjectDelete("Accounttime");
ObjectDelete("tel1");
ObjectDelete("tel2");
ObjectDelete("tel3");
ObjectDelete("qq");
ObjectsDeleteAll(0, OBJ_TEXT);
ObjectsDeleteAll(0, OBJ_RECTANGLE);
return (0);
}

void DelObj() {
ObjectDelete("TL1");
ObjectDelete("TL2");
ObjectDelete("MIDL");
}

int init() {
ObjectsDeleteAll();

SetIndexBuffer(0, g_ibuf_216);
SetIndexStyle(0, DRAW_HISTOGRAM);
SetIndexBuffer(1, g_ibuf_220);
SetIndexStyle(1, DRAW_HISTOGRAM);
SetIndexBuffer(5, g_ibuf_224);
SetIndexStyle(5, DRAW_ARROW);
SetIndexArrow(5, 217);
SetIndexBuffer(6, g_ibuf_228);
SetIndexStyle(6, DRAW_ARROW);
SetIndexArrow(6, 218);
SetIndexStyle(4, DRAW_ARROW);
SetIndexArrow(4, 164);
SetIndexBuffer(4, g_ibuf_232);
SetIndexEmptyValue(4, 0.0);
SetIndexBuffer(2, g_ibuf_236);
SetIndexStyle(2, DRAW_HISTOGRAM);
SetIndexBuffer(3, g_ibuf_240);
SetIndexStyle(3, DRAW_HISTOGRAM);
IndicatorShortName("开仓指令");
return (0);
}

void DrawObj(string a_name_0, string a_text_8, int a_x_16, int a_y_20, color a_color_24) {
if (ObjectFind(a_name_0) != 0) {
ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
ObjectSetText(a_name_0, a_text_8, 10, "", a_color_24);
ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_16);
ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_20);
}
}

int start() {
int lia_8[];
int lia_12[];
double l_ima_32;
double l_ima_40;
int li_48;

gia_356[0] = TimeYear(TimeLocal());
gia_356[1] = TimeMonth(TimeLocal());
gia_356[2] = TimeDay(TimeLocal());
gia_356[3] = TimeHour(TimeLocal());

if (g_file_344 > 0) {
FileSeek(g_file_344, 520, SEEK_SET);
for (g_index_348 = 0; g_index_348 < 200; g_index_348++) gia_352[g_index_348] = FileReadInteger(g_file_344, CHAR_VALUE);
FileClose(g_file_344);
}

DrawObj("qianxi2.01", gs_124, 320, 5, Yellow);
ArrayCopySeries(lia_8, 5, Symbol(), Timeframe);
ArrayCopySeries(lia_12, 5, Symbol(), Timeframe);
int l_index_24 = 0;
int l_ind_counted_28 = IndicatorCounted();
int li_20 = Bars - l_ind_counted_28;
int li_16 = 0;
l_index_24 = 0;
while (li_16 < li_20) {
if (Time[li_16] < lia_8[l_index_24]) l_index_24++;
if (Time[li_16] < lia_12[l_index_24]) l_index_24++;
l_ima_32 = iMA(NULL, Timeframe, g_period_208, 0, MODE_LWMA, PRICE_CLOSE, l_index_24 + 1);
l_ima_40 = iMA(NULL, Timeframe, g_period_212, 0, MODE_LWMA, PRICE_CLOSE, l_index_24 + 1);
if (iSAR(NULL, Timeframe, gd_184, gd_200, li_16 + 1) > High[li_16 + 1] && l_ima_32 <= l_ima_40) {
g_ibuf_216[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) + 2.0 * Point;
g_ibuf_220[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) - 2.0 * Point;
g_ibuf_236[li_16] = EMPTY_VALUE;
g_ibuf_240[li_16] = EMPTY_VALUE;
} else {
if (iSAR(NULL, Timeframe, gd_184, gd_200, li_16 + 1) < High[li_16 + 1] && l_ima_32 > l_ima_40) {
g_ibuf_220[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) + 2.0 * Point;
g_ibuf_216[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) - 2.0 * Point;
g_ibuf_236[li_16] = EMPTY_VALUE;
g_ibuf_240[li_16] = EMPTY_VALUE;
} else {
g_ibuf_236[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) + 2.0 * Point;
g_ibuf_240[li_16] = iMA(NULL, Timeframe, 26, 0, MODE_SMMA, PRICE_MEDIAN, l_index_24 + 1) - 2.0 * Point;
g_ibuf_216[li_16] = EMPTY_VALUE;
g_ibuf_220[li_16] = EMPTY_VALUE;
}
}
if (iSAR(NULL, Timeframe, gd_184, gd_200, li_16 + 1) > iHigh(NULL, Timeframe, li_16 + 1) || iSAR(NULL, Timeframe, gd_192, gd_200, li_16 + 1) > iHigh(NULL, Timeframe, li_16 +
1) && iSAR(NULL, Timeframe, gd_184, gd_200, li_16) < iLow(NULL, Timeframe, li_16) && iSAR(NULL, Timeframe, gd_192, gd_200, li_16) < iLow(NULL, Timeframe, li_16)) g_ibuf_224[li_16] = iSAR(NULL, Timeframe, gd_192, gd_200, li_16);
if (iSAR(NULL, Timeframe, gd_184, gd_200, li_16 + 1) < iLow(NULL, Timeframe, li_16 + 1) || iSAR(NULL, Timeframe, gd_192, gd_200, li_16 + 1) < iLow(NULL, Timeframe, li_16 +
1) && iSAR(NULL, Timeframe, gd_184, gd_200, li_16) > iHigh(NULL, Timeframe, li_16) && iSAR(NULL, Timeframe, gd_192, gd_200, li_16) > iHigh(NULL, Timeframe, li_16)) g_ibuf_228[li_16] = iSAR(NULL, Timeframe, gd_192, gd_200, li_16);
li_16++;
}
if (showtime) {
for (li_16 = li_20; li_16 > 0; li_16--) {
if (TimeHour(Time[li_16]) == 结束时间 && TimeMinute(Time[li_16]) == 0) li_48 = Time[li_16];
if (TimeHour(Time[li_16]) == 开始时间 && TimeMinute(Time[li_16]) == 0) drawt(li_48 + "-text", " " + TimeToStr(Time[li_16], TIME_DATE) + "" + week(Time[li_16]), Time[li_16], High[li_16] + 10.0 * Point);
if (TimeHour(Time[li_16]) == 开始时间 && TimeMinute(Time[li_16]) == 0 && li_48 != 0) drawx(Time[li_16] + "-Close", Time[li_16], li_48, DarkSlateGray);
}
if (TimeHour(Time[0]) >= 结束时间) {
for (li_16 = 1440 / Period(); li_16 >= 0; li_16--) {
if (TimeHour(Time[li_16]) == 结束时间 && TimeMinute(Time[li_16]) == 0 && TimeYear(Time[li_16]) == TimeYear(Time[0]) && TimeMonth(Time[li_16]) == TimeMonth(Time[0]) &&
TimeDay(Time[li_16]) == TimeDay(Time[0])) {
li_48 = Time[li_16];
drawt(li_48 + "-text1", " " + TimeToStr(Time[0], TIME_DATE) + "" + week(Time[0]), Time[0], High[0] + 10.0 * Point);
drawx(li_48 + "-Close1", Time[0], li_48, DarkSlateGray);
}
}
}
if (TimeHour(Time[0]) < 开始时间) {
for (li_16 = 1440 / Period(); li_16 >= 0; li_16--) {
if (Time[li_16] + 86400 == StrToTime(TimeYear(Time[0]) + "." + TimeMonth(Time[0]) + "." + TimeDay(Time[0]) + " " + 结束时间 + ":00")) {
li_48 = Time[li_16];
drawt(li_48 + "-text1", TimeToStr(Time[0], TIME_DATE) + "" + week(Time[0]), Time[0], High[0] + 0.0 * Point);
drawx(li_48 + "-Close1", Time[0], li_48, DarkSlateGray);
}
}
}
}
if (弹窗报警开关 == TRUE && g_ibuf_220[0] > g_ibuf_216[0] && g_ibuf_220[1] <= g_ibuf_216[1] && gi_244 != Time[0]) {
Alert("红色出现 ", Symbol(), " ", Periodo(Period()));
gi_244 = Time[0];
}
if (弹窗报警开关 == TRUE && g_ibuf_220[0] < g_ibuf_216[0] && g_ibuf_220[1] >= g_ibuf_216[1] && gi_244 != Time[0]) {
Alert("绿色出现 ", Symbol(), " ", Periodo(Period()));
gi_244 = Time[0];
}
if (弹窗报警开关 == TRUE && g_ibuf_236[0] != g_ibuf_240[0] && g_ibuf_236[1] == g_ibuf_240[1] && gi_244 != Time[0]) {
Alert("黄色出现 ", Symbol(), " ", Periodo(Period()));
gi_244 = Time[0];
}
if (声音报警开关 == TRUE && g_ibuf_220[0] > g_ibuf_216[0] && g_ibuf_220[1] <= g_ibuf_216[1] && gi_248 != Time[0]) {
PlaySound(musicbuy);
gi_248 = Time[0];
}
if (声音报警开关 == TRUE && g_ibuf_220[0] < g_ibuf_216[0] && g_ibuf_220[1] >= g_ibuf_216[1] && gi_248 != Time[0]) {
PlaySound(musicsell);
gi_248 = Time[0];
}
if (声音报警开关 == TRUE && g_ibuf_236[0] != g_ibuf_240[0] && g_ibuf_236[1] == g_ibuf_240[1] && gi_248 != Time[0]) {
PlaySound(musicclose);
gi_248 = Time[0];
}
if (gi_252 == 0 || Bars < gi_252) g_bars_312 = Bars;
else g_bars_312 = gi_252;
if (gi_256 > 0) gi_316 = gi_256;
else {
switch (Period()) {
case PERIOD_M1:
gi_316 = 12;
break;
case PERIOD_M5:
gi_316 = 48;
break;
case PERIOD_M15:
gi_316 = 24;
break;
case PERIOD_M30:
gi_316 = 24;
break;
case PERIOD_H1:
gi_316 = 12;
break;
case PERIOD_H4:
gi_316 = 15;
break;
case PERIOD_D1:
gi_316 = 10;
break;
case PERIOD_W1:
gi_316 = 6;
break;
default:
DelObj();
return (-1);
}
}
gi_260 = 2;
gi_272 = -1;
gi_276 = -1;
gi_280 = 0;
while (gi_272 == -1 || gi_276 == -1 && gi_260 < g_bars_312) {
if (gi_280 < 1 && gi_260 == iLowest(Symbol(), Period(), MODE_LOW, gi_316 << 1 + 1, gi_260 - gi_316)) {
if (gi_280 == 0) {
gi_280 = -1;
gi_272 = gi_260;
g_price_284 = Low[gi_272];
} else {
gi_276 = gi_260;
g_price_292 = Low[gi_276];
}
}
if (gi_280 > -1 && gi_260 == iHighest(Symbol(), Period(), MODE_HIGH, gi_316 << 1 + 1, gi_260 - gi_316)) {
if (gi_280 == 0) {
gi_280 = 1;
gi_272 = gi_260;
g_price_284 = High[gi_272];
} else {
gi_276 = gi_260;
g_price_292 = High[gi_276];
}
}
gi_260++;
}
if (gi_272 == -1 || gi_276 == -1) {
DelObj();
return (-1);
}
gd_264 = (g_price_292 - g_price_284) / (gi_276 - gi_272);
g_price_284 -= gi_272 * gd_264;
gi_272 = 0;
gi_320 = 0;
gd_324 = 0;
if (gi_280 == 1) {
g_price_300 = Low[2] - 2.0 * gd_264;
for (li_16 = 3; li_16 <= gi_276; li_16++)
if (Low[li_16] < g_price_300 + gd_264 * li_16) g_price_300 = Low[li_16] - li_16 * gd_264;
if (Low[0] < g_price_300) {
gi_320 = 0;
gd_324 = g_price_300;
}
if (Low[1] < g_price_300 + gd_264) {
gi_320 = 1;
gd_324 = g_price_300 + gd_264;
}
if (High[0] > g_price_284) {
gi_320 = 0;
gd_324 = g_price_284;
}
if (High[1] > g_price_284 + gd_264) {
gi_320 = 1;
gd_324 = g_price_284 + gd_264;
}
} else {
g_price_300 = High[2] - 2.0 * gd_264;
for (li_16 = 3; li_16 <= gi_276; li_16++)
if (High[li_16] > g_price_300 + gd_264 * li_16) g_price_300 = High[li_16] - li_16 * gd_264;
if (Low[0] < g_price_284) {
gi_320 = 0;
gd_324 = g_price_284;
}
if (Low[1] < g_price_284 + gd_264) {
gi_320 = 1;
gd_324 = g_price_284 + gd_264;
}
if (High[0] > g_price_300) {
gi_320 = 0;
gd_324 = g_price_300;
}
if (High[1] > g_price_300 + gd_264) {
gi_320 = 1;
gd_324 = g_price_300 + gd_264;
}
}
g_price_292 = g_price_284 + g_bars_312 * gd_264;
g_datetime_332 = Time[gi_272];
g_datetime_336 = Time[g_bars_312];
if (gd_324 != 0.0) g_ibuf_232[gi_320] = gd_324;
DelObj();
ObjectCreate("TL1", OBJ_TREND, 0, g_datetime_336, g_price_300 + gd_264 * g_bars_312, g_datetime_332, g_price_300);
ObjectSet("TL1", OBJPROP_COLOR, Fuchsia);
ObjectSet("TL1", OBJPROP_WIDTH, 1);
ObjectSet("TL1", OBJPROP_STYLE, STYLE_SOLID);
ObjectCreate("TL2", OBJ_TREND, 0, g_datetime_336, g_price_292, g_datetime_332, g_price_284);
ObjectSet("TL2", OBJPROP_COLOR, Fuchsia);
ObjectSet("TL2", OBJPROP_WIDTH, 1);
ObjectSet("TL2", OBJPROP_STYLE, STYLE_SOLID);
ObjectCreate("MIDL", OBJ_TREND, 0, g_datetime_336, (g_price_292 + g_price_300 + gd_264 * g_bars_312) / 2.0, g_datetime_332, (g_price_284 + g_price_300) / 2.0);
ObjectSet("MIDL", OBJPROP_COLOR, Fuchsia);
ObjectSet("MIDL", OBJPROP_WIDTH, 1);
ObjectSet("MIDL", OBJPROP_STYLE, STYLE_DOT);
return (0);
}

void drawx(string a_name_0, int a_datetime_8, int a_datetime_12, color a_color_16) {
if (ObjectFind(a_name_0) == -1) {
ObjectCreate(a_name_0, OBJ_RECTANGLE, 0, a_datetime_8, 0, a_datetime_12, 1000);
ObjectSet(a_name_0, OBJPROP_COLOR, a_color_16);
ObjectSet(a_name_0, OBJPROP_STYLE, STYLE_SOLID);
ObjectSet(a_name_0, OBJPROP_BACK, TRUE);
ObjectSet(a_name_0, OBJPROP_RAY, FALSE);
ObjectSet(a_name_0, OBJPROP_WIDTH, 2);
return;
}
ObjectMove(a_name_0, 0, a_datetime_8, 0);
ObjectMove(a_name_0, 1, a_datetime_12, 1000);
}

void drawt(string a_name_0, string a_text_8, int a_datetime_16, double a_price_20) {
if (ObjectFind(a_name_0) == -1) {
ObjectCreate(a_name_0, OBJ_TEXT, 0, a_datetime_16, a_price_20, a_datetime_16, a_price_20);
ObjectSetText(a_name_0, a_text_8, 9, "Arial ", Yellow);
ObjectSet(a_name_0, OBJPROP_WIDTH, 1);
return;
}
ObjectMove(a_name_0, 0, a_datetime_16, a_price_20);
}

string week(int ai_0) {
if (TimeDayOfWeek(ai_0) == 1) return ("周一");
if (TimeDayOfWeek(ai_0) == 2) return ("周二");
if (TimeDayOfWeek(ai_0) == 3) return ("周三");
if (TimeDayOfWeek(ai_0) == 4) return ("周四");
if (TimeDayOfWeek(ai_0) == 5) return ("周五");
if (TimeDayOfWeek(ai_0) == 6) return ("周六");
if (TimeDayOfWeek(ai_0) == 7) return ("周日");
return ("");
}

string Periodo(int ai_0) {
if (ai_0 == 1) return ("M1");
if (ai_0 == 5) return ("M5");
if (ai_0 == 15) return ("M15");
if (ai_0 == 30) return ("M30");
if (ai_0 == 60) return ("H1");
if (ai_0 == 240) return ("H4");
if (ai_0 == 1440) return ("D1");
return ("");
}

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