加好了,你试一下,最好能告诉一下使用的效果如何:
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright "asystem2000"
#property link "asystem2000@yandex.ru"
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Chocolate
#property indicator_color2 Chocolate
#property indicator_color3 MediumVioletRed
#property indicator_color4 MediumVioletRed
#property indicator_color5 Yellow
#property indicator_color6 Yellow
extern double Period1 = 5.0;
extern double Period2 = 13.0;
extern double Period3 = 34.0;
extern string Dev_Step_1 = "1,3";
extern string Dev_Step_2 = "8,5";
extern string Dev_Step_3 = "21,12";
extern int Symbol_1_Kod = 140;
extern int Symbol_2_Kod = 141;
extern int Symbol_3_Kod = 142;
double g_ibuf_136[];
double g_ibuf_140[];
double g_ibuf_144[];
double g_ibuf_148[];
double g_ibuf_152[];
double g_ibuf_156[];
int gi_unused_160;
int gi_unused_164;
int gi_unused_168;
int gi_172;
int gi_176;
int gi_180;
int gi_184;
int gi_188;
int gi_192;
datetime alarmtime = 0;
int init() {
int lia_8[];
if (Period1 > 0.0) gi_unused_160 = MathCeil(Period1 * Period());
else gi_unused_160 = 0;
if (Period2 > 0.0) gi_unused_164 = MathCeil(Period2 * Period());
else gi_unused_164 = 0;
if (Period3 > 0.0) gi_unused_168 = MathCeil(Period3 * Period());
else gi_unused_168 = 0;
if (Period1 > 0.0) {
SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexArrow(0, Symbol_1_Kod);
SetIndexBuffer(0, g_ibuf_136);
SetIndexEmptyValue(0, 0.0);
SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1);
SetIndexArrow(1, Symbol_1_Kod);
SetIndexBuffer(1, g_ibuf_140);
SetIndexEmptyValue(1, 0.0);
}
if (Period2 > 0.0) {
SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, 3);
SetIndexArrow(2, Symbol_2_Kod);
SetIndexBuffer(2, g_ibuf_144);
SetIndexEmptyValue(2, 0.0);
SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, 3);
SetIndexArrow(3, Symbol_2_Kod);
SetIndexBuffer(3, g_ibuf_148);
SetIndexEmptyValue(3, 0.0);
}
if (Period3 > 0.0) {
SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, 4);
SetIndexArrow(4, Symbol_3_Kod);
SetIndexBuffer(4, g_ibuf_152);
SetIndexEmptyValue(4, 0.0);
SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, 4);
SetIndexArrow(5, Symbol_3_Kod);
SetIndexBuffer(5, g_ibuf_156);
SetIndexEmptyValue(5, 0.0);
}
int li_unused_0 = 0;
int li_unused_4 = 0;
int li_12 = 0;
if (IntFromStr(Dev_Step_1, li_12, lia_8) == 1) {
gi_176 = lia_8[1];
gi_172 = lia_8[0];
}
if (IntFromStr(Dev_Step_2, li_12, lia_8) == 1) {
gi_184 = lia_8[1];
gi_180 = lia_8[0];
}
if (IntFromStr(Dev_Step_3, li_12, lia_8) == 1) {
gi_192 = lia_8[1];
gi_188 = lia_8[0];
}
return (0);
}
int deinit() {
return (0);
}
int start() {
if (Period1 > 0.0) CountZZ(g_ibuf_136, g_ibuf_140, Period1, gi_172, gi_176, 1);
if (Period2 > 0.0) CountZZ(g_ibuf_144, g_ibuf_148, Period2, gi_180, gi_184, 2);
if (Period3 > 0.0) CountZZ(g_ibuf_152, g_ibuf_156, Period3, gi_188, gi_192, 3);
return (0);
}
int CountZZ(double &ada_0[], double &ada_4[], int ai_8, int ai_12, int ai_16, int alarm) {
double ld_36;
double ld_44;
double ld_52;
double ld_60;
double ld_68;
double ld_76;
for (int li_20 = Bars - ai_8; li_20 >= 0; li_20--) {
ld_36 = Low[iLowest(NULL, 0, MODE_LOW, ai_8, li_20)];
if (ld_36 == ld_76) ld_36 = 0.0;
else {
ld_76 = ld_36;
if (Low[li_20] - ld_36 > ai_12 * Point) ld_36 = 0.0;
else {
for (int li_24 = 1; li_24 ld_36) ada_0[li_20 + li_24] = 0.0;
}
}
}
ada_0[li_20] = ld_36;
ld_36 = High[iHighest(NULL, 0, MODE_HIGH, ai_8, li_20)];
if (ld_36 == ld_68) ld_36 = 0.0;
else {
ld_68 = ld_36;
if (ld_36 - High[li_20] > ai_12 * Point) ld_36 = 0.0;
else {
for (li_24 = 1; li_24 = 0; li_20--) {
ld_52 = ada_0[li_20];
ld_60 = ada_4[li_20];
if (ld_52 == 0.0 && ld_60 == 0.0) continue;
if (ld_60 != 0.0) {
if (ld_68 > 0.0) {
if (ld_68 0.0) {
if (ld_76 > ld_52) ada_0[li_32] = 0;
else ada_0[li_20] = 0;
}
if (ld_52 = 0; li_20--) {
if (li_20 >= Bars - ai_8) ada_0[li_20] = 0.0;
else {
ld_44 = ada_4[li_20];
if (ld_44 != 0.0) ada_4[li_20] = ld_44;
}
}
if( alarmtime != Time[0] && ( ada_0[0] != 0 || ada_4[0] != 0))
{
Alert( Symbol(), "出现了",alarm,"号信号,价格:",Close[0]);
alarmtime = Time[0];
}
return (0);
}
int Str2Massive(string as_0, int &ai_8, int &aia_12[]) {
int li_20;
int l_str2int_16 = StrToInteger(as_0);
if (l_str2int_16 > 0) {
ai_8++;
li_20 = ArrayResize(aia_12, ai_8);
if (li_20 == 0) return (-1);
aia_12[ai_8 - 1] = l_str2int_16;
return (1);
}
return (0);
}
int IntFromStr(string as_0, int &ai_8, int aia_12[]) {
string ls_28;
if (StringLen(as_0) == 0) return (-1);
string ls_16 = as_0;
int li_24 = 0;
ai_8 = 0;
ArrayResize(aia_12, ai_8);
while (StringLen(ls_16) > 0) {
li_24 = StringFind(ls_16, ",");
if (li_24 > 0) {
ls_28 = StringSubstr(ls_16, 0, li_24);
ls_16 = StringSubstr(ls_16, li_24 + 1, StringLen(ls_16));
} else {
if (StringLen(ls_16) > 0) {
ls_28 = ls_16;
ls_16 = "";
}
}
if (Str2Massive(ls_28, ai_8, aia_12) == 0) return (-2);
}
return (1);
}
|