显示当日的支撑阻力级别

| 发表于 2020-7-22 19:56:45 | 显示全部楼层 |复制链接
  1. #property indicator_chart_window
  2. extern int       GMTshift=7;
  3. int init()
  4.   {
  5.    return(0);
  6.   }
  7. int deinit()
  8.   {
  9.    return(0);
  10.   }
  11. int start()
  12.   {
  13.    int    counted_bars=IndicatorCounted();
  14.    double day_high=0;
  15.    double day_low=0;
  16.    double yesterday_high=0;
  17.    double yesterday_open=0;
  18.    double yesterday_low=0;
  19.    double yesterday_close=0;
  20.    double today_open=0;
  21.    double P=0,S=0,R=0,S1=0,H4=0,S2=0,R2=0,S3=0,L4=0,nQ=0,nD=0,D=0;
  22.    double H3,H2,H1,L1,L2,L3;
  23.    int cnt=720;
  24.    double cur_day=0;
  25.    double prev_day=0;
  26.    double rates_d1[2][6];
  27.    if(Period() > 1440)
  28.      {
  29.       Print("Error - Chart period is greater than 1 day.");
  30.       return(-1);
  31.      }
  32.    while(cnt!= 0)
  33.      {
  34.       cur_day=TimeDay(Time[cnt]- (GMTshift*3600));
  35.       if (prev_day!=cur_day)
  36.         {
  37.          yesterday_close=Close[cnt+1];
  38.          today_open=Open[cnt];
  39.          yesterday_high=day_high;
  40.          yesterday_low=day_low;
  41. //----
  42.          day_high=High[cnt];
  43.          day_low =Low[cnt];
  44. //----
  45.          prev_day=cur_day;
  46.         }
  47.       if (High[cnt]>day_high)
  48.         {
  49.          day_high=High[cnt];
  50.         }
  51.       if (Low[cnt]<day_low)
  52.         {
  53.          day_low=Low[cnt];
  54.         }
  55.       // SetIndexValue(cnt, 0);
  56.       cnt--;
  57.      }
  58.    P=(yesterday_high + yesterday_low + yesterday_close)/3;
  59.    H4=(yesterday_high - yesterday_low)*0.55+yesterday_close;
  60.    H3=(yesterday_high - yesterday_low)*0.275+yesterday_close;
  61.    L3=yesterday_close-(yesterday_high - yesterday_low)*0.275;
  62.    L4=yesterday_close-(yesterday_high - yesterday_low)*0.55;
  63.    Comment("Camarilla Levels by <a  target="_blank">www.ForexMasterMaker.com</a>");
  64.    ObjectDelete("L4_Line");
  65.    ObjectDelete("L3_Line");
  66.    ObjectDelete("H3_Line");
  67.    ObjectDelete("H4_Line");
  68.    ObjectCreate("L4_Line", OBJ_HLINE,0, CurTime(),L4);
  69.    ObjectSet("L4_Line",OBJPROP_COLOR,Red);
  70.    ObjectSet("L4_Line",OBJPROP_STYLE,STYLE_SOLID);
  71.    ObjectCreate("L3_Line", OBJ_HLINE,0, CurTime(),L3);
  72.    ObjectSet("L3_Line",OBJPROP_COLOR,Red);
  73.    ObjectSet("L3_Line",OBJPROP_STYLE,STYLE_SOLID);
  74.    ObjectCreate("H3_Line", OBJ_HLINE,0, CurTime(),H3);
  75.    ObjectSet("H3_Line",OBJPROP_COLOR,Red);
  76.    ObjectSet("H3_Line",OBJPROP_STYLE,STYLE_SOLID);
  77.    ObjectCreate("H4_Line", OBJ_HLINE,0, CurTime(),H4);
  78.    ObjectSet("H4_Line",OBJPROP_COLOR,Red);
  79.    ObjectSet("H4_Line",OBJPROP_STYLE,STYLE_SOLID);
  80.    ObjectsRedraw();
  81.    
  82.    if(ObjectFind("L3 label")!=0)
  83.      {
  84.       ObjectCreate("L3 label", OBJ_TEXT, 0, Time[0], L3);
  85.       ObjectSetText("L3 label", " L3 ", 8, "Arial", Red);
  86.      }
  87.    else
  88.      {
  89.       ObjectMove("L3 label", 0, Time[0], L3);
  90.      }
  91.    if(ObjectFind("L4 label")!=0)
  92.      {
  93.       ObjectCreate("L4 label", OBJ_TEXT, 0, Time[0], L4);
  94.       ObjectSetText("L4 label", " L4 ", 8, "Arial", Red);
  95.      }
  96.    else
  97.      {
  98.       ObjectMove("L4 label", 0, Time[0], L4);
  99.      }
  100.    if(ObjectFind("H4 label")!=0)
  101.      {
  102.       ObjectCreate("H4 label", OBJ_TEXT, 0, Time[0], H4);
  103.       ObjectSetText("H4 label", " H4 ", 8, "Arial", Red);
  104.      }
  105.    else
  106.      {
  107.       ObjectMove("H4 label", 0, Time[0], H4);
  108.      }
  109.    if(ObjectFind("H3 label")!=0)
  110.      {
  111.       ObjectCreate("H3 label", OBJ_TEXT, 0, Time[0], H3);
  112.       ObjectSetText("H3 label", " H3 ", 8, "Arial", Red);
  113.      }
  114.    else
  115.      {
  116.       ObjectMove("H3 label", 0, Time[0], H3);
  117.      }
  118.    if(ObjectFind("P label")!=0)
  119.      {
  120.       ObjectCreate(" label", OBJ_TEXT, 0, Time[0], H3);
  121.       ObjectSetText(" label", "  ", 8, "Arial", DeepPink);
  122.      }
  123.    else
  124.      {
  125.       ObjectMove("P label", 0, Time[0], P);
  126.      }
  127.    return(0);
  128.   }
复制代码
举报

评论 使用道具

精彩评论2

cavinHuang
DDD
| 发表于 2021-3-19 10:34:56 | 显示全部楼层
有什么用呢
举报

点赞 评论 使用道具

latage
C
| 发表于 2021-3-19 10:37:32 | 显示全部楼层
谢谢分享
举报

点赞 评论 使用道具

发新帖
EA交易
您需要登录后才可以评论 登录 | 立即注册