//+------------------------------------------------------------------+ //| DayOpenFib.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "" #property link "" #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ #property indicator_buffers 6 #property indicator_color1 Red #property indicator_color2 Green #property indicator_color3 Green #property indicator_color4 Green #property indicator_color5 Green #property indicator_color6 Green double yc[]; double l1[]; //38 double l2[]; //89 double l3[]; //144 double l4[]; //233 //double l5[]; //233 extern int HowManyDays = 100; extern bool up=true; int init() { //---- indicators //---- SetIndexBuffer(0, yc); SetIndexStyle(0, DRAW_LINE, STYLE_SOLID); SetIndexLabel(0, "Yesterday Close"); SetIndexBuffer(1, l1); SetIndexStyle(1, DRAW_LINE); SetIndexLabel(1, "Line 1"); SetIndexBuffer(2, l2); SetIndexStyle(2, DRAW_LINE); SetIndexLabel(2, "Line 2"); SetIndexBuffer(3, l3); SetIndexStyle(3, DRAW_LINE); SetIndexLabel(3, "Line 3"); SetIndexBuffer(4, l4); SetIndexStyle(4, DRAW_LINE); SetIndexLabel(4, "Line 4"); //SetIndexBuffer(5, l5); //SetIndexStyle(5, DRAW_LINE); //SetIndexLabel(5, "Line 5"); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit; int i=0,j=0; int counted_bars=IndicatorCounted(); //---- check for possible errors if(counted_bars<0) return(-1); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- datetime dailyTime[]; double dailyClose[],dailyOpen[]; bool newEndDay=false; ArrayCopySeries(dailyTime,MODE_TIME,Symbol(),PERIOD_D1); ArrayCopySeries(dailyOpen,MODE_OPEN,Symbol(),PERIOD_D1); for (i=0;i<limit;i++){ if ( j < HowManyDays && Period() < PERIOD_D1){ if (newEndDay) {newEndDay=false; continue;} yc[i] = dailyOpen[j]; if (up) { l1[i] = dailyOpen[j] + 34*Point; l2[i] = dailyOpen[j] + 89*Point; l3[i] = dailyOpen[j] + 144*Point; l4[i] = dailyOpen[j] + 233*Point; }else{ l1[i] = dailyOpen[j] - 34*Point; l2[i] = dailyOpen[j] - 89*Point; l3[i] = dailyOpen[j] - 144*Point; l4[i] = dailyOpen[j] - 233*Point; } if (Time[i+1] < dailyTime[j]) { j++; newEndDay=true; } } } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains open time of each bar
Series array that contains close prices for each bar
Series array that contains open prices of each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: