Miscellaneous
0
Views
0
Downloads
0
Favorites
Fib Pivots(b)
//+------------------------------------------------------------------+
//| FIB PIVOT GMT OFFSET|
//| Limstylz |
//+------------------------------------------------------------------+
#property copyright "Limstylz"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 Red
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Lime
#property indicator_color7 Lime
#property indicator_color8 Lime
#property indicator_style1 4
#property indicator_style2 4
#property indicator_style3 4
#property indicator_style4 4
#property indicator_style5 4
#property indicator_style6 4
#property indicator_style7 4
#property indicator_style8 4
//---- input parameters
extern int StartHour=6;
extern color ResColour=Red;
extern color SupColour=Lime;
extern int LineWidth=1;
extern int SRLineStyle=4;
extern bool ShowLabel=true;
extern int FontSize=10;
extern color FontColour=DarkGray;
//---- buffers
double ResLevel7[];
double ResLevel6[];
double ResLevel5[];
double ResLevel4[];
double SupLevel5[];
double SupLevel6[];
double SupLevel7[];
double SupLevel8[];
//---- variables
int limit, cur_day, barChangeDay;
double DailyOpen,RL4,RL5,RL6,RL7,SL5,SL6,SL7,SL8,point;
datetime LabelShiftTime;
int LabelShift =0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(0,ResLevel7);
SetIndexStyle(1,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(1,ResLevel6);
SetIndexStyle(2,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(2,ResLevel5);
SetIndexStyle(3,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(3,ResLevel4);
SetIndexStyle(4,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(4,SupLevel5);
SetIndexStyle(5,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(5,SupLevel6);
SetIndexStyle(6,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(6,SupLevel7);
SetIndexStyle(7,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(7,SupLevel8);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll(0,OBJ_TEXT);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
if (counted_bars<0) return(-1);
if (counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i=limit; i>=0; i--)
{
cur_day = TimeDay(Time[i]);
if (
TimeHour(Time[i]) == StartHour &&
TimeMinute(Time[i]) == 0
)
{
barChangeDay = i;
DailyOpen = Open[i];
if (Digits == 5) point= Point*10;
if (Digits == 4) point= Point;
if (Digits == 3) point= Point*10;
if (Digits == 2) point= Point;
RL4 = DailyOpen+(144*point);
RL5 = DailyOpen+(233*point);
RL6 = DailyOpen+(377*point);
RL7 = DailyOpen+(610*point);
SL5 = DailyOpen-(233*point);
SL6 = DailyOpen-(377*point);
SL7 = DailyOpen-(610*point);
SL8 = DailyOpen-(987*point);
}
ResLevel6[i]=RL6;
ResLevel5[i]=RL5;
ResLevel4[i]=RL4;
ResLevel7[i]=RL7;
SupLevel5[i]=SL5;
SupLevel6[i]=SL6;
SupLevel7[i]=SL7;
SupLevel8[i]=SL8;
if (ShowLabel){
LabelShiftTime = Time[LabelShift]+1200;
ObjectCreate("Daily R7", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R7", " R7 " +DoubleToStr(RL7,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(0, "Daily R7");
ObjectCreate("Daily R6", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R6", " R6 " +DoubleToStr(RL6,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(1, "Daily R6");
ObjectCreate("Daily R5", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R5", " R5 " +DoubleToStr(RL5,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(2, "Daily R5");
ObjectCreate("Daily R4", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R4", " R4 " +DoubleToStr(RL4,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(3, "Daily R4");
ObjectCreate("Daily S5", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S5", " S5 " +DoubleToStr(SL5,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(4, "Daily S5");
ObjectCreate("Daily S6", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S6", " S6 " +DoubleToStr(SL6,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(5, "Daily S6");
ObjectCreate("Daily S7", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S7", " S7 " +DoubleToStr(SL7,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(6, "Daily S7");
ObjectCreate("Daily S8", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S8", " S8 " +DoubleToStr(SL8,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(7, "Daily S8");
ObjectMove("Daily R7", 0, LabelShiftTime,RL7);
ObjectMove("Daily R6", 0, LabelShiftTime,RL6);
ObjectMove("Daily R5", 0, LabelShiftTime,RL5);
ObjectMove("Daily R4", 0, LabelShiftTime,RL4);
ObjectMove("Daily S6", 0, LabelShiftTime,SL6);
ObjectMove("Daily S5", 0, LabelShiftTime,SL5);
ObjectMove("Daily S8", 0, LabelShiftTime,SL8);
ObjectMove("Daily S7", 0, LabelShiftTime,SL7);
}
}
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
---