Price Data Components
0
Views
0
Downloads
0
Favorites
Waist_Close_Levels
//+------------------------------------------------------------------+
//| Waist_Close_Levels .mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property link " AllPivots by IgorAD Modified by cja"
#property indicator_chart_window
extern int CountDays=10;
extern color Waist = Lime;
extern int Waist_Style = 1;
extern color Y_Close = Yellow;
extern int Y_Close_Style = 1;
datetime time1;
datetime time2;
double open,close,high,low;
double Yc,Wst;
int shift, num;
void ObjDel()
{
for (;num<=CountDays;num++)
{
ObjectDelete("Yc["+num+"]");
ObjectDelete("Wst["+num+"]");
}
}
void PlotLine(string name,double value,double line_color,double style)
{
ObjectCreate(name,OBJ_TREND,0,time1,value,time2,value);
ObjectSet(name, OBJPROP_WIDTH, 1);
ObjectSet(name, OBJPROP_STYLE, style);
ObjectSet(name, OBJPROP_RAY, false);
ObjectSet(name, OBJPROP_BACK, true);
ObjectSet(name, OBJPROP_COLOR, line_color);
}
int init()
{
return(0);
}
int deinit()
{
ObjDel();
Comment("");
return(0);
}
int start()
{
int i;
ObjDel();
num=0;
for (shift=CountDays-1;shift>=0;shift--)
{
time1=iTime(NULL,PERIOD_D1,shift);
i=shift-1;
if (i<0)
time2=Time[0];
else
time2=iTime(NULL,PERIOD_D1,i)-Period()*60;
high = iHigh(NULL,PERIOD_D1,shift+1);
low = iLow(NULL,PERIOD_D1,shift+1);
open = iOpen(NULL,PERIOD_D1,shift+1);
close = iClose(NULL,PERIOD_D1,shift+1);
Yc = (close);
Wst = ((open+close)/2);
time2=time1+PERIOD_D1*60;
num=shift;
PlotLine("Yc["+num+"]",Yc,Y_Close,Y_Close_Style);
PlotLine("Wst["+num+"]",Wst,Waist,Waist_Style);
}
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
---