这是源码,希望对爱钻研的人有用。我没有权限发表链接,去除了其中的链接。
/*
Generated by EX4-TO-MQ4 decompiler V4.0.224.1
*/
#property copyright "Kalenzo"
#property link "[email protected]"
#property indicator_chart_window
int init() {
return (0);
}
int deinit() {
ObjectDelete("S1");
ObjectDelete("S2");
ObjectDelete("S3");
ObjectDelete("R1");
ObjectDelete("R2");
ObjectDelete("R3");
ObjectDelete("PIVIOT");
ObjectDelete("Support 1");
ObjectDelete("Support 2");
ObjectDelete("Support 3");
ObjectDelete("Piviot level");
ObjectDelete("Resistance 1");
ObjectDelete("Resistance 2");
ObjectDelete("Resistance 3");
Comment(" ");
return (0);
}
int start() {
double lda_0[1][6];
double ld_4;
double ld_12;
double ld_20;
ArrayCopyRates(lda_0, Symbol(), PERIOD_D1);
if (DayOfWeek() == 1) {
if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, 1)) == 5) {
ld_4 = lda_0[1][4];
ld_12 = lda_0[1][3];
ld_20 = lda_0[1][2];
} else {
for (int li_28 = 5; li_28 >= 0; li_28--) {
if (TimeDayOfWeek(iTime(Symbol(), PERIOD_D1, li_28)) == 5) {
ld_4 = lda_0[li_28][4];
ld_12 = lda_0[li_28][3];
ld_20 = lda_0[li_28][2];
}
}
}
} else {
ld_4 = lda_0[1][4];
ld_12 = lda_0[1][3];
ld_20 = lda_0[1][2];
}
Comment("\nYesterday quotations:\nH ", ld_12,
"\nL ", ld_20,
"\nC ", ld_4);
double ld_32 = ld_12 - ld_20;
double ld_40 = (ld_12 + ld_20 + ld_4) / 3.0;
double ld_48 = ld_40 + 1.0 * ld_32;
double ld_56 = ld_40 + 0.618 * ld_32;
double ld_64 = ld_40 + ld_32 / 2.0;
double ld_72 = ld_40 - ld_32 / 2.0;
double ld_80 = ld_40 - 0.618 * ld_32;
double ld_88 = ld_40 - 1.0 * ld_32;
drawLine(ld_48, "R3", Lime, 0);
drawLabel("Resistance 3", ld_48, Lime);
drawLine(ld_56, "R2", Green, 0);
drawLabel("Resistance 2", ld_56, Green);
drawLine(ld_64, "R1", DarkGreen, 0);
drawLabel("Resistance 1", ld_64, DarkGreen);
drawLine(ld_40, "PIVIOT", Blue, 1);
drawLabel("Piviot level", ld_40, Blue);
drawLine(ld_72, "S1", Maroon, 0);
drawLabel("Support 1", ld_72, Maroon);
drawLine(ld_80, "S2", Crimson, 0);
drawLabel("Support 2", ld_80, Crimson);
drawLine(ld_88, "S3", Red, 0);
drawLabel("Support 3", ld_88, Red);
return (0);
}
void drawLabel(string a_name_0, double a_price_8, color a_color_16) {
if (ObjectFind(a_name_0) != 0) {
ObjectCreate(a_name_0, OBJ_TEXT, 0, Time[10], a_price_8);
ObjectSetText(a_name_0, a_name_0, 8, "Arial", CLR_NONE);
ObjectSet(a_name_0, OBJPROP_COLOR, a_color_16);
return;
}
ObjectMove(a_name_0, 0, Time[10], a_price_8);
}
void drawLine(double a_price_0, string a_name_8, color a_color_16, int ai_20) {
if (ObjectFind(a_name_8) != 0) {
ObjectCreate(a_name_8, OBJ_HLINE, 0, Time[0], a_price_0, Time[0], a_price_0);
if (ai_20 == 1) ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_SOLID);
else ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_DOT);
ObjectSet(a_name_8, OBJPROP_COLOR, a_color_16);
ObjectSet(a_name_8, OBJPROP_WIDTH, 1);
return;
}
ObjectDelete(a_name_8);
ObjectCreate(a_name_8, OBJ_HLINE, 0, Time[0], a_price_0, Time[0], a_price_0);
if (ai_20 == 1) ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_SOLID);
else ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_DOT);
ObjectSet(a_name_8, OBJPROP_COLOR, a_color_16);
ObjectSet(a_name_8, OBJPROP_WIDTH, 1);
}