i_MultiAO_v1_2

Author: �opyright 2015. ExcStrategy
Price Data Components
Series array that contains open time of each bar
Indicators Used
Bill Williams Accelerator/Decelerator oscillator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
i_MultiAO_v1_2
//+------------------------------------------------------------------+
//|                                                    i_MultiAO.mq4 |
//|                                Copyright 2010-2015, ExcStrategy. |
//|                                        http://www.excstrategy.ru |
//+------------------------------------------------------------------+
#property copyright "Ñopyright 2015. ExcStrategy"
#property link      "http://www.ExcStrategy.ru"
#property version   "1.2"
#property description "Accelerator Oscillator"
#property strict
//----
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2  Lime
#property indicator_color3  Red
#property indicator_width2  5
#property indicator_width3  5
//----
#property indicator_level1 0
//---- input parameters
extern string Indicator_Symbol="GBPUSD";
extern int Limit=1440;
extern bool Revers = false;
//----
double Buffer1[], Buffer2[], Buffer3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() 
{  
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_HISTOGRAM);
   SetIndexStyle(2, DRAW_HISTOGRAM);
   //----
   SetIndexDrawBegin(0, 36);
   SetIndexDrawBegin(1, 36);
   SetIndexDrawBegin(2, 36);
   //----
   SetIndexBuffer(0, Buffer1);
   SetIndexBuffer(1, Buffer2);
   SetIndexBuffer(2, Buffer3);
   //----
   IndicatorShortName(Indicator_Symbol + " (Accelerator Oscillator)");
   SetIndexLabel(0, Indicator_Symbol + "(Accelerator Oscillator)");
   //----
   return(0);
   //----
}
//+------------------------------------------------------------------+
//| start()                                                          |
//+------------------------------------------------------------------+
int start() 
{
    static datetime TimeIndicator = -1;
    int limit, counted_bars=IndicatorCounted(), i, Pos;
    datetime CurrentTime;
    double prev, current;
    bool up = true;
    //----
    if(counted_bars < 0) return(-1);
    if(counted_bars > 0) counted_bars--;
    limit=Bars - counted_bars;
    //----
    if(limit>Limit && Limit>0) limit = Limit;
    if(TimeIndicator > 0) limit += iBarShift(Indicator_Symbol, Period(), TimeIndicator);
    //----
    for(i = limit;i>=0;i--)
    {
        CurrentTime = Time[i];
        Pos=iBarShift(Indicator_Symbol, Period(), CurrentTime);
        if(iTime(Indicator_Symbol, Period(), Pos) < CurrentTime) Pos++;
        Buffer1[i] = iAC(Indicator_Symbol, Period(), Pos);
        if(Revers) Buffer1[i] *= -1.0;
        //----
        current = Buffer1[i];
        prev = Buffer1[i+1];
        if(current>prev) up=true;
        if(current<prev) up=false;
        if(!up)
        {
            Buffer3[i]=current;
            Buffer2[i]=0.0;
        }
        else
        {
            Buffer2[i]=current;
            Buffer3[i]=0.0;
        }   
        //----
    }
    //----
    TimeIndicator = iTime(Indicator_Symbol, Period(), 0);
    //----  
    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 ---