Author: Copyright © 2017, Khlistov Vladimir
Miscellaneous
Implements a curve of type %1It sends emailsIt issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
candle
ÿþ#property copyright "Copyright © 2017, Khlistov Vladimir"

#property link      "http://cmillion.ru"



#property indicator_chart_window

#property indicator_buffers 2

#property indicator_color1 clrBlue

#property indicator_color2 clrRed



extern int candle = 6;  //:>;-2> A25G59



extern bool Notification = false;  // >AK;05B C254><;5=85 =0 <>18;L=K5 B5@<8=0;K, GL8 MetaQuotes ID C:070=K 2 >:=5 =0AB@>5: =0 70:;04:5 "#254><;5=8O".

extern bool alert = true;  // 2C:>2>5 >?>25I5=85.

extern bool email = true;  // E-mail A C:070=85< 8=D>@<0F88 ?> A83=0;C: =AB@C<5=B/0?@02;5=85/@5<O A83=0;0/



double buffer1[];

double buffer2[];



datetime TimeSignal=0;

int OnInit()

{

   SetIndexBuffer(0, buffer1);

   SetIndexBuffer(1, buffer2);

   SetIndexStyle(0, DRAW_ARROW, STYLE_SOLID, 1);

   SetIndexStyle(1, DRAW_ARROW, STYLE_SOLID, 1);

   SetIndexArrow(0, 233);

   SetIndexArrow(1, 234);

   return(INIT_SUCCEEDED);



}

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[])

{

   int counted_bars=IndicatorCounted();

   int j,i,limit=Bars-counted_bars;

   if (limit+candle>=Bars) limit=Bars-candle;

   for(i=limit; i>=0; i--)

   {

      int N=0;

      for(j=i; j<=candle+i; j++)

      {

         if (close[j] > open[j])

         {

            if (N!=-1) N=1;

            else {N=-2;break;}

         }

         if (close[j] < open[j])

         {

            if (N!=1) N=-1;

            else {N=-2;break;}

         }

      }

      if (N==-1)

      {

         buffer1[i]=Low[i];

         if (i==0 && TimeSignal!=Time[i]) send(StringConcatenate(Symbol()," ",candle," =8AE>4OI8E A25G59 ?>4@O4 ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS)));

         continue;

      }

      if (N==1)

      {

         buffer2[i]=High[i];

         if (i==0 && TimeSignal!=Time[i]) send(StringConcatenate(Symbol()," ",candle," 2>AE>4OI8E A25G59 ?>4@O4 ",TimeToStr(Time[i],TIME_DATE|TIME_SECONDS)));

         continue;

      }



      buffer1[i]=EMPTY_VALUE;

      buffer2[i]=EMPTY_VALUE;

   }

   return(0);

}



void send(string txt)

{

   if (Notification) SendNotification(txt); 

   if (email) SendMail(IntegerToString(AccountNumber()),txt); 

   if (alert) Alert(txt);

   TimeSignal=Time[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 ---