Price Data Components
Indicators Used
0
Views
0
Downloads
0
Favorites
SayaBarCrossView
//+------------------------------------------------------------------+
//| SayaBarCrossView.mq4 |
//| Copyright 2011 Masaru.Sasaki |
//| http://youtarou.blogzine.jp |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011 Masaru.Sasaki"
#property link "http://youtarou.blogzine.jp"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Yellow
#property indicator_level1 0
// parameters
extern string SetCurrency = "CHFJPY"; // AUDJPY default
extern int Ma_mode = MODE_SMA;
extern int SmoothMa = 43;
// buffers
double Sayabuf[];
double SayaMabuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
// Symbol check
if( StringLen(Symbol()) > 6 )
{
SetCurrency = SetCurrency+StringSubstr(Symbol(),6, StringLen(Symbol())-6);
}
SetIndexBuffer(0, Sayabuf);
SetIndexBuffer(1, SayaMabuf);
SetIndexLabel(0,SetCurrency+"[Saya]");
SetIndexLabel(1,SetCurrency+"[SayaMA]");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit=Bars-counted_bars;
for(int i=limit-1; i>=0; i--)
{
Sayabuf[i] = MathAbs((Close[i]/Point)-(iClose(SetCurrency,0,i)/MarketInfo(SetCurrency,MODE_TICKSIZE)));
}
// Saya MA
for(i=0; i<limit; i++)
{
SayaMabuf[i] = iMAOnArray(Sayabuf, Bars, SmoothMa, 0, Ma_mode, 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
---