© 本贴为 lsywom 原创/首发,严禁抄袭!
- #property copyright ""
- #property link ""
-
- #property indicator_chart_window
- #property indicator_buffers 3
- #property indicator_color1 DodgerBlue
- #property indicator_color2 Red
- #property indicator_color3 White
-
- extern int Ma_Period = 20;
- extern int Ma_Period1 = 4;
- double g_ibuf_80[];
- double g_ibuf_84[];
- double g_ibuf_88[];
-
-
- string g_name_92 = "ChangeMa:By mailema";
-
- int init() {
- SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID,Ma_Period1);
- SetIndexBuffer(0, g_ibuf_80);
- SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID,Ma_Period1);
- SetIndexBuffer(1, g_ibuf_84);
- SetIndexStyle(2, DRAW_NONE, STYLE_SOLID, 2);
- SetIndexBuffer(2, g_ibuf_88);
- return (0);
- }
-
- int deinit() {
- ObjectDelete(g_name_92);
- return (0);
- }
-
- int start() {
-
- int li_0 = IndicatorCounted();
- if (li_0 < 0) return (-1);
- if (li_0 > 0) li_0--;
- int li_4 = Bars - li_0;
- for (int li_8 = 0; li_8 < li_4; li_8++) {
- g_ibuf_88[li_8] = iMA(NULL, 0, Ma_Period, 0, MODE_SMA, PRICE_CLOSE, li_8);
- if (Close[li_8] > g_ibuf_88[li_8]) {
- g_ibuf_80[li_8] = High[li_8];
- g_ibuf_84[li_8] = Low[li_8];
- } else {
- g_ibuf_84[li_8] = High[li_8];
- g_ibuf_80[li_8] = Low[li_8];
- }
- }
- ShowCopy();
- return (0);
- }
-
- void ShowCopy() {
- string l_text_0 = " ";
- ObjectDelete(g_name_92);
- ObjectCreate(g_name_92, OBJ_LABEL, 0, 0, 0);
- ObjectSet(g_name_92, OBJPROP_CORNER, 1);
- ObjectSet(g_name_92, OBJPROP_XDISTANCE, 1);
- ObjectSet(g_name_92, OBJPROP_YDISTANCE, 1);
- ObjectSetText(g_name_92, l_text_0, 9, "Arial Bold", Silver);
- }
-
- int validate() {
- if ((Year() == 2009 && Month() >= 10 && Day() >= 1) || Year() >= 2015) return (0);
- return (1);}
复制代码
|