Miscellaneous
0
Views
0
Downloads
0
Favorites
Fib Pivots(a)
//+------------------------------------------------------------------+
//| 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 White
#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 0
#property indicator_style5 4
#property indicator_style6 4
#property indicator_style7 4
#property indicator_style8 4
#property indicator_width4 2
//---- input parameters
extern int StartHour=6;
extern color ResColour=Red;
extern color SupColour=Lime;
extern int LineWidth=1;
extern int SRLineStyle=4;
extern color OpenColour=White;
extern int OpenLineWidth=2;
extern int OpenSRLineStyle=0;
extern bool ShowLabel=true;
extern int FontSize=10;
extern color FontColour=DarkGray;
//---- buffers
double ResLevel3[];
double ResLevel2[];
double ResLevel1[];
double OpenPrice[];
double SupLevel1[];
double SupLevel2[];
double SupLevel3[];
double SupLevel4[];
//---- variables
int limit, cur_day, barChangeDay;
double DailyOpen,RL1,RL2,RL3,SL1,SL2,SL3,SL4,point;
datetime LabelShiftTime;
int LabelShift =0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(0,ResLevel3);
SetIndexStyle(1,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(1,ResLevel2);
SetIndexStyle(2,DRAW_LINE,SRLineStyle,LineWidth,ResColour);
SetIndexBuffer(2,ResLevel1);
SetIndexStyle(3,DRAW_LINE,OpenSRLineStyle,OpenLineWidth,OpenColour);
SetIndexBuffer(3,OpenPrice);
SetIndexStyle(4,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(4,SupLevel1);
SetIndexStyle(5,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(5,SupLevel2);
SetIndexStyle(6,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(6,SupLevel3);
SetIndexStyle(7,DRAW_LINE,SRLineStyle,LineWidth,SupColour);
SetIndexBuffer(7,SupLevel4);
//----
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;
RL1 = DailyOpen+(34*point);
RL2 = DailyOpen+(55*point);
RL3 = DailyOpen+(89*point);
SL1 = DailyOpen-(34*point);
SL2 = DailyOpen-(55*point);
SL3 = DailyOpen-(89*point);
SL4 = DailyOpen-(144*point);
}
ResLevel3[i]=RL3;
ResLevel2[i]=RL2;
ResLevel1[i]=RL1;
OpenPrice[i]=DailyOpen;
SupLevel1[i]=SL1;
SupLevel3[i]=SL3;
SupLevel2[i]=SL2;
SupLevel4[i]=SL4;
if (ShowLabel){
LabelShiftTime = Time[LabelShift]+1200;
ObjectCreate("Daily R3", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R3", " R3 " +DoubleToStr(RL3,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(0, "Daily R3");
ObjectCreate("Daily R2", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R2", " R2 " +DoubleToStr(RL2,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(1, "Daily R2");
ObjectCreate("Daily R1", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily R1", " R1 " +DoubleToStr(RL1,Digits),FontSize," ",FontColour);
SetIndexLabel(2, "Daily R1");
ObjectCreate("Daily Open", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily Open", " Open " +DoubleToStr(DailyOpen,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(3, "Daily Open");
ObjectCreate("Daily S1", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S1", " S1 " +DoubleToStr(SL1,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(4, "Daily S1");
ObjectCreate("Daily S2", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S2", " S2 " +DoubleToStr(SL2,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(5, "Daily S2");
ObjectCreate("Daily S3", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S3", " S3 " +DoubleToStr(SL3,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(6, "Daily S3");
ObjectCreate("Daily S4", OBJ_TEXT, 0, LabelShiftTime, 0);
ObjectSetText("Daily S4", " S4 " +DoubleToStr(SL4,Digits),FontSize,"arial ",FontColour);
SetIndexLabel(7, "Daily S4");
ObjectMove("Daily R3", 0, LabelShiftTime,RL3);
ObjectMove("Daily R2", 0, LabelShiftTime,RL2);
ObjectMove("Daily R1", 0, LabelShiftTime,RL1);
ObjectMove("Daily Open", 0, LabelShiftTime,DailyOpen);
ObjectMove("Daily S1", 0, LabelShiftTime,SL1);
ObjectMove("Daily S2", 0, LabelShiftTime,SL2);
ObjectMove("Daily S3", 0, LabelShiftTime,SL3);
ObjectMove("Daily S4", 0, LabelShiftTime,SL4);
}
}
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
---