18评论

1收藏

TrillionStrategySessions

avatar admin | 2226 人阅读 | 18 人评论 | 2018-01-19

GBPUSDH1.png

  1. //+-------------------------------------------------------------------+
  2. //|                                                                   |
  3. //|                       Copyright ?2004, MetaQuotes Software Corp. |
  4. //|                                         http://www.metaquotes.net |
  5. //|                  tweaked by accrete at accrete.com                |
  6. //+-------------------------------------------------------------------+
  7. #property copyright "Copyright ?2004, MetaQuotes Software Corp."
  8. #property link      "http://www.metaquotes.net"

  9. #property indicator_chart_window

  10. extern int Time_Shift=0;//set to = 16:00 New York on your broker feed

  11. extern bool Previous_Session_H_M_L = true;
  12. extern bool Show_Yesterdays_Close = false;
  13. extern bool Show_Yesterdays_Open = false;

  14. extern color        LineColorOpen        =CornflowerBlue;
  15. extern int Line_Width_Open  =2;
  16. extern color   LineColorClose = SandyBrown;
  17. extern int Line_Width_Close  =2;


  18. double Session_HML=0;
  19. double day_high=0;
  20. double day_low=0;
  21. double yesterday_high=0;
  22. double yesterday_open=0;
  23. double yesterday_low=0;
  24. double yesterday_close=0;
  25. double today_open=0;
  26. double today_high=0;
  27. double today_low=0;
  28. double P=0;//Prior Session Open
  29. double Q=0;
  30. double Y1; //Prior Session Close
  31. double R1,R2,R3;
  32. double M0,M1,M2,M3,M4,M5;
  33. double S1,S2,S3;
  34. double HBu6,HBu5,HBu4,HBu3,HBu2,HBu1;
  35. double HBd6,HBd5,HBd4,HBd3,HBd2,HBd1;
  36. double L4,L3;
  37. double nQ=0;
  38. double nD=0;
  39. double D=0;
  40. double rates_h1[2][6];
  41. double rates_d1[2][6];

  42. //+------------------------------------------------------------------+
  43. //| Custom indicator initialization function                         |
  44. //+------------------------------------------------------------------+
  45. int init()
  46.   {
  47. //---- indicators
  48. R1=0; R2=0; R3=0;
  49. M0=0; M1=0; M2=0; M3=0; M4=0; M5=0;
  50. S1=0; S2=0; S3=0;
  51. HBu6=0; HBu5=0; HBu4=0; HBu3=0; HBu2=0; HBu1=0;
  52. HBd6=0; HBd5=0; HBd4=0; HBd3=0; HBd2=0; HBd1=0;
  53. L4=0; L3=0;
  54. Y1=0;


  55. //----
  56.    return(0);
  57.   }
  58. //+------------------------------------------------------------------+
  59. //| Custor indicator deinitialization function                       |
  60. //+------------------------------------------------------------------+
  61. int deinit()
  62.   {
  63. //---- TODO: add your code here
  64. ObjectDelete("R1 Label");
  65. ObjectDelete("R1 Line");
  66. ObjectDelete("R2 Label");
  67. ObjectDelete("R2 Line");
  68. ObjectDelete("R3 Label");
  69. ObjectDelete("R3 Line");
  70. ObjectDelete("S1 Label");
  71. ObjectDelete("S1 Line");
  72. ObjectDelete("S2 Label");
  73. ObjectDelete("S2 Line");
  74. ObjectDelete("S3 Label");
  75. ObjectDelete("S3 Line");
  76. ObjectDelete("P Label");
  77. ObjectDelete("P Line");
  78. ObjectDelete("Y1 Label");
  79. ObjectDelete("Y1 Line");




  80. ObjectDelete("L3 Label");
  81. ObjectDelete("L3 Line");
  82. ObjectDelete("L4 Label");
  83. ObjectDelete("L4 Line");
  84. ObjectDelete("M5 Label");
  85. ObjectDelete("M5 Line");
  86. ObjectDelete("M4 Label");
  87. ObjectDelete("M4 Line");
  88. ObjectDelete("M3 Label");
  89. ObjectDelete("M3 Line");
  90. ObjectDelete("M2 Label");
  91. ObjectDelete("M2 Line");
  92. ObjectDelete("M1 Label");
  93. ObjectDelete("M1 Line");
  94. ObjectDelete("M0 Label");
  95. ObjectDelete("M0 Line");
  96. //----
  97.    return(0);
  98.   }
  99. //+------------------------------------------------------------------+
  100. //| Custom indicator iteration function                              |
  101. //+------------------------------------------------------------------+
  102. int start()
  103.   {
  104.       int i=0, j=0;
  105. //---- TODO: add your code here

  106. //---- exit if period is greater than daily charts
  107. if(Period() > 1440)
  108. {
  109. Print("Error - Chart period is greater than 1 day.");
  110. return(-1); // then exit
  111. }

  112. //---- Get new daily prices

  113. ArrayCopyRates(rates_d1, Symbol(), PERIOD_D1);
  114. yesterday_high = rates_d1[1][3];
  115. yesterday_low = rates_d1[1][2];
  116. day_high = rates_d1[0][3];
  117. day_low = rates_d1[0][2];

  118. ArrayCopyRates(rates_h1, Symbol(), PERIOD_H1);
  119. for (i=0;i<=25;i++)
  120. {
  121.    if (TimeMinute(rates_h1[i][0])==0 && (TimeHour(rates_h1[i][0])-Time_Shift)==0)
  122.    {
  123.       yesterday_close = rates_h1[i+1][4];      
  124.       yesterday_open = rates_h1[i+24][1];
  125.       today_open = rates_h1[i][1];      
  126.       break;
  127.    }
  128. }

  129. //---- Calculate ATM_Pivots

  130. D = (day_high - day_low);
  131. Q = (yesterday_high - yesterday_low);
  132. // P = yesterday_close;
  133. R2 = yesterday_close+(Q*0.50);
  134. R1 = yesterday_close+(Q*0.35);
  135. S1 = yesterday_close-(Q*0.35);
  136. S2 = yesterday_close-(Q*0.50);
  137. //P = (yesterday_high + yesterday_low + yesterday_close) / 3; //original pivot code

  138. // Previous Days High, Median, and Low:
  139. M3 = (yesterday_high + yesterday_low)/2;
  140. M2 = yesterday_low;
  141. M1 = yesterday_high;
  142. P = yesterday_open;
  143. Y1 = yesterday_close;


  144. //H4 = (Q*0.55)+yesterday_close;
  145. // H3 = yesterday_close+(Q*0.125);
  146. //R3 = (2*P)+(yesterday_high-(2*yesterday_low));
  147.        
  148.         /*Original R/S code:
  149.         R1 = (2*P)-yesterday_low;
  150. S1 = (2*P)-yesterday_high;
  151. R2 = P+(yesterday_high - yesterday_low);
  152. S2 = P-(yesterday_high - yesterday_low);
  153. */
  154.        
  155.        
  156.        
  157. //M5 = (R2+R3)/2;
  158. //        R2 = P-S1+R1;
  159. //M4 = (R1+R2)/2;
  160. //        R1 = (2*P)-yesterday_low;
  161. //M3 = (P+R1)/2;
  162. //        P = (yesterday_high + yesterday_low + yesterday_close)/3;
  163. //M2 = (P+S1)/2;
  164. //        S1 = (2*P)-yesterday_high;
  165. //M1 = (S1+S2)/2;
  166. //        S2 = P-R1+S1;
  167. //S3 = (2*P)-((2* yesterday_high)-yesterday_low);
  168. //L3 = yesterday_close-(Q*0.27);       
  169. //L4 = yesterday_close-(Q*0.55);       
  170. //M0 = (S2+S3)/2;

  171. if (Q > 5)
  172. {
  173.         nQ = Q;
  174. }
  175. else
  176. {
  177.         nQ = Q*10000;
  178. }

  179. if (D > 5)
  180. {
  181.         nD = D;
  182. }
  183. else
  184. {
  185.         nD = D*10000;
  186. }
  187. //Comment("$TrillionStrategy           Prior Range = ",nQ,"        Current Range = ",nD, "\nSession Open = ", yesterday_open,"      Session Close = ",yesterday_close);

  188. //---- Set line labels on chart window


  189. //------ Midpoints ATM_Pivots

  190.    if (Previous_Session_H_M_L==true)
  191.    {

  192.       if(ObjectFind("M3 label") != 0)
  193.       {
  194.       ObjectCreate("M3 label", OBJ_TEXT, 0, CurTime(), M3);
  195.       ObjectSetText("M3 label", "                                              sM", 8, "Arial", Violet);
  196.       }
  197.       else
  198.       {
  199.       ObjectMove("M3 label", 0, CurTime(), M3);
  200.       }

  201.       if(ObjectFind("M2 label") != 0)
  202.       {
  203.       ObjectCreate("M2 label", OBJ_TEXT, 0, CurTime(), M2);
  204.       ObjectSetText("M2 label", "                                              sL", 8, "Arial", Red);
  205.       }
  206.       else
  207.       {
  208.       ObjectMove("M2 label", 0, CurTime(), M2);
  209.       }

  210.       if(ObjectFind("M1 label") != 0)
  211.       {
  212.       ObjectCreate("M1 label", OBJ_TEXT, 0, CurTime(), M1);
  213.       ObjectSetText("M1 label", "                                              sH", 8, "Arial", Lime);
  214.       }
  215.       else
  216.       {
  217.       ObjectMove("M1 label", 0, CurTime(), M1);
  218.       }
  219.    
  220.       if(ObjectFind("M3 line") != 0)
  221.       {
  222.       ObjectCreate("M3 line", OBJ_HLINE, 0, Time[40], M3);
  223.       ObjectSet("M3 line", OBJPROP_STYLE, STYLE_DASH);
  224.       ObjectSet("M3 line", OBJPROP_COLOR, Violet);
  225.       }
  226.       else
  227.       {
  228.       ObjectMove("M3 line", 0, Time[40], M3);
  229.       }

  230.       if(ObjectFind("M2 line") != 0)
  231.       {
  232.       ObjectCreate("M2 line", OBJ_HLINE, 0, Time[40], M2);
  233.       ObjectSet("M2 line", OBJPROP_STYLE, STYLE_DASH);
  234.       ObjectSet("M2 line", OBJPROP_COLOR, Red);
  235.       }
  236.       else
  237.       {
  238.       ObjectMove("M2 line", 0, Time[40], M2);
  239.       }

  240.       if(ObjectFind("M1 line") != 0)
  241.       {
  242.       ObjectCreate("M1 line", OBJ_HLINE, 0, Time[40], M1);
  243.       ObjectSet("M1 line", OBJPROP_STYLE, STYLE_DASH);
  244.       ObjectSet("M1 line", OBJPROP_COLOR, Lime);
  245.       }
  246.       else
  247.       {
  248.       ObjectMove("M1 line", 0, Time[40], M1);
  249.       }
  250. }

  251.     if (Show_Yesterdays_Close==true)
  252.    {
  253.            if(ObjectFind("P label") != 0)
  254.       {
  255.       ObjectCreate("P label", OBJ_TEXT, 0, CurTime(), P);
  256.       ObjectSetText("P label", "                       Open", 12, "Arial", LineColorOpen);
  257.       }
  258.       else
  259.       {
  260.       ObjectMove("P label", 0, CurTime(), P);
  261.       }   
  262.             if(ObjectFind("P line") != 0)
  263.       {
  264.       ObjectCreate("P line", OBJ_HLINE, 0, Time[40], P);
  265.       ObjectSet("P line", OBJPROP_STYLE, STYLE_SOLID);
  266.       ObjectSet("P line", OBJPROP_WIDTH, Line_Width_Open);
  267.       ObjectSet("P line", OBJPROP_COLOR, LineColorOpen);
  268.       }
  269.       else
  270.       {
  271.       ObjectMove("P line", 0, Time[40], P);
  272.       }  

  273. }
  274. //------ Show Yesterday's Open:

  275. if ( Show_Yesterdays_Open==true)
  276.    {
  277.            if(ObjectFind("Y1 label") != 0)
  278.       {
  279.       ObjectCreate("Y1 label", OBJ_TEXT, 0, CurTime(), Y1);
  280.       ObjectSetText("Y1 label", "                        Close", 12, "Arial", LineColorClose);
  281.       }
  282.       else
  283.       {
  284.       ObjectMove("Y1 label", 0, CurTime(), Y1);
  285.       }   
  286.             if(ObjectFind("Y1 line") != 0)
  287.       {
  288.       ObjectCreate("Y1 line", OBJ_HLINE, 0, Time[40], Y1);
  289.       ObjectSet("Y1 line", OBJPROP_STYLE, STYLE_SOLID);
  290.        ObjectSet("Y1 line", OBJPROP_WIDTH, Line_Width_Close);
  291.       ObjectSet("Y1 line", OBJPROP_COLOR, LineColorClose);
  292.       }
  293.       else
  294.       {
  295.       ObjectMove("Y1 line", 0, Time[40], Y1);
  296.       }  

  297. }
  298. //----End of Midpoint Pivots Draw

  299. //---- End Of Program
  300.    return(0);
  301.   }
  302. //+------------------------------------------------------------------+
复制代码


$TrillionStrategySessions.mq4
""
还没有人打赏,支持一下

评论|共 18 个

Jerrybaba

发表于 2018-4-30 21:07:11 | 显示全部楼层

不错啊哦,感谢楼主分享

Jerrybaba

发表于 2018-5-2 11:31:30 | 显示全部楼层

谢谢分享谢谢分享谢谢分享谢谢分享

山沟里的葫芦娃

发表于 2018-5-2 20:14:47 | 显示全部楼层


不错啊哦,感谢楼主分享{:132_123:}

213213216

发表于 2018-5-3 12:38:57 | 显示全部楼层

111111111111111111111

Jerrybaba

发表于 2018-6-5 08:29:33 | 显示全部楼层

谢谢分享谢谢分享谢谢分享谢谢分享

joyce40998

发表于 2020-6-28 10:00:27 | 显示全部楼层

我是来刷分的,嘿嘿

陪着我

发表于 2020-7-4 16:34:31 | 显示全部楼层

帮你顶下哈!!

娜娜世界

发表于 2020-7-5 10:00:35 | 显示全部楼层

学习了,不错

二货

发表于 2020-7-18 23:32:01 | 显示全部楼层

帮你顶下哈!!

12下一页
您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则