Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
zIG_DBO
#property copyright "Copyright © 2007, zIG"
#property link "http://www.wm-joker.ru"
#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Snow
#property indicator_width1 0
#property indicator_color2 Red
#property indicator_width2 2
#property indicator_color3 Blue
#property indicator_width3 2
//---- buffers
double PBuffer[];
double J1Buffer[];
double B1Buffer[];
double J2Buffer[];
double B2Buffer[];
double J3Buffer[];
double B3Buffer[];
double P, J1, B1, J2, B2, J3, B3;
double LastHigh, LastLow, x;
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
ObjectsDeleteAll();
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicator line
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_LINE);
SetIndexBuffer(0, PBuffer);
SetIndexBuffer(1, J1Buffer);
SetIndexBuffer(2, B1Buffer);
SetIndexDrawBegin(0,1);
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS));
int clr;
int q;
for(q=1;q<100;q++)
{
clr=0;
if(TimeDayOfWeek(iTime(NULL,1440,q))==5)clr=C'0,0,120';
if(TimeDayOfWeek(iTime(NULL,1440,q))==1)clr=C'0,120,0';
if(clr!=0)
{
ObjectCreate("B"+q, OBJ_RECTANGLE, 0, iTime(NULL,1440,q), iHigh(NULL,1440,q), iTime(NULL,1440,q-1), iLow(NULL,1440,q-1));
ObjectSet("B"+q, OBJPROP_COLOR, clr);
ObjectSet("B"+q,OBJPROP_BACK,true);
ObjectSet("B"+q,OBJPROP_WIDTH,0);
ObjectSet("B"+q,OBJPROP_STYLE,0);
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars = IndicatorCounted();
int limit, i,currday,k=0;
double op,lastlow=0,lasthigh=0,bl,sl;
int R1=0,R5=0,R10=0,R20=0,RAvg=0;
if(counted_bars == 0)
{
x = Period();
if(x > 240)
return(-1);
}
if(counted_bars < 0)
return(-1);
limit = (Bars - counted_bars) - 1;
for(i = limit; i >= 0; i--)
{
if(TimeDay(Time[i]) != TimeDay(Time[i+1]))
{
J1Buffer[i+1] = EMPTY_VALUE;
B1Buffer[i+1] = EMPTY_VALUE;
J1Buffer[i-1] = EMPTY_VALUE;
B1Buffer[i-1] = EMPTY_VALUE;
R1=0;
R5=0;
R10=0;
R20=0;
RAvg=0;
currday=MathFloor(i*Period()/1440);
R1 = (iHigh(NULL,PERIOD_D1,currday+1)-iLow(NULL,PERIOD_D1,currday+1))/Point;
for(k=1;k<=5;k++) R5 = R5 + (iHigh(NULL,PERIOD_D1,currday+k)-iLow(NULL,PERIOD_D1,currday+k))/Point;
for(k=1;k<=10;k++) R10 = R10 + (iHigh(NULL,PERIOD_D1,currday+k)-iLow(NULL,PERIOD_D1,currday+k))/Point;
for(k=1;k<=20;k++) R20 = R20 + (iHigh(NULL,PERIOD_D1,currday+k)-iLow(NULL,PERIOD_D1,currday+k))/Point;
R5 = R5/5;
R10 = R10/10;
R20 = R20/20;
RAvg = (R5+R10+R20)/3;
op=iOpen(NULL,PERIOD_D1,currday);
lasthigh=High[i];
lastlow=Low[i];
}
if(High[i+1] > lasthigh)
{
lasthigh = High[i+1];
}
J1=lasthigh-RAvg/2*Point;
//----
if(Low[i+1] < lastlow)
{
lastlow=Low[i+1];
}
B1=lastlow+RAvg/2*Point;
J1Buffer[i] = J1;
B1Buffer[i] = B1;
PBuffer[i]=op;
}
//----
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
---