|
Статистика |
|
|
Онлайн всего: 1 Гостей: 1 Пользователей: 0 |
|
|
|
Каталог файлов |
|
Индикатор PriceChannel
[ Скачать с сервера (3.1 Kb)
]
| 20.10.2010, 22:48 |
#property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 DodgerBlue #property indicator_color2 FireBrick #property indicator_color3 Goldenrod //---- input parameters extern int HighPeriod=20; extern int LowPeriod=20; extern int Shift=0; //---- buffers double UpBuffer[]; double DnBuffer[]; double MdBuffer[]; double Up[],Dn[],Md[];
ArraySetAsSeries(Up,true); ArraySetAsSeries(Dn,true); ArraySetAsSeries(Md,true);
//+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { string short_name; //---- indicator line SetIndexStyle(0,DRAW_LINE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE,2); SetIndexBuffer(0,UpBuffer); SetIndexBuffer(1,DnBuffer); SetIndexBuffer(2,MdBuffer); //---- name for DataWindow and indicator subwindow label short_name="Price Channel("+HighPeriod+","+LowPeriod+")"; IndicatorShortName(short_name); SetIndexLabel(0,"Up Channel"); SetIndexLabel(1,"Down Channel"); SetIndexLabel(2,"Middle Channel"); //---- SetIndexDrawBegin(0,HighPeriod+Shift); SetIndexDrawBegin(1,LowPeriod+Shift); SetIndexDrawBegin(2,(HighPeriod-LowPeriod)/2+Shift);
SetIndexEmptyValue(0,0); SetIndexEmptyValue(1,0); SetIndexEmptyValue(2,0);
//---- return(0); } //+------------------------------------------------------------------+ //| Price Channel | //+------------------------------------------------------------------+ int start() { int i,counted_bars=IndicatorCounted(); int k; double high,low,price; //---- if(Bars<=MathMax(HighPeriod,LowPeriod)) return(0); //---- initial zero if(counted_bars<1) for(i=1;i<=MathMax(HighPeriod,LowPeriod);i++) //UpBuffer[Bars-i]=0.0;
ArrayResize(Up, Bars); ArrayResize(Dn, Bars); ArrayResize(Md, Bars); //---- i=Bars-MathMax(HighPeriod,LowPeriod)-1; if(counted_bars>=MathMax(HighPeriod,LowPeriod)) i=Bars-counted_bars; while(i>=0) { high=High[i]; low=Low[i]; k=i-1+MathMax(HighPeriod,LowPeriod); high=iHigh(NULL,0,iHighest(NULL,0,MODE_HIGH,HighPeriod,i+Shift)); low=iLow(NULL,0,iLowest(NULL,0,MODE_LOW,LowPeriod,i+Shift)); Up[i]=high; Dn[i]=low; Md[i]=(high+low)/2; UpBuffer[i]=Up[i+Shift]; DnBuffer[i]=Dn[i+Shift]; MdBuffer[i]=Md[i+Shift]; i--; } return(0); } //+------------------------------------------------------------------+
|
Категория: Мои файлы | Добавил: fxpart
|
Просмотров: 1344 | Загрузок: 98
| Комментарии: 1
| Рейтинг: 0.0/0 |
|
|
Copyright MyCorp © 2024 |
|
|