Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
FIBO_ZONE
#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 Crimson
#property indicator_color2 Sienna
#property indicator_color3 DarkSlateBlue
#property indicator_color4 DarkOliveGreen
#property indicator_color5 Green
extern int NumOfBars = 0;
extern int per = 10;
double Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
int init(){
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(3,DRAW_LINE,STYLE_SOLID,2);
SetIndexStyle(4,DRAW_LINE,STYLE_SOLID,2);
SetIndexBuffer(0,Buffer1);
SetIndexBuffer(1,Buffer2);
SetIndexBuffer(2,Buffer3);
SetIndexBuffer(3,Buffer4);
SetIndexBuffer(4,Buffer5);
return(0);
}
int deinit(){
return(0);
}
int get_zone(double price,int shitf){
if(price>=Buffer1[shitf]) return (6);
else if(price<Buffer5[shitf]) return (1);
else if(price<Buffer1[shitf] && price>=Buffer2[shitf]) return (5);
else if(price<Buffer2[shitf] && price>=Buffer3[shitf]) return (4);
else if(price<Buffer3[shitf] && price>=Buffer4[shitf]) return (3);
else if(price<Buffer4[shitf] && price>=Buffer5[shitf]) return (2);
}
int last = 0;
int start() {
if(last == Bars) return (0);
last = Bars;
int limit = NumOfBars;
if(limit==0 || limit>Bars) limit=Bars;
int zone_stats[6][6];
int zone[6];
int b,l = 0;
double roc = 0;
double C,D,B,A,E;
for(int i = limit-1;i>=0;i--){
b = iBarShift(NULL,PERIOD_D1,Time[i]);
if(b!=l){
l = b;
int b_ = TimeDayOfWeek(Time[i]);
if(b_==1) b +=2; else b +=1;
double cl = iClose(NULL,PERIOD_D1,b);
double hi = iHigh(NULL,PERIOD_D1,b);
double lo = iLow(NULL,PERIOD_D1,b);
C = (cl+hi+lo) / 3;
D = C + (hi-lo)/2;
B = C - (hi-lo)/2;
E = C + (hi-lo);
A = C - (hi-lo);
Buffer1[i] = E;
Buffer2[i] = D;
Buffer3[i] = C;
Buffer4[i] = B;
Buffer5[i] = A;
int zo = get_zone(iOpen (NULL,PERIOD_D1,l),i)-1;
int zc = get_zone(iClose(NULL,PERIOD_D1,l),i)-1;
zone[zo]++;
zone_stats[zo][zc]++;
}
else{
Buffer1[i] = E;
Buffer2[i] = D;
Buffer3[i] = C;
Buffer4[i] = B;
Buffer5[i] = A;
}
}
for(i=0;i<6;i++){
for(int j=0;j<6;j++){
if(zone[i]!=0){
Print("OpenZone = " + (i+1) + ",CloseZone = "+(j+1)+", Prec = "+(MathAbs(zone_stats[i][j])/zone[i])*100);
}
}
}
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
---