查看: 2163|回复: 12

[MT4指标] 千点指标系统

[复制链接]
发表于 2013-12-30 07:08 | 显示全部楼层 |阅读模式

  1. #property copyright "Copyright ?2009, Oasis WealthBuilders."
  2. #property link      "www.oasiswealthbuilders.com"

  3. #property indicator_chart_window

  4. extern bool Show_Currency_Meter_Strength = TRUE;
  5. extern bool Show_Statistic = TRUE;
  6. extern bool Show_CS_Position = TRUE;
  7. extern bool Show_SnR_Distance = TRUE;
  8. extern bool Show_Candle_Direction = TRUE;
  9. extern bool Show_Candle_Time = TRUE;
  10. extern bool Draw_Fibo_Pivot = TRUE;
  11. extern bool USD_JPY_alert = TRUE;
  12. extern string weak_alert_file = "alert2.wav";
  13. extern string strong_alert_file = "alert2.wav";
  14. extern double StrengthGap = 3.0;
  15. string gsa_132[] = {"USD", "EUR", "GBP", "JPY", "CHF", "CAD", "NZD", "AUD"};
  16. string gsa_136[] = {"EURUSD", "GBPUSD", "AUDUSD", "USDJPY", "USDCHF", "USDCAD", "EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "GBPJPY", "GBPCHF", "NZDUSD", "AUDCAD", "AUDJPY", "CHFJPY", "AUDNZD", "NZDJPY", "NZDCAD", "NZDCHF", "GBPNZD", "EURNZD", "GBPCAD", "GBPAUD", "AUDCHF", "CADCHF", "CADJPY"};
  17. string gsa_140[] = {"GBPJPY", "AUDJPY", "EURJPY", "USDJPY", "NZDJPY", "CHFJPY", "GBPUSD", "AUDUSD", "EURUSD", "NZDUSD", "USDCAD", "USDCHF"};
  18. double gd_144;
  19. double gd_152;
  20. double gd_160;
  21. double gd_168;
  22. double gd_176;
  23. double gd_184;
  24. double gd_192;
  25. string gs_200 = "";
  26. bool gi_unused_208 = FALSE;

  27. int init() {
  28.    ObjectsDeleteAll(0, OBJ_LABEL);
  29.    ObjectsDeleteAll(0, OBJ_TEXT);
  30.    Comment("");
  31.    return (0);
  32. }

  33. int deinit() {
  34.    ObjectsDeleteAll(0, OBJ_LABEL);
  35.    ObjectsDeleteAll(0, OBJ_TEXT);
  36.    ObjectDelete("S1");
  37.    ObjectDelete("S2");
  38.    ObjectDelete("S3");
  39.    ObjectDelete("R1");
  40.    ObjectDelete("R2");
  41.    ObjectDelete("R3");
  42.    ObjectDelete("PIVOT");
  43.    ObjectDelete("Support 1");
  44.    ObjectDelete("Support 2");
  45.    ObjectDelete("Support 3");
  46.    ObjectDelete("Piviot level");
  47.    ObjectDelete("Resistance 1");
  48.    ObjectDelete("Resistance 2");
  49.    ObjectDelete("Resistance 3");
  50.    Comment("");
  51.    return (0);
  52. }

  53. int start() {
  54.    gs_200 = StringSubstr(Symbol(), 6, 1);
  55.    RefreshRates();
  56.    if (Show_Currency_Meter_Strength) displayMeter();
  57.    if (Show_Statistic) displayHiLo();
  58.    if (Show_CS_Position) showCSLocation();
  59.    if (Show_SnR_Distance) showSnRDist();
  60.    if (Show_Candle_Direction) displayCandleDirection();
  61.    if (Show_Candle_Time) displayCandleTime();
  62.    if (Draw_Fibo_Pivot) drawFiboPiv();
  63.    if (USD_JPY_alert) {
  64.       if (currency_strength("JPY") <= 2.0 || currency_strength("USD") <= 2.0) PlaySound(weak_alert_file);
  65.       if (currency_strength("JPY") >= 8.0 || currency_strength("USD") >= 8.0) PlaySound(strong_alert_file);
  66.    }
  67.    return (0);
  68. }

  69. double currency_strength(string as_0) {
  70.    int li_8;
  71.    string ls_12;
  72.    double ld_20;
  73.    double ld_28;
  74.    double ld_ret_36 = 0;
  75.    int l_count_44 = 0;
  76.    for (int l_index_48 = 0; l_index_48 < ArraySize(gsa_136); l_index_48++) {
  77.       li_8 = 0;
  78.       ls_12 = gsa_136[l_index_48];
  79.       if (as_0 == StringSubstr(ls_12, 0, 3) || as_0 == StringSubstr(ls_12, 3, 3)) {
  80.          ls_12 = ls_12 + gs_200;
  81.          ld_20 = (MarketInfo(ls_12, MODE_HIGH) - MarketInfo(ls_12, MODE_LOW)) * MarketInfo(ls_12, MODE_POINT);
  82.          if (ld_20 != 0.0) {
  83.             ld_28 = 100.0 * ((MarketInfo(ls_12, MODE_BID) - MarketInfo(ls_12, MODE_LOW)) / ld_20 * MarketInfo(ls_12, MODE_POINT));
  84.             if (ld_28 > 3.0) li_8 = 1;
  85.             if (ld_28 > 10.0) li_8 = 2;
  86.             if (ld_28 > 25.0) li_8 = 3;
  87.             if (ld_28 > 40.0) li_8 = 4;
  88.             if (ld_28 > 50.0) li_8 = 5;
  89.             if (ld_28 > 60.0) li_8 = 6;
  90.             if (ld_28 > 75.0) li_8 = 7;
  91.             if (ld_28 > 90.0) li_8 = 8;
  92.             if (ld_28 > 97.0) li_8 = 9;
  93.             l_count_44++;
  94.             if (as_0 == StringSubstr(ls_12, 3, 3)) li_8 = 9 - li_8;
  95.             ld_ret_36 += li_8;
  96.          }
  97.       }
  98.    }
  99.    ld_ret_36 /= l_count_44;
  100.    return (ld_ret_36);
  101. }

  102. void displayMeter() {
  103.    color l_color_0;
  104.    string l_name_4;
  105.    string ls_12 = "Meter";
  106.    double ld_20 = 0;
  107.    int l_x_28 = 220;
  108.    for (int l_index_32 = 0; l_index_32 < ArraySize(gsa_132); l_index_32++) {
  109.       ld_20++;
  110.       l_name_4 = ls_12 + DoubleToStr(ld_20, 0);
  111.       ObjectCreate(l_name_4, OBJ_LABEL, 0, 0, 0);
  112.       ObjectSetText(l_name_4, gsa_132[l_index_32], 9, "Arial Bold", DimGray);
  113.       ObjectSet(l_name_4, OBJPROP_CORNER, 3);
  114.       ObjectSet(l_name_4, OBJPROP_XDISTANCE, l_x_28);
  115.       ObjectSet(l_name_4, OBJPROP_YDISTANCE, 30);
  116.       l_x_28 -= 30;
  117.    }
  118.    l_x_28 = 221;
  119.    for (l_index_32 = 0; l_index_32 < ArraySize(gsa_132); l_index_32++) {
  120.       ld_20++;
  121.       l_name_4 = ls_12 + DoubleToStr(ld_20, 0);
  122.       l_color_0 = symcolor(currency_strength(gsa_132[l_index_32]));
  123.       ObjectCreate(l_name_4, OBJ_LABEL, 0, 0, 0);
  124.       ObjectSetText(l_name_4, DoubleToStr(currency_strength(gsa_132[l_index_32]), 2), 9, "Arial Bold", l_color_0);
  125.       ObjectSet(l_name_4, OBJPROP_CORNER, 3);
  126.       ObjectSet(l_name_4, OBJPROP_XDISTANCE, l_x_28);
  127.       ObjectSet(l_name_4, OBJPROP_YDISTANCE, 17);
  128.       l_x_28 -= 30;
  129.    }
  130.    ObjectCreate("Sym Line1", OBJ_LABEL, 0, 0, 0);
  131.    ObjectSetText("Sym Line1", "__________________________________", 10, "Arial Bold", White);
  132.    ObjectSet("Sym Line1", OBJPROP_CORNER, 3);
  133.    ObjectSet("Sym Line1", OBJPROP_XDISTANCE, 10);
  134.    ObjectSet("Sym Line1", OBJPROP_YDISTANCE, 45);
  135.    ObjectCreate("Sym Line2", OBJ_LABEL, 0, 0, 0);
  136.    ObjectSetText("Sym Line2", "__________________________________", 10, "Arial Bold", White);
  137.    ObjectSet("Sym Line2", OBJPROP_CORNER, 3);
  138.    ObjectSet("Sym Line2", OBJPROP_XDISTANCE, 10);
  139.    ObjectSet("Sym Line2", OBJPROP_YDISTANCE, 16);
  140.    ObjectCreate("Copyright", OBJ_LABEL, 0, 0, 0);
  141.    ObjectSetText("Copyright", "1000pips Club ?www.oasiswealthbuilders.com", 7, "Arial Bold", Yellow);
  142.    ObjectSet("Copyright", OBJPROP_CORNER, 3);
  143.    ObjectSet("Copyright", OBJPROP_XDISTANCE, 13);
  144.    ObjectSet("Copyright", OBJPROP_YDISTANCE, 5);
  145. }

  146. int symcolor(double ad_0) {
  147.    int li_ret_8;
  148.    if (ad_0 <= 2.0) li_ret_8 = 3937500;
  149.    if (ad_0 > 2.0) li_ret_8 = 16777215;
  150.    if (ad_0 >= 7.0) li_ret_8 = 65280;
  151.    return (li_ret_8);
  152. }

  153. void displayHiLo() {
  154.    string l_text_0;
  155.    string l_name_8;
  156.    string l_symbol_16;
  157.    double ld_24;
  158.    color l_color_32;
  159.    color l_color_36;
  160.    int l_y_40 = 47;
  161.    for (int l_index_44 = 0; l_index_44 < ArraySize(gsa_140); l_index_44++) {
  162.       l_symbol_16 = gsa_140[l_index_44];
  163.       l_symbol_16 = l_symbol_16 + gs_200;
  164.       l_name_8 = "Symbol " + gsa_140[l_index_44];
  165.       l_text_0 = gsa_140[l_index_44];
  166.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  167.       ObjectSetText(l_name_8, l_text_0, 8, "Arial Bold", Gray);
  168.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  169.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 157);
  170.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_40);
  171.       l_name_8 = "Spread " + l_symbol_16;
  172.       l_text_0 = DoubleToStr(MarketInfo(l_symbol_16, MODE_SPREAD), 0);
  173.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  174.       ObjectSetText(l_name_8, l_text_0, 8, "Arial", Yellow);
  175.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  176.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 125);
  177.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_40);
  178.       l_name_8 = "StrengthGap " + l_symbol_16;
  179.       ld_24 = MathAbs(currency_strength(StringSubstr(gsa_140[l_index_44], 0, 3)) - currency_strength(StringSubstr(gsa_140[l_index_44], 3, 3)));
  180.       if (ld_24 >= StrengthGap) l_color_32 = Lime;
  181.       else l_color_32 = Red;
  182.       l_text_0 = DoubleToStr(ld_24, 2);
  183.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  184.       ObjectSetText(l_name_8, l_text_0, 8, "Arial", l_color_32);
  185.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  186.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 75);
  187.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_40);
  188.       l_name_8 = "HiLo " + l_symbol_16;
  189.       l_text_0 = DoubleToStr((iHigh(l_symbol_16, PERIOD_D1, 0) - iLow(l_symbol_16, PERIOD_D1, 0)) / MarketInfo(l_symbol_16, MODE_POINT), 0);
  190.       if (Daily_AVG(l_symbol_16) > (iHigh(l_symbol_16, PERIOD_D1, 0) - iLow(l_symbol_16, PERIOD_D1, 0)) / MarketInfo(l_symbol_16, MODE_POINT)) l_color_36 = Lime;
  191.       else l_color_36 = Crimson;
  192.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  193.       ObjectSetText(l_name_8, l_text_0, 8, "Arial", l_color_36);
  194.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  195.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 41);
  196.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_40);
  197.       l_name_8 = "HiLo-AV " + l_symbol_16;
  198.       l_text_0 = DoubleToStr(Daily_AVG(l_symbol_16), 0);
  199.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  200.       ObjectSetText(l_name_8, l_text_0, 8, "Arial", White);
  201.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  202.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 10);
  203.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_40);
  204.       l_y_40 += 12;
  205.    }
  206.    ObjectCreate("HiLo Line", OBJ_LABEL, 0, 0, 0);
  207.    ObjectSetText("HiLo Line", "________________________________", 8, "Arial Bold", White);
  208.    ObjectSet("HiLo Line", OBJPROP_CORNER, 3);
  209.    ObjectSet("HiLo Line", OBJPROP_XDISTANCE, 10);
  210.    ObjectSet("HiLo Line", OBJPROP_YDISTANCE, l_y_40 + 1);
  211.    ObjectCreate("HiLo Title", OBJ_LABEL, 0, 0, 0);
  212.    ObjectSetText("HiLo Title", "PAIRS     SPREAD  RANGE  HiLo  D-Av", 8, "Arial Bold", White);
  213.    ObjectSet("HiLo Title", OBJPROP_CORNER, 3);
  214.    ObjectSet("HiLo Title", OBJPROP_XDISTANCE, 10);
  215.    ObjectSet("HiLo Title", OBJPROP_YDISTANCE, l_y_40 + 2);
  216. }

  217. int Daily_AVG(string a_symbol_0) {
  218.    int li_8 = 0;
  219.    int li_12 = 0;
  220.    int li_16 = 0;
  221.    int li_20 = 0;
  222.    int li_ret_24 = 0;
  223.    int li_28 = 0;
  224.    li_8 = (iHigh(a_symbol_0, PERIOD_D1, 1) - iLow(a_symbol_0, PERIOD_D1, 1)) / MarketInfo(a_symbol_0, MODE_POINT);
  225.    for (li_28 = 1; li_28 <= 5; li_28++) li_12 = li_12 + (iHigh(a_symbol_0, PERIOD_D1, li_28) - iLow(a_symbol_0, PERIOD_D1, li_28)) / MarketInfo(a_symbol_0, MODE_POINT);
  226.    for (li_28 = 1; li_28 <= 10; li_28++) li_16 = li_16 + (iHigh(a_symbol_0, PERIOD_D1, li_28) - iLow(a_symbol_0, PERIOD_D1, li_28)) / MarketInfo(a_symbol_0, MODE_POINT);
  227.    for (li_28 = 1; li_28 <= 20; li_28++) li_20 = li_20 + (iHigh(a_symbol_0, PERIOD_D1, li_28) - iLow(a_symbol_0, PERIOD_D1, li_28)) / MarketInfo(a_symbol_0, MODE_POINT);
  228.    li_12 /= 5;
  229.    li_16 /= 10;
  230.    li_20 /= 20;
  231.    li_ret_24 = (li_8 + li_12 + li_16 + li_20) / 4;
  232.    return (li_ret_24);
  233. }

  234. void showCSLocation() {
  235.    string l_text_0;
  236.    string l_name_8;
  237.    double l_iopen_16;
  238.    double l_iclose_24;
  239.    color l_color_32;
  240.    string l_symbol_36;
  241.    int l_y_44 = 47;
  242.    for (int l_index_48 = 0; l_index_48 < ArraySize(gsa_140); l_index_48++) {
  243.       l_symbol_36 = gsa_140[l_index_48];
  244.       l_symbol_36 = l_symbol_36 + gs_200;
  245.       l_iopen_16 = iOpen(l_symbol_36, PERIOD_M15, 0);
  246.       l_iclose_24 = iClose(l_symbol_36, PERIOD_M15, 0);
  247.       SymFiboPivot(l_symbol_36);
  248.       if (l_iclose_24 > gd_192) {
  249.          l_text_0 = ">R3";
  250.          l_color_32 = Lime;
  251.       }
  252.       if (l_iclose_24 < gd_192) {
  253.          l_text_0 = "R2-R3";
  254.          l_color_32 = Green;
  255.       }
  256.       if (l_iclose_24 < gd_184) {
  257.          l_text_0 = "R1-R2";
  258.          l_color_32 = DarkGreen;
  259.       }
  260.       if (l_iclose_24 < gd_176) {
  261.          l_text_0 = "Piv-R1";
  262.          l_color_32 = DimGray;
  263.       }
  264.       if (l_iclose_24 < gd_144) {
  265.          l_text_0 = "S1-Piv";
  266.          l_color_32 = DimGray;
  267.       }
  268.       if (l_iclose_24 < gd_152) {
  269.          l_text_0 = "S2-S1";
  270.          l_color_32 = Maroon;
  271.       }
  272.       if (l_iclose_24 < gd_160) {
  273.          l_text_0 = "S3-S2";
  274.          l_color_32 = Crimson;
  275.       }
  276.       if (l_iclose_24 < gd_168) {
  277.          l_text_0 = "<S3";
  278.          l_color_32 = Red;
  279.       }
  280.       if (l_iopen_16 < gd_192 && l_iclose_24 >= gd_192) {
  281.          l_text_0 = "X R3";
  282.          l_color_32 = Fuchsia;
  283.       }
  284.       if (l_iopen_16 < gd_184 && l_iclose_24 >= gd_184) {
  285.          l_text_0 = "X R2";
  286.          l_color_32 = Fuchsia;
  287.       }
  288.       if (l_iopen_16 < gd_176 && l_iclose_24 >= gd_176) {
  289.          l_text_0 = "X R1";
  290.          l_color_32 = Fuchsia;
  291.       }
  292.       if (l_iopen_16 > gd_152 && l_iclose_24 <= gd_152) {
  293.          l_text_0 = "X S1";
  294.          l_color_32 = Fuchsia;
  295.       }
  296.       if (l_iopen_16 > gd_160 && l_iclose_24 <= gd_160) {
  297.          l_text_0 = "X S2";
  298.          l_color_32 = Fuchsia;
  299.       }
  300.       if (l_iopen_16 > gd_168 && l_iclose_24 <= gd_168) {
  301.          l_text_0 = "X S3";
  302.          l_color_32 = Fuchsia;
  303.       }
  304.       l_name_8 = "Status " + l_symbol_36;
  305.       ObjectCreate(l_name_8, OBJ_LABEL, 0, 0, 0);
  306.       ObjectSetText(l_name_8, l_text_0, 8, "Arial Bold", l_color_32);
  307.       ObjectSet(l_name_8, OBJPROP_CORNER, 3);
  308.       ObjectSet(l_name_8, OBJPROP_XDISTANCE, 210);
  309.       ObjectSet(l_name_8, OBJPROP_YDISTANCE, l_y_44);
  310.       l_y_44 += 12;
  311.    }
  312.    ObjectCreate("StatusTitle", OBJ_LABEL, 0, 0, 0);
  313.    ObjectSetText("StatusTitle", "M15", 8, "Arial Bold", White);
  314.    ObjectSet("StatusTitle", OBJPROP_CORNER, 3);
  315.    ObjectSet("StatusTitle", OBJPROP_XDISTANCE, 210);
  316.    ObjectSet("StatusTitle", OBJPROP_YDISTANCE, l_y_44);
  317. }

  318. void SymFiboPivot(string a_symbol_0) {
  319.    double lda_8[1][6];
  320.    double ld_12;
  321.    double ld_20;
  322.    double ld_28;
  323.    ArrayCopyRates(lda_8, a_symbol_0, PERIOD_D1);
  324.    if (DayOfWeek() == 1) {
  325.       if (TimeDayOfWeek(iTime(a_symbol_0, PERIOD_D1, 1)) == 5) {
  326.          ld_12 = lda_8[1][4];
  327.          ld_20 = lda_8[1][3];
  328.          ld_28 = lda_8[1][2];
  329.       } else {
  330.          for (int li_36 = 5; li_36 >= 0; li_36--) {
  331.             if (TimeDayOfWeek(iTime(a_symbol_0, PERIOD_D1, li_36)) == 5) {
  332.                ld_12 = lda_8[li_36][4];
  333.                ld_20 = lda_8[li_36][3];
  334.                ld_28 = lda_8[li_36][2];
  335.             }
  336.          }
  337.       }
  338.    } else {
  339.       ld_12 = lda_8[1][4];
  340.       ld_20 = lda_8[1][3];
  341.       ld_28 = lda_8[1][2];
  342.    }
  343.    double ld_40 = ld_20 - ld_28;
  344.    gd_144 = (ld_20 + ld_28 + ld_12) / 3.0;
  345.    gd_192 = gd_144 + 1.0 * ld_40;
  346.    gd_184 = gd_144 + 0.618 * ld_40;
  347.    gd_176 = gd_144 + ld_40 / 2.0;
  348.    gd_152 = gd_144 - ld_40 / 2.0;
  349.    gd_160 = gd_144 - 0.618 * ld_40;
  350.    gd_168 = gd_144 - 1.0 * ld_40;
  351. }

  352. void showSnRDist() {
  353.    string l_text_0;
  354.    string l_text_8;
  355.    double ld_16;
  356.    double ld_24;
  357.    color l_color_32;
  358.    string l_symbol_36;
  359.    double l_iclose_44;
  360.    string l_name_52;
  361.    string lsa_60[] = {"GBPJPY", "GBPUSD", "EURJPY"};
  362.    int l_y_64 = 30;
  363.    RefreshRates();
  364.    for (int l_index_68 = 0; l_index_68 < ArraySize(lsa_60); l_index_68++) {
  365.       l_symbol_36 = lsa_60[l_index_68];
  366.       l_symbol_36 = l_symbol_36 + gs_200;
  367.       l_iclose_44 = iClose(l_symbol_36, 0, 0);
  368.       SymFiboPivot(l_symbol_36);
  369.       if (l_iclose_44 >= gd_192) {
  370.          ld_16 = (l_iclose_44 - gd_192) / MarketInfo(l_symbol_36, MODE_POINT);
  371.          l_text_0 = DoubleToStr(ld_16, 0) + "pips > R3";
  372.          l_text_8 = "";
  373.       }
  374.       if (l_iclose_44 < gd_192 && l_iclose_44 >= gd_184) {
  375.          ld_16 = (gd_192 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  376.          ld_24 = (l_iclose_44 - gd_184) / MarketInfo(l_symbol_36, MODE_POINT);
  377.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < R3";
  378.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > R2";
  379.       }
  380.       if (l_iclose_44 < gd_184 && l_iclose_44 >= gd_176) {
  381.          ld_16 = (gd_184 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  382.          ld_24 = (l_iclose_44 - gd_176) / MarketInfo(l_symbol_36, MODE_POINT);
  383.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < R2";
  384.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > R1";
  385.       }
  386.       if (l_iclose_44 < gd_176 && l_iclose_44 >= gd_144) {
  387.          ld_16 = (gd_176 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  388.          ld_24 = (l_iclose_44 - gd_144) / MarketInfo(l_symbol_36, MODE_POINT);
  389.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < R1";
  390.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > Piv";
  391.       }
  392.       if (l_iclose_44 < gd_144 && l_iclose_44 >= gd_152) {
  393.          ld_16 = (gd_144 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  394.          ld_24 = (l_iclose_44 - gd_152) / MarketInfo(l_symbol_36, MODE_POINT);
  395.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < Piv";
  396.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > S1";
  397.       }
  398.       if (l_iclose_44 < gd_152 && l_iclose_44 >= gd_160) {
  399.          ld_16 = (gd_152 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  400.          ld_24 = (l_iclose_44 - gd_160) / MarketInfo(l_symbol_36, MODE_POINT);
  401.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < S1";
  402.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > S2";
  403.       }
  404.       if (l_iclose_44 < gd_160 && l_iclose_44 >= gd_168) {
  405.          ld_16 = (gd_160 - l_iclose_44) / MarketInfo(l_symbol_36, MODE_POINT);
  406.          ld_24 = (l_iclose_44 - gd_168) / MarketInfo(l_symbol_36, MODE_POINT);
  407.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < S2";
  408.          l_text_8 = DoubleToStr(ld_24, 0) + "pips > S3";
  409.       }
  410.       if (l_iclose_44 < gd_168) {
  411.          ld_16 = (l_iclose_44 - gd_168) / MarketInfo(l_symbol_36, MODE_POINT);
  412.          l_text_0 = DoubleToStr(ld_16, 0) + "pips < S3";
  413.          l_text_8 = "";
  414.       }
  415.       l_name_52 = "SnRPairName" + l_symbol_36;
  416.       ObjectCreate(l_name_52, OBJ_LABEL, 0, 0, 0);
  417.       ObjectSetText(l_name_52, l_symbol_36, 8, "Arial Bold", Gray);
  418.       ObjectSet(l_name_52, OBJPROP_CORNER, 1);
  419.       ObjectSet(l_name_52, OBJPROP_XDISTANCE, 170);
  420.       ObjectSet(l_name_52, OBJPROP_YDISTANCE, l_y_64);
  421.       l_name_52 = "SnRDist1" + l_symbol_36;
  422.       l_color_32 = SnRDistColor(ld_16);
  423.       ObjectCreate(l_name_52, OBJ_LABEL, 0, 0, 0);
  424.       ObjectSetText(l_name_52, l_text_0, 8, "Arial Bold", l_color_32);
  425.       ObjectSet(l_name_52, OBJPROP_CORNER, 1);
  426.       ObjectSet(l_name_52, OBJPROP_XDISTANCE, 90);
  427.       ObjectSet(l_name_52, OBJPROP_YDISTANCE, l_y_64);
  428.       l_color_32 = SnRDistColor(ld_24);
  429.       l_name_52 = "SnRDist2" + l_symbol_36;
  430.       ObjectCreate(l_name_52, OBJ_LABEL, 0, 0, 0);
  431.       ObjectSetText(l_name_52, l_text_8, 8, "Arial Bold", l_color_32);
  432.       ObjectSet(l_name_52, OBJPROP_CORNER, 1);
  433.       ObjectSet(l_name_52, OBJPROP_XDISTANCE, 10);
  434.       ObjectSet(l_name_52, OBJPROP_YDISTANCE, l_y_64);
  435.       l_y_64 += 10;
  436.    }
  437. }

  438. int SnRDistColor(int ai_0) {
  439.    int li_ret_4;
  440.    if (ai_0 > 10) li_ret_4 = 16777215;
  441.    if (ai_0 < 11) li_ret_4 = 13688896;
  442.    return (li_ret_4);
  443. }

  444. void displayCandleDirection() {
  445.    color l_color_0;
  446.    color l_color_4;
  447.    string l_text_8;
  448.    string l_text_16;
  449.    string l_symbol_24;
  450.    double l_iopen_32;
  451.    double l_iclose_40;
  452.    double l_iopen_48;
  453.    double l_iclose_56;
  454.    string l_name_64;
  455.    int l_y_72 = 85;
  456.    for (int li_76 = ArraySize(gsa_140) - 1; li_76 > -1; li_76--) {
  457.       l_symbol_24 = gsa_140[li_76];
  458.       l_symbol_24 = l_symbol_24 + gs_200;
  459.       l_iopen_32 = iOpen(l_symbol_24, PERIOD_M15, 0);
  460.       l_iclose_40 = iClose(l_symbol_24, PERIOD_M15, 0);
  461.       l_iopen_48 = iOpen(l_symbol_24, PERIOD_H1, 0);
  462.       l_iclose_56 = iClose(l_symbol_24, PERIOD_H1, 0);
  463.       if (l_iopen_32 < l_iclose_40) {
  464.          l_text_8 = "?;
  465.          l_color_0 = Lime;
  466.       } else {
  467.          l_text_8 = "?;
  468.          l_color_0 = Red;
  469.       }
  470.       if (l_iopen_48 < l_iclose_56) {
  471.          l_text_16 = "?;
  472.          l_color_4 = Lime;
  473.       } else {
  474.          l_text_16 = "?;
  475.          l_color_4 = Red;
  476.       }
  477.       l_name_64 = "CandleDirection " + gsa_140[li_76];
  478.       ObjectCreate(l_name_64, OBJ_LABEL, 0, 0, 0);
  479.       ObjectSetText(l_name_64, gsa_140[li_76], 8, "Arial Bold", Gray);
  480.       ObjectSet(l_name_64, OBJPROP_CORNER, 1);
  481.       ObjectSet(l_name_64, OBJPROP_XDISTANCE, 55);
  482.       ObjectSet(l_name_64, OBJPROP_YDISTANCE, l_y_72);
  483.       l_name_64 = "Candle_M15 " + gsa_140[li_76];
  484.       ObjectCreate(l_name_64, OBJ_LABEL, 0, 0, 0);
  485.       ObjectSetText(l_name_64, l_text_8, 8, "Wingdings", l_color_0);
  486.       ObjectSet(l_name_64, OBJPROP_CORNER, 1);
  487.       ObjectSet(l_name_64, OBJPROP_XDISTANCE, 30);
  488.       ObjectSet(l_name_64, OBJPROP_YDISTANCE, l_y_72);
  489.       l_name_64 = "Candle_H1" + gsa_140[li_76];
  490.       ObjectCreate(l_name_64, OBJ_LABEL, 0, 0, 0);
  491.       ObjectSetText(l_name_64, l_text_16, 8, "Wingdings", l_color_4);
  492.       ObjectSet(l_name_64, OBJPROP_CORNER, 1);
  493.       ObjectSet(l_name_64, OBJPROP_XDISTANCE, 10);
  494.       ObjectSet(l_name_64, OBJPROP_YDISTANCE, l_y_72);
  495.       l_y_72 += 12;
  496.    }
  497.    ObjectCreate("CandleDirection", OBJ_LABEL, 0, 0, 0);
  498.    ObjectSetText("CandleDirection", "M15  H1", 8, "Arial Bold", White);
  499.    ObjectSet("CandleDirection", OBJPROP_CORNER, 1);
  500.    ObjectSet("CandleDirection", OBJPROP_XDISTANCE, 5);
  501.    ObjectSet("CandleDirection", OBJPROP_YDISTANCE, 72);
  502. }

  503. void displayCandleTime() {
  504.    int li_0 = Time[0] + 60 * Period() - TimeCurrent();
  505.    double ld_4 = li_0 / 60.0;
  506.    int li_12 = li_0 % 60;
  507.    li_0 = (li_0 - li_0 % 60) / 60;
  508.    ObjectDelete("CandleClock");
  509.    if (ObjectFind("CandleClock") != 0) {
  510.       ObjectCreate("CandleClock", OBJ_TEXT, 0, Time[0], Close[0] + 0.0005);
  511.       ObjectSetText("CandleClock", "                  < " + li_0 + ":" + li_12, 10, "Comic Sans MS", Yellow);
  512.       return;
  513.    }
  514.    ObjectMove("CandleClock", 0, Time[0], Close[0] + 0.0005);
  515. }

  516. void drawFiboPiv() {
  517.    SymFiboPivot(Symbol());
  518.    drawLine(gd_192, "R3", Lime, 0);
  519.    drawLabel("Resistance 3", gd_192, Lime);
  520.    drawLine(gd_184, "R2", Green, 0);
  521.    drawLabel("Resistance 2", gd_184, Green);
  522.    drawLine(gd_176, "R1", DarkGreen, 0);
  523.    drawLabel("Resistance 1", gd_176, DarkGreen);
  524.    drawLine(gd_144, "PIVOT", Blue, 1);
  525.    drawLabel("Pivot level", gd_144, Blue);
  526.    drawLine(gd_152, "S1", Maroon, 0);
  527.    drawLabel("Support 1", gd_152, Maroon);
  528.    drawLine(gd_160, "S2", Crimson, 0);
  529.    drawLabel("Support 2", gd_160, Crimson);
  530.    drawLine(gd_168, "S3", Red, 0);
  531.    drawLabel("Support 3", gd_168, Red);
  532. }

  533. void drawLabel(string a_name_0, double a_price_8, color a_color_16) {
  534.    if (ObjectFind(a_name_0) != 0) {
  535.       ObjectCreate(a_name_0, OBJ_TEXT, 0, Time[10], a_price_8);
  536.       ObjectSetText(a_name_0, a_name_0, 8, "Arial", CLR_NONE);
  537.       ObjectSet(a_name_0, OBJPROP_COLOR, a_color_16);
  538.       return;
  539.    }
  540.    ObjectMove(a_name_0, 0, Time[10], a_price_8);
  541. }

  542. void drawLine(double a_price_0, string a_name_8, color a_color_16, int ai_20) {
  543.    if (ObjectFind(a_name_8) != 0) {
  544.       ObjectCreate(a_name_8, OBJ_HLINE, 0, Time[0], a_price_0, Time[0], a_price_0);
  545.       if (ai_20 == 1) ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_SOLID);
  546.       else ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_DOT);
  547.       ObjectSet(a_name_8, OBJPROP_COLOR, a_color_16);
  548.       ObjectSet(a_name_8, OBJPROP_WIDTH, 1);
  549.       return;
  550.    }
  551.    ObjectDelete(a_name_8);
  552.    ObjectCreate(a_name_8, OBJ_HLINE, 0, Time[0], a_price_0, Time[0], a_price_0);
  553.    if (ai_20 == 1) ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_SOLID);
  554.    else ObjectSet(a_name_8, OBJPROP_STYLE, STYLE_DOT);
  555.    ObjectSet(a_name_8, OBJPROP_COLOR, a_color_16);
  556.    ObjectSet(a_name_8, OBJPROP_WIDTH, 1);
  557. }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2015-7-5 18:12 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2015-7-7 13:22 | 显示全部楼层

谢谢分享。。。。
韬客官方汇友超级群韬客官方汇友交流群 韬客官方汇友交流群1(满)韬客官方汇友交流群-1 韬客金融行业内部群韬客官方金融行业交流
回复 支持 反对

使用道具 举报

发表于 2015-11-1 06:44 | 显示全部楼层
听名字好牛*
论坛谏言--外汇交易不应是你投资的全部,交易外汇也不应是你生活的全部
回复 支持 反对

使用道具 举报

发表于 2016-12-7 18:19 | 显示全部楼层
谢楼主的分享
回复 支持 反对

使用道具 举报

发表于 2017-6-19 09:26 | 显示全部楼层
99999999999
回复 支持 反对

使用道具 举报

发表于 2017-6-19 12:47 | 显示全部楼层
666666
韬客官方汇友超级群韬客官方汇友交流群 韬客官方汇友交流群1(满)韬客官方汇友交流群-1 韬客金融行业内部群韬客官方金融行业交流
回复 支持 反对

使用道具 举报

发表于 2017-6-29 16:16 | 显示全部楼层
谢谢分享
回复 支持 反对

使用道具 举报

发表于 2017-8-7 15:08 | 显示全部楼层
谢谢分享~~~~~~~~~~~
回复 支持 反对

使用道具 举报

发表于 2017-11-25 10:57 | 显示全部楼层
谢谢分享
韬客官方汇友超级群韬客官方汇友交流群 韬客官方汇友交流群1(满)韬客官方汇友交流群-1 韬客金融行业内部群韬客官方金融行业交流
回复 支持 反对

使用道具 举报

发表于 2018-1-5 23:46 | 显示全部楼层
谢谢分享
韬客官方汇友超级群韬客官方汇友交流群 韬客官方汇友交流群1(满)韬客官方汇友交流群-1 韬客金融行业内部群韬客官方金融行业交流
回复 支持 反对

使用道具 举报

发表于 2018-1-14 12:32 | 显示全部楼层
感谢分享
回复 支持 反对

使用道具 举报

发表于 2018-2-12 18:32 | 显示全部楼层
极速版本
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

论坛导航|手机版|小黑屋|

GMT+8, 2018-2-25 21:14 , Processed in 0.161312 second(s), 22 queries , Gzip On.

本站免责声明:

1、本站所有广告及宣传信息均与韬客无关,如需投资请依法自行决定是否投资、斟酌资金安全及交易亏损风险;
2、韬客是独立的、仅为投资者提供交流的平台,网友发布信息不代表韬客的观点与意思表示,所有因网友发布的信息而造成的任何法律后果、风险与责任,均与韬客无关;
3、金融交易存在极高法律风险,未必适合所有投资者,请不要轻信任何高额投资收益的诱导而贸然投资;投资保证金交易导致的损失可能超过您投入的资金和预期。请您考虑自身的投资经验及风险承担能力,进行合法、理性投资;
4、所有投资者的交易帐户应仅限本人使用,不应交由第三方操作,对于任何接受第三方喊单、操盘、理财等操作的投资和交易,由此导致的任何风险、亏损及责任由投资者个人自行承担;
5、韬客不隶属于任何券商平台,亦不受任何第三方控制,韬客不邀约客户投资任何保证金交易,不接触亦不涉及投资者的任何资金及账户信息,不代理任何交易操盘行为,不向客户推荐任何券商平台,亦不存在其他任何推荐行为。投资者应自行选择券商平台,券商平台的任何行为均与韬客无关。
投资者注册及使用韬客即表示其接受和认可上述声明,并自行承担法律风险。

  • 韬客TAKL

    微信关注韬客TAKL
    获得新鲜资讯