不是乱码啊
- #property copyright "外汇EA之家,免费下载EA、指标"
- #property link "http://www.eazhijia.com"
- #property indicator_separate_window
- #property indicator_minimum 0.0
- #property indicator_maximum 5.0
- #property indicator_buffers 8
- #property indicator_color1 DodgerBlue
- #property indicator_color2 Crimson
- #property indicator_color3 DodgerBlue
- #property indicator_color4 Crimson
- #property indicator_color5 DodgerBlue
- #property indicator_color6 Crimson
- #property indicator_color7 DodgerBlue
- #property indicator_color8 Crimson
- extern double stepPSAR1 = 0.06;
- extern double stepPSAR2 = 0.06;
- extern double stepPSAR3 = 0.06;
- extern double stepPSAR4 = 0.06;
- extern double maxPSAR = 0.2;
- extern int BarWidth = 0;
- extern color UpBarColor = DodgerBlue;
- extern color DownBarColor = Crimson;
- extern color TextColor = White;
- extern int MaxBars = 500;
- extern bool AlertWhenTFColorMatch = TRUE;
- extern string AlertCustomMessageUp = "All TF going UP";
- extern string AlertCustomMessageDown = "All TF going DOWN";
- double gd_156 = 1.0;
- double g_ibuf_164[];
- double g_ibuf_168[];
- double g_ibuf_172[];
- double g_ibuf_176[];
- double g_ibuf_180[];
- double g_ibuf_184[];
- double g_ibuf_188[];
- double g_ibuf_192[];
- double g_isar_196;
- bool gi_204;
- bool gi_208;
- bool gi_212;
- bool gi_216;
- string gs_220 = "";
- bool gi_228 = TRUE;
- int gi_232 = 110;
- int gi_236 = 110;
- int gi_240 = 228;
- bool gi_244 = TRUE;
- int g_time_248 = 0;
- int init() {
- gi_228 = TRUE;
- SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, BarWidth, UpBarColor);
- SetIndexArrow(0, gi_232);
- SetIndexBuffer(0, g_ibuf_164);
- SetIndexEmptyValue(0, 0.0);
- SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, BarWidth, DownBarColor);
- SetIndexArrow(1, gi_236);
- SetIndexBuffer(1, g_ibuf_168);
- SetIndexEmptyValue(1, 0.0);
- SetIndexStyle(2, DRAW_ARROW, STYLE_SOLID, BarWidth, UpBarColor);
- SetIndexArrow(2, gi_232);
- SetIndexBuffer(2, g_ibuf_172);
- SetIndexEmptyValue(2, 0.0);
- SetIndexStyle(3, DRAW_ARROW, STYLE_SOLID, BarWidth, DownBarColor);
- SetIndexArrow(3, gi_236);
- SetIndexBuffer(3, g_ibuf_176);
- SetIndexEmptyValue(3, 0.0);
- SetIndexStyle(4, DRAW_ARROW, STYLE_SOLID, BarWidth, UpBarColor);
- SetIndexArrow(4, gi_232);
- SetIndexBuffer(4, g_ibuf_180);
- SetIndexEmptyValue(4, 0.0);
- SetIndexStyle(5, DRAW_ARROW, STYLE_SOLID, BarWidth, DownBarColor);
- SetIndexArrow(5, gi_236);
- SetIndexBuffer(5, g_ibuf_184);
- SetIndexEmptyValue(5, 0.0);
- SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, BarWidth, UpBarColor);
- SetIndexArrow(6, gi_232);
- SetIndexBuffer(6, g_ibuf_188);
- SetIndexEmptyValue(6, 0.0);
- SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, BarWidth, DownBarColor);
- SetIndexArrow(7, gi_236);
- SetIndexBuffer(7, g_ibuf_192);
- SetIndexEmptyValue(7, 0.0);
- SetIndexLabel(0, NULL);
- SetIndexLabel(1, NULL);
- SetIndexLabel(2, NULL);
- SetIndexLabel(3, NULL);
- SetIndexLabel(4, NULL);
- SetIndexLabel(5, NULL);
- SetIndexLabel(6, NULL);
- SetIndexLabel(7, NULL);
- IndicatorDigits(0);
- for (int li_0 = MaxBars - 1; li_0 >= 0; li_0--) {
- g_ibuf_188[li_0] = 0;
- g_ibuf_192[li_0] = 0;
- g_ibuf_180[li_0] = 0;
- g_ibuf_184[li_0] = 0;
- g_ibuf_172[li_0] = 0;
- g_ibuf_176[li_0] = 0;
- g_ibuf_164[li_0] = 0;
- g_ibuf_168[li_0] = 0;
- }
- return (0);
- }
- int deinit() {
- return (0);
- }
- int start() {
- int li_24;
- int li_28;
- int timeframe_40;
- int timeframe_44;
- int timeframe_48;
- int timeframe_52;
- int lia_60[];
- int lia_64[];
- int lia_68[];
- int lia_72[];
- int li_76;
- double ld_80;
- double ld_92;
- string text_100;
- double price_108;
- string name_120;
- int timeframe_132;
- double ld_136;
- double ld_144;
- int ind_counted_0 = IndicatorCounted();
- int index_4 = 0;
- int index_8 = 0;
- int index_12 = 0;
- int index_16 = 0;
- int index_20 = 0;
- if (gi_228) li_28 = MaxBars;
- else li_28 = MaxBars;
- switch (Period()) {
- case PERIOD_M1:
- timeframe_40 = 1;
- timeframe_44 = 5;
- timeframe_48 = 15;
- timeframe_52 = 30;
- break;
- case PERIOD_M5:
- timeframe_40 = 5;
- timeframe_44 = 15;
- timeframe_48 = 30;
- timeframe_52 = 60;
- break;
- case PERIOD_M15:
- timeframe_40 = 15;
- timeframe_44 = 30;
- timeframe_48 = 60;
- timeframe_52 = 240;
- break;
- case PERIOD_M30:
- timeframe_40 = 30;
- timeframe_44 = 60;
- timeframe_48 = 240;
- timeframe_52 = 1440;
- break;
- case PERIOD_H1:
- timeframe_40 = 60;
- timeframe_44 = 240;
- timeframe_48 = 1440;
- timeframe_52 = 10080;
- break;
- case PERIOD_H4:
- timeframe_40 = 240;
- timeframe_44 = 1440;
- timeframe_48 = 10080;
- timeframe_52 = 43200;
- break;
- case PERIOD_D1:
- timeframe_40 = 1440;
- timeframe_44 = 10080;
- timeframe_48 = 43200;
- timeframe_52 = 43200;
- break;
- case PERIOD_W1:
- timeframe_40 = 10080;
- timeframe_44 = 43200;
- timeframe_48 = 43200;
- timeframe_52 = 43200;
- break;
- case PERIOD_MN1:
- timeframe_40 = 43200;
- timeframe_44 = 43200;
- timeframe_48 = 43200;
- timeframe_52 = 43200;
- }
- gs_220 = "#TheSecret TF PSAR (" + timeframe_40 + "," + timeframe_44 + "," + timeframe_48 + "," + timeframe_52 + ")";
- IndicatorShortName(gs_220);
- gi_244 = NewBar();
- if (gi_228 || gi_244) {
- li_76 = gi_240;
- ld_80 = Time[0] - Time[1];
- for (int li_88 = ObjectsTotal() - 1; li_88 > -1; li_88--) {
- if (StringFind(ObjectName(li_88), "FF_" + li_76 + "_") >= 0) ObjectDelete(ObjectName(li_88));
- else li_88 = -1;
- }
- ld_92 = 0.2;
- for (li_88 = 0; li_88 < 4; li_88++) {
- text_100 = "??";
- switch (li_88) {
- case 0:
- text_100 = tf2txt(timeframe_40);
- price_108 = ld_92 + 1.0;
- break;
- case 1:
- text_100 = tf2txt(timeframe_44);
- price_108 = gd_156 + 1.0 + ld_92;
- break;
- case 2:
- text_100 = tf2txt(timeframe_48);
- price_108 = 2.0 * gd_156 + 1.0 + ld_92;
- break;
- case 3:
- text_100 = tf2txt(timeframe_52);
- price_108 = 3.0 * gd_156 + 1.0 + ld_92;
- }
- name_120 = "FF_" + li_76 + "_" + li_88 + "_" + text_100;
- ObjectCreate(name_120, OBJ_TEXT, WindowFind(gs_220), iTime(NULL, 0, 0) + 3.0 * ld_80, price_108);
- ObjectSetText(name_120, text_100, 8, "Arial", TextColor);
- }
- if (gi_228) {
- ArrayCopySeries(lia_60, 5, Symbol(), timeframe_52);
- ArrayCopySeries(lia_64, 5, Symbol(), timeframe_48);
- ArrayCopySeries(lia_68, 5, Symbol(), timeframe_44);
- ArrayCopySeries(lia_72, 5, Symbol(), timeframe_40);
- }
- }
- if (gi_228) {
- index_4 = 0;
- index_8 = 0;
- index_12 = 0;
- index_16 = 0;
- index_20 = 0;
- while (index_4 < li_28) {
- if (Time[index_4] < lia_60[index_12]) index_12++;
- if (Time[index_4] < lia_64[index_16]) index_16++;
- if (Time[index_4] < lia_68[index_20]) index_20++;
- if (Time[index_4] < lia_72[index_8]) index_8++;
- for (int count_128 = 0; count_128 < 4; count_128++) {
- ld_136 = 0;
- ld_144 = 0;
- switch (count_128) {
- case 0:
- timeframe_132 = timeframe_40;
- li_24 = index_8;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR1, maxPSAR, li_24);
- break;
- case 1:
- timeframe_132 = timeframe_44;
- li_24 = index_20;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR2, maxPSAR, li_24);
- break;
- case 2:
- timeframe_132 = timeframe_48;
- li_24 = index_16;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR3, maxPSAR, li_24);
- break;
- case 3:
- timeframe_132 = timeframe_52;
- li_24 = index_12;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR4, maxPSAR, li_24);
- }
- if (g_isar_196 < iClose(NULL, timeframe_132, li_24)) ld_136 = 1;
- else ld_144 = 1;
- switch (count_128) {
- case 0:
- g_ibuf_188[index_4] = ld_136;
- g_ibuf_192[index_4] = ld_144;
- break;
- case 1:
- g_ibuf_180[index_4] = ld_136 * (gd_156 + 1.0);
- g_ibuf_184[index_4] = ld_144 * (gd_156 + 1.0);
- break;
- case 2:
- g_ibuf_172[index_4] = ld_136 * (2.0 * gd_156 + 1.0);
- g_ibuf_176[index_4] = ld_144 * (2.0 * gd_156 + 1.0);
- break;
- case 3:
- g_ibuf_164[index_4] = ld_136 * (3.0 * gd_156 + 1.0);
- g_ibuf_168[index_4] = ld_144 * (3.0 * gd_156 + 1.0);
- }
- }
- index_4++;
- }
- }
- index_4 = 0;
- index_8 = 0;
- index_12 = 0;
- index_16 = 0;
- index_20 = 0;
- while (index_4 < 1) {
- for (count_128 = 0; count_128 < 4; count_128++) {
- ld_136 = 0;
- ld_144 = 0;
- switch (count_128) {
- case 0:
- timeframe_132 = timeframe_40;
- li_24 = index_8;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR1, maxPSAR, li_24);
- break;
- case 1:
- timeframe_132 = timeframe_44;
- li_24 = index_20;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR2, maxPSAR, li_24);
- break;
- case 2:
- timeframe_132 = timeframe_48;
- li_24 = index_16;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR3, maxPSAR, li_24);
- break;
- case 3:
- timeframe_132 = timeframe_52;
- li_24 = index_12;
- g_isar_196 = iSAR(NULL, timeframe_132, stepPSAR4, maxPSAR, li_24);
- }
- if (g_isar_196 < iClose(NULL, timeframe_132, li_24)) ld_136 = 1;
- else ld_144 = 1;
- switch (count_128) {
- case 0:
- g_ibuf_188[index_4] = ld_136;
- g_ibuf_192[index_4] = ld_144;
- break;
- case 1:
- g_ibuf_180[index_4] = ld_136 * (gd_156 + 1.0);
- g_ibuf_184[index_4] = ld_144 * (gd_156 + 1.0);
- break;
- case 2:
- g_ibuf_172[index_4] = ld_136 * (2.0 * gd_156 + 1.0);
- g_ibuf_176[index_4] = ld_144 * (2.0 * gd_156 + 1.0);
- break;
- case 3:
- g_ibuf_164[index_4] = ld_136 * (3.0 * gd_156 + 1.0);
- g_ibuf_168[index_4] = ld_144 * (3.0 * gd_156 + 1.0);
- }
- }
- index_4++;
- }
- if (AlertWhenTFColorMatch && gi_244 && (!gi_228)) {
- if (g_ibuf_164[0] == 0.0 && g_ibuf_168[0] == 4.0 && g_ibuf_172[0] == 0.0 && g_ibuf_176[0] == 3.0 && g_ibuf_180[0] == 0.0 && g_ibuf_184[0] == 2.0 && g_ibuf_188[0] == 0.0 &&
- g_ibuf_192[0] == 1.0) gi_208 = TRUE;
- else gi_208 = FALSE;
- if (g_ibuf_164[0] == 4.0 && g_ibuf_168[0] == 0.0 && g_ibuf_172[0] == 3.0 && g_ibuf_176[0] == 0.0 && g_ibuf_180[0] == 2.0 && g_ibuf_184[0] == 0.0 && g_ibuf_188[0] == 1.0 &&
- g_ibuf_192[0] == 0.0) gi_204 = TRUE;
- else gi_204 = FALSE;
- if (g_ibuf_164[1] == 0.0 && g_ibuf_168[1] == 4.0 && g_ibuf_172[1] == 0.0 && g_ibuf_176[1] == 3.0 && g_ibuf_180[1] == 0.0 && g_ibuf_184[1] == 2.0 && g_ibuf_188[1] == 0.0 &&
- g_ibuf_192[1] == 1.0) gi_216 = TRUE;
- else gi_216 = FALSE;
- if (g_ibuf_164[1] == 4.0 && g_ibuf_168[1] == 0.0 && g_ibuf_172[1] == 3.0 && g_ibuf_176[1] == 0.0 && g_ibuf_180[1] == 2.0 && g_ibuf_184[1] == 0.0 && g_ibuf_188[1] == 1.0 &&
- g_ibuf_192[1] == 0.0) gi_212 = TRUE;
- else gi_212 = FALSE;
- if (gi_204 && (!gi_212)) Alert("4TFPSAR on " + Symbol() + " " + tf2txt(Period()) + " : " + AlertCustomMessageUp);
- if (gi_208 && (!gi_216)) Alert("4TFPSAR on " + Symbol() + " " + tf2txt(Period()) + " : " + AlertCustomMessageDown);
- }
- gi_228 = FALSE;
- return (0);
- }
- string tf2txt(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");
- if (ai_0 == 10080) return ("W1");
- if (ai_0 == 43200) return ("MN1");
- if (ai_0 == 120) return ("H2");
- return ("??");
- }
- int NewBar() {
- if (Time[0] != g_time_248) {
- g_time_248 = Time[0];
- return (1);
- }
- return (0);
- }
复制代码
|