//+------------------------------------------------------------------+ //| Sunrise.mq5 | //| AIS Forex | //| https://www.mql5.com/en/users/aleksej1966 | //+------------------------------------------------------------------+ #property copyright "AIS Forex" #property link "https://www.mql5.com/en/users/aleksej1966" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_label1 "Sunrise" #property indicator_color1 clrBlue #property indicator_width1 1 #property indicator_style1 STYLE_SOLID #property indicator_applied_price PRICE_CLOSE input ushort iPeriod=15; ushort period; double buffer[],weight[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,buffer,INDICATOR_DATA); ArraySetAsSeries(buffer,true); PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE); period=(ushort)MathMax(1,iPeriod)+1; ArrayResize(weight,period); ArrayInitialize(weight,0); for(int i=1; i0?rates_total-prev_calculated:rates_total-period-1; for(int i=bars; i>=0; i--) { double sum=0; for(int j=0; j