Price Data Components
Miscellaneous
0
Views
0
Downloads
0
Favorites
SayaView
//+------------------------------------------------------------------+
//| SayaView.mq4 |
//| Copyright 2011 Masaru.Sasaki |
//| http://youtarou.blogzine.jp |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010 Masaru.Sasaki"
#property link "http://youtarou.blogzine.jp"
#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Cyan
#property indicator_color2 Yellow
#property indicator_color3 SlateBlue
#property indicator_color4 Coral
#property indicator_color5 Orange
#property indicator_color6 DarkViolet
#property indicator_color7 Red
// parameters
extern string SetCurrency = "CHFJPY";
extern double SetCurrency_kakesu = 1;
extern bool View_Open = false;
extern bool View_High = false;
extern bool View_Low = false;
extern bool View_Ask = true;
extern bool View_Bid = false;
// buffers
double Closebuf[]; // parameter Currency close
double Openbuf[];
double Highbuf[];
double Lowbuf[];
double Askbuf[];
double Bidbuf[];
double Sayabuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
// Symbol check
if( StringLen(Symbol()) > 6 )
{
SetCurrency = SetCurrency+StringSubstr(Symbol(),6, StringLen(Symbol())-6);
}
SetIndexBuffer(0,Closebuf);
SetIndexBuffer(1,Openbuf);
SetIndexBuffer(2,Highbuf);
SetIndexBuffer(3,Lowbuf);
SetIndexBuffer(4,Askbuf);
SetIndexBuffer(5,Bidbuf);
SetIndexBuffer(6,Sayabuf);
SetIndexLabel(0,SetCurrency+"-Close");
SetIndexLabel(1,SetCurrency+"-Open");
SetIndexLabel(2,SetCurrency+"-High");
SetIndexLabel(3,SetCurrency+"-Low");
SetIndexLabel(4,SetCurrency+"-Ask");
SetIndexLabel(5,SetCurrency+"-Bid");
SetIndexLabel(6,SetCurrency+"-SayaSignal");
SetIndexStyle(6,DRAW_ARROW,STYLE_SOLID,1,Red);
SetIndexArrow(6,233);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
double spread = (Ask-Bid)/Point;
double Ask_set = MarketInfo(SetCurrency,MODE_ASK);
double Bid_set = MarketInfo(SetCurrency,MODE_BID);
double Point_set = MarketInfo(SetCurrency,MODE_TICKSIZE);
double spread_set = (Ask_set-Bid_set)/Point_set;
datetime l_t = TimeLocal();
string l_t_str = TimeYear(l_t)+"/"+TimeMonth(l_t)+"/"+TimeDay(l_t)+"<"+TimeHour(l_t)+":"+TimeMinute(l_t)+":"+TimeSeconds(l_t)+">";
string s_t_str = Year()+"/"+Month()+"/"+Day()+"<"+Hour()+":"+Minute()+":"+Seconds()+">";
Comment("\n------------------------------------------------------------------------------------\n",
"[",Symbol(),"] Spread: ", spread," pips [Ask:",Ask,"][Bid:",Bid,"]\n["+SetCurrency+"] Spread: ", spread_set," pips [Ask:",Ask_set,"][Bid:",Bid_set,"]\n",
"------------------------------------------------------------------------------------\n",
"FX Server Time : ", s_t_str, "\n\n", "PC Local Time : ", l_t_str);
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)));
Print("Sayabuf : ",Sayabuf[i]); // debug
Closebuf[i] = iClose(SetCurrency,0,i)*SetCurrency_kakesu; // View
if( View_Open ){
Openbuf[i] = iOpen(SetCurrency,0,i);
}else
Openbuf[i] = EMPTY_VALUE;
if( View_High ){
Highbuf[i] = iHigh(SetCurrency,0,i)*SetCurrency_kakesu;
}else
Highbuf[i] = EMPTY_VALUE;
if( View_Low ){
Lowbuf[i] = iLow(SetCurrency,0,i)*SetCurrency_kakesu;
}else
Lowbuf[i] = EMPTY_VALUE;
if( View_Ask ){
Askbuf[i] = MarketInfo(SetCurrency,MODE_ASK)*SetCurrency_kakesu;
}else
Askbuf[i] = EMPTY_VALUE;
if( View_Bid ){
Bidbuf[i] = MarketInfo(SetCurrency,MODE_BID)*SetCurrency_kakesu;
}else
Bidbuf[i] = EMPTY_VALUE;
}
for(i=limit-1; i>=0; i--)
{
Sayabuf[i] = EMPTY_VALUE;
}
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
---