SayaBarView

Author: Copyright 2011 Masaru.Sasaki
SayaBarView
Price Data Components
Series array that contains close prices for each barSeries array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
SayaBarView
//+------------------------------------------------------------------+
//|                                                  SayaBarView.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 1
#property indicator_minimum 0

// parameters
extern string SetCurrency = "CHFJPY";
extern bool SetPips = true;
extern double Currency_kakesu = 1;
extern double SetCurrency_kakesu = 1;

// buffers
double Sayabuf[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   // Symbol check
   if( StringLen(Symbol()) > 6 )
   {
      SetCurrency = SetCurrency+StringSubstr(Symbol(),6, StringLen(Symbol())-6);
   }
   
   SetIndexBuffer(0, Sayabuf);
   SetIndexLabel(0,SetCurrency+"[Saya]");
   SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,1,LightCyan);

   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--)
   {
      if( SetPips )
      {
         Sayabuf[i] = MathAbs((Close[i]/Point)-(iClose(SetCurrency,0,i)/MarketInfo(SetCurrency,MODE_TICKSIZE)));
      }else
         Sayabuf[i] = MathAbs(Close[i]*Currency_kakesu-iClose(SetCurrency,0,i)*SetCurrency_kakesu);
   }
   
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---