Miscellaneous
0
Views
0
Downloads
0
Favorites
DayOpenFib-up
//+------------------------------------------------------------------+
//| DayOpenFib.mq4 |
//| |
//| |
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
#property indicator_buffers 6
#property indicator_color1 Black
#property indicator_color2 Lime
#property indicator_color3 Lime
#property indicator_color4 Lime
#property indicator_color5 Lime
#property indicator_color6 Lime
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,2);
SetIndexLabel(0, "Yesterday Close");
SetIndexBuffer(1, l1);
SetIndexStyle(1, DRAW_LINE, STYLE_SOLID,2);
SetIndexLabel(1, "Day Fib 38");
SetIndexBuffer(2, l2);
SetIndexStyle(2, DRAW_LINE, STYLE_DOT);
SetIndexLabel(2, "Day Fib 89");
SetIndexBuffer(3, l3);
SetIndexStyle(3, DRAW_LINE, STYLE_DASHDOTDOT);
SetIndexLabel(3, "Day Fib 144");
SetIndexBuffer(4, l4);
SetIndexStyle(4, DRAW_LINE, STYLE_SOLID,3);
SetIndexLabel(4, "Day Fib 233");
//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);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---