Miscellaneous
0
Views
0
Downloads
0
Favorites
kijunsenlevel
//+------------------------------------------------------------------+
//| #Kijun#Sen#Level#.mq4 |
//| Copyright 2016, BestXerof Corp. |
//| bestxerof@gmail.com |
//+------------------------------------------------------------------+
//| Copyright © 2004, AlexSilver |
//| http://viac.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, BestXerof Corp." "Copyright © 2004, AlexSilver"
#property link "bestxerof@gmail.com" "http://viac.ru/"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Black
#property indicator_color2 Red
#property indicator_color3 Red
extern int Kijun=26;
extern int ShiftKijun=3;
extern bool ShowLevel=true;
extern double Level=30.0;
double Kijun_Buffer[];
double Kijun_Up[],Kijun_Dn[];
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
if(Digits==3 || Digits==5)
{
Level*=10;
}
IndicatorBuffers(3);
SetIndexStyle(0,DRAW_LINE,STYLE_DOT,3);
SetIndexStyle(1,DRAW_LINE,STYLE_DASHDOT,EMPTY);
SetIndexStyle(2,DRAW_LINE,STYLE_DASHDOT,EMPTY);
SetIndexDrawBegin(0,Kijun+ShiftKijun-1);
SetIndexShift(0,ShiftKijun);
SetIndexBuffer(0,Kijun_Buffer);
SetIndexBuffer(1,Kijun_Up);
SetIndexBuffer(2,Kijun_Dn);
return(0);
}
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo Kijun-sen Only |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double high,low,price;
double pip=MarketInfo(Symbol(),MODE_TICKSIZE);
//----
if(Bars<=Kijun) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=Kijun;i++)
Kijun_Buffer[Bars-i]=0;
}
//---- Kijun Sen
i=Bars-Kijun;
if(counted_bars>Kijun)
i=Bars-counted_bars-1;
while(i>=0)
{
high=High[i];
low=Low[i];
k=i-1+Kijun;
while(k>=i)
{
price=High[k];
if(high<price)
high=price;
price=Low[k];
if(low>price)
low=price;
k--;
}
Kijun_Buffer[i+ShiftKijun]=(high+low)/2;
if(ShowLevel)
{
Kijun_Up[i]=(Level*pip)+Kijun_Buffer[i+ShiftKijun];
Kijun_Dn[i]=(-Level*pip)+Kijun_Buffer[i+ShiftKijun];
}
i--;
}
i=ShiftKijun-1;
while(i>=0)
{
high=High[0];
low=Low[0];
k=Kijun-ShiftKijun+i;
while(k>=0)
{
price=High[k];
if(high<price)
high=price;
price=Low[k];
if(low>price)
low=price;
k--;
}
Kijun_Buffer[i]=(high+low)/2;
if(ShowLevel)
{
Kijun_Up[i]=(Level*pip)+Kijun_Buffer[i];
Kijun_Dn[i]=(-Level*pip)+Kijun_Buffer[i];
}
i--;
}
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
---