//+------------------------------------------------------------------+ //| #DayOpen.mq4 | //| Copyright © 2010, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Lime #property indicator_color2 Red #property indicator_color3 Red #property indicator_color4 Lime //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(0,DRAW_LINE,STYLE_DASH); SetIndexStyle(1,DRAW_LINE,STYLE_DASH); SetIndexStyle(2,DRAW_LINE,STYLE_SOLID); SetIndexStyle(3,DRAW_LINE,STYLE_SOLID); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit,i,counted_bars; double dailyopen,dailyhigh,avg,rangelow,target; counted_bars=IndicatorCounted(); if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; dailyopen=iOpen(NULL,PERIOD_H1,TimeHour(TimeCurrent())+7); dailyhigh=iHigh(NULL,PERIOD_H1,iHighest(NULL,PERIOD_H1,MODE_HIGH,TimeHour(TimeCurrent())+7,0)); for(i=1;i<=20;i++) avg = avg + iHigh(NULL,PERIOD_D1,i)-iLow(NULL,PERIOD_D1,i); avg = avg/20.0; rangelow=dailyhigh-avg; target=dailyhigh-avg*0.75; for(i=limit; i>=0; i--) { ExtMapBuffer1[i] = dailyopen; ExtMapBuffer2[i] = target; ExtMapBuffer3[i] = rangelow; ExtMapBuffer4[i] = dailyhigh; } //---- //---- return(0); } //+------------------------------------------------------------------+