BarsStreet 1.05

Author: MaksimNeimeryk
Price Data Components
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
BarsStreet 1.05
//+------------------------------------------------------------------+
//|                                              BarsStreet 1.05.mq4 |
//|                                                   MaksimNeimeryk |
//|                                              deilyplanet@ukr.net |
//+------------------------------------------------------------------+
#property copyright "MaksimNeimeryk"
#property link      "deilyplanet@ukr.net"
#property version   "1.05"
#property strict
#property indicator_chart_window
#property indicator_buffers 20
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 Blue
#property indicator_color6 Blue
#property indicator_color7 Blue
#property indicator_color8 Blue
#property indicator_color9 Blue
#property indicator_color10 Red
#property indicator_color11 Red
#property indicator_color12 Red
#property indicator_color13 Red
#property indicator_color14 Red
#property indicator_color15 Red
#property indicator_color16 Red
#property indicator_color17 Red
#property indicator_color18 Red
#property indicator_color19 Blue
#property indicator_color20 Red

extern int size=2; //Size of the indicator label 
extern int Position=2; //The position of the indicator label (in points)
extern bool Alerts=true; //Alert
extern int bar=0;// Number of history bars

extern bool buy3=true;//3 buy bars (on/off)
extern bool buy4=true;//4 buy bars (on/off)
extern bool buy5=true;//5 buy bars (on/off)
extern bool buy6=true;//6 buy bars (on/off)
extern bool buy7=true;//7 buy bars (on/off)
extern bool buy8=true;//8 buy bars (on/off)
extern bool buy9=true;//9 buy bars (on/off)
extern bool buy10=true;//10 buy bars (on/off)
extern bool buy11=true;//11 buy bars (on/off)
extern bool buy12=true;//12 buy bars (on/off)

extern bool sell3=true;//3 sell bars (on/off)
extern bool sell4=true;//4 sell bars (on/off)
extern bool sell5=true;//5 sell bars (on/off)
extern bool sell6=true;//6 sell bars (on/off)
extern bool sell7=true;//7 sell bars (on/off)
extern bool sell8=true;//8 sell bars (on/off)
extern bool sell9=true;//9 sell bars (on/off)
extern bool sell10=true;//10 sell bars (on/off)
extern bool sell11=true;//11 sell bars (on/off)
extern bool sell12=true;//12 sell bars (on/off)

static datetime prevtime=0;

double Buffer1[],Buffer2[],Buffer3[],Buffer4[],Buffer5[],Buffer6[],Buffer7[],Buffer8[],Buffer9[],
Buffer10[],Buffer11[],Buffer12[],Buffer13[],Buffer14[],Buffer15[],Buffer16[],Buffer17[],Buffer18[],Buffer19[],Buffer20[],Positions;
bool   condition;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//Buy Buffers--------------------------------------------------------
   SetIndexBuffer(18,Buffer19);SetIndexStyle(18,DRAW_ARROW,0,size);SetIndexArrow(18,142);
   SetIndexBuffer(0,Buffer1);SetIndexStyle(0,DRAW_ARROW,0,size);SetIndexArrow(0,143);
   SetIndexBuffer(1,Buffer2);SetIndexStyle(1,DRAW_ARROW,0,size);SetIndexArrow(1,144);
   SetIndexBuffer(2,Buffer3);SetIndexStyle(2,DRAW_ARROW,0,size);SetIndexArrow(2,145);
   SetIndexBuffer(3,Buffer4);SetIndexStyle(3,DRAW_ARROW,0,size);SetIndexArrow(3,146);
   SetIndexBuffer(4,Buffer5);SetIndexStyle(4,DRAW_ARROW,0,size);SetIndexArrow(4,147);
   SetIndexBuffer(5,Buffer6);SetIndexStyle(5,DRAW_ARROW,0,size);SetIndexArrow(5,148);
   SetIndexBuffer(6,Buffer7);SetIndexStyle(6,DRAW_ARROW,0,size);SetIndexArrow(6,149);
   SetIndexBuffer(7,Buffer8);SetIndexStyle(7,DRAW_ARROW,0,size);SetIndexArrow(7,221);
   SetIndexBuffer(8,Buffer9);SetIndexStyle(8,DRAW_ARROW,0,size);SetIndexArrow(8,221);
//Sell Buffers--------------------------------------------------------
   SetIndexBuffer(19,Buffer20);SetIndexStyle(19,DRAW_ARROW,0,size);SetIndexArrow(19,142);
   SetIndexBuffer(9,Buffer10);SetIndexStyle(9,DRAW_ARROW,0,size);SetIndexArrow(9,143);
   SetIndexBuffer(10,Buffer11);SetIndexStyle(10,DRAW_ARROW,0,size);SetIndexArrow(10,144);
   SetIndexBuffer(11,Buffer12);SetIndexStyle(11,DRAW_ARROW,0,size);SetIndexArrow(11,145);
   SetIndexBuffer(12,Buffer13);SetIndexStyle(12,DRAW_ARROW,0,size);SetIndexArrow(12,146);
   SetIndexBuffer(13,Buffer14);SetIndexStyle(13,DRAW_ARROW,0,size);SetIndexArrow(13,147);
   SetIndexBuffer(14,Buffer15);SetIndexStyle(14,DRAW_ARROW,0,size);SetIndexArrow(14,148);
   SetIndexBuffer(15,Buffer16);SetIndexStyle(15,DRAW_ARROW,0,size);SetIndexArrow(15,149);
   SetIndexBuffer(16,Buffer17);SetIndexStyle(16,DRAW_ARROW,0,size);SetIndexArrow(16,222);
   SetIndexBuffer(17,Buffer18);SetIndexStyle(17,DRAW_ARROW,0,size);SetIndexArrow(17,222);

   if(bar==0)
      bar=Bars;

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   Positions=NormalizeDouble(Position*Point,Digits());
   if(Time[0] == prevtime)   return(-1);
   prevtime = Time[0];
   for(int i=0; i<=bar-14;i++)
     {
      //----------------BuyBars------------------------------------------------- 
      condition=Close[i+1]>Open[i+1]
                &&Close[i+1]>=Close[i+2]&&Close[i+2]>Open[i+2]
                &&Close[i+2]>=Close[i+3]&&Close[i+3]>Open[i+3];
      if(condition && Close[i+4]<=Open[i+4] && buy3==true)
        {
         Buffer19[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("3 Buy bars ",Symbol());
        }
      
      condition=condition
                &&Close[i+3]>=Close[i+4]&&Close[i+4]>Open[i+4];
      if(condition && Close[i+5]<=Open[i+5] && buy4==true)
        {
         Buffer1[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("4 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+4]>=Close[i+5] && Close[i+5]>Open[i+5];
      if(condition && Close[i+6]<=Open[i+6] && buy5==true)
        {
         Buffer2[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("5 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+5]>=Close[i+6] && Close[i+6]>Open[i+6];
      if(condition && Close[i+7]<=Open[i+7] && buy6==true)
        {
         Buffer3[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("6 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+6]>=Close[i+7] && Close[i+7]>Open[i+7];
      if(condition && Close[i+8]<=Open[i+8] && buy7==true)
        {
         Buffer4[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("7 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+7]>=Close[i+8] && Close[i+8]>Open[i+8];
      if(condition && Close[i+9]<=Open[i+9] && buy8==true)
        {
         Buffer5[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("8 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+8]>=Close[i+9] && Close[i+9]>Open[i+9];
      if(condition && Close[i+10]<=Open[i+10] && buy9==true)
        {
         Buffer6[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("9 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+9]>=Close[i+10] && Close[i+10]>Open[i+10];
      if(condition && Close[i+11]<=Open[i+11] && buy10==true)
        {
         Buffer7[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("10 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+10]>=Close[i+11] && Close[i+11]>Open[i+11];
      if(condition && Close[i+12]<=Open[i+12] && buy11==true)
        {
         Buffer8[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("11 Buy bars ",Symbol());
        }
      condition=condition
                && Close[i+11]>=Close[i+12] && Close[i+12]>Open[i+12];
      if(condition && Close[i+13]<=Open[i+13] && buy12==true)
        {
         Buffer9[i+1]=High[i+1]+Positions;
         if(Alerts==true && i<=0)
            Alert("12 Buy bars ",Symbol());
        }
      //--------SellBars-----------------------------------------------------------------    
      condition=Close[i+1]<Open[i+1]
                &&Close[i+1]<=Close[i+2]&&Close[i+2]<Open[i+2]
                &&Close[i+2]<=Close[i+3]&&Close[i+3]<Open[i+3];
      if(condition && Close[i+4]>=Open[i+4] && sell3==true)
        {
         Buffer20[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("3 Sell bars ",Symbol());
        }             
      condition=condition
                &&Close[i+3]<=Close[i+4]&&Close[i+4]<Open[i+4];
      if(condition && Close[i+5]>=Open[i+5] && sell4==true)
        {
         Buffer10[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("4 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+4]<=Close[i+5] && Close[i+5]<Open[i+5];
      if(condition && Close[i+6]>=Open[i+6] && sell5==true)
        {
         Buffer11[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("5 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+5]<=Close[i+6] && Close[i+6]<Open[i+6];
      if(condition && Close[i+7]>=Open[i+7] && sell6==true)
        {
         Buffer12[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("6 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+6]<=Close[i+7] && Close[i+7]<Open[i+7];
      if(condition && Close[i+8]>=Open[i+8] && sell7==true)
        {
         Buffer13[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("7 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+7]<=Close[i+8] && Close[i+8]<Open[i+8];
      if(condition && Close[i+9]>=Open[i+9] && sell8==true)
        {
         Buffer14[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("8 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+8]<=Close[i+9] && Close[i+9]<Open[i+9];
      if(condition && Close[i+10]>=Open[i+10] && sell9==true)
        {
         Buffer15[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("9 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+9]<=Close[i+10] && Close[i+10]<Open[i+10];
      if(condition && Close[i+11]>=Open[i+11] && sell10==true)
        {
         Buffer16[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("10 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+10]<=Close[i+11] && Close[i+11]<Open[i+11];
      if(condition && Close[i+12]>=Open[i+12] && sell11==true)
        {
         Buffer17[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("11 Sell bars ",Symbol());
        }
      condition=condition
                && Close[i+11]<=Close[i+12] && Close[i+12]<Open[i+12];
      if(condition && Close[i+13]>=Open[i+13] && sell12==true)
        {
         Buffer18[i+1]=Low[i+1]-Positions;
         if(Alerts==true && i<=0)
            Alert("12 Sell bars ",Symbol());
        }
     }
   return(rates_total);
  }

//+------------------------------------------------------------------+

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 ---