Miscellaneous
0
Views
0
Downloads
0
Favorites
Objective
//+------------------------------------------------------------------+
//| Objective.mq4 |
//| Copyright © 2011, LeMan. |
//| b-market@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, LeMan."
#property link "b-market@mail.ru"
#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 Green
#property indicator_color6 Green
#property indicator_color7 Green
#property indicator_color8 Green
#property indicator_style1 2
#property indicator_style2 2
#property indicator_style3 2
#property indicator_style4 2
#property indicator_style5 2
#property indicator_style6 2
#property indicator_style7 2
#property indicator_style8 2
//----
extern int Sample = 20;
extern double Quartile_1 = 25.0;
extern double Quartile_2 = 50.0;
extern double Quartile_3 = 75.0;
//----
double q1Buffer[];
double q2Buffer[];
double q3Buffer[];
double q4Buffer[];
double q5Buffer[];
double q6Buffer[];
double q7Buffer[];
double q8Buffer[];
//+------------------------------------------------------------------+
int init() {
//----
IndicatorBuffers(8);
IndicatorDigits(Digits);
//---- indicators
SetIndexBuffer(0, q1Buffer);
SetIndexBuffer(1, q2Buffer);
SetIndexBuffer(2, q3Buffer);
SetIndexBuffer(3, q4Buffer);
SetIndexBuffer(4, q5Buffer);
SetIndexBuffer(5, q6Buffer);
SetIndexBuffer(6, q7Buffer);
SetIndexBuffer(7, q8Buffer);
//---
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_LINE);
SetIndexStyle(3, DRAW_LINE);
SetIndexStyle(4, DRAW_LINE);
SetIndexStyle(5, DRAW_LINE);
SetIndexStyle(6, DRAW_LINE);
SetIndexStyle(7, DRAW_LINE);
//----
if (Sample <= 0) Sample = 20;
//----
return(0);
}
//+------------------------------------------------------------------+
int deinit() {
//----
//----
return(0);
}
//+------------------------------------------------------------------+
int start() {
//----
double HOArray[], OLArray[];
ArrayResize(HOArray, Sample);
ArrayResize(OLArray, Sample);
//----
int i,j;
int counted_bars = IndicatorCounted();
if(counted_bars < 0) return(-1);
if(counted_bars > 0) counted_bars--;
int limit = Bars - counted_bars;
if(counted_bars==0) limit-=1+Sample+1;
//----
for (i=0; i<limit; i++) {
for (j=0; j<Sample; j++) {
HOArray[j] = High[i+j+1] - Open[i+j+1];
OLArray[j] = Open[i+j+1] - Low[i+j+1];
}
ArraySort(HOArray);
ArraySort(OLArray);
int n1 = MathRound(Sample*Quartile_1/100);
int n2 = MathRound(Sample*Quartile_2/100);
int n3 = MathRound(Sample*Quartile_3/100);
double q1 = OLArray[n1];
double q2 = OLArray[n2];
double q3 = OLArray[n3];
double q4 = OLArray[Sample-1];
double q5 = HOArray[n1];
double q6 = HOArray[n2];
double q7 = HOArray[n3];
double q8 = HOArray[Sample-1];
q1Buffer[i] = Open[i]-q1;
q2Buffer[i] = Open[i]-q2;
q3Buffer[i] = Open[i]-q3;
q4Buffer[i] = Open[i]-q4;
q5Buffer[i] = Open[i]+q5;
q6Buffer[i] = Open[i]+q6;
q7Buffer[i] = Open[i]+q7;
q8Buffer[i] = Open[i]+q8;
}
//----
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
---