Author: www.forex-tsd.com
SSL_fastA
Indicators Used
Moving average indicator
Miscellaneous
It issuies visual alerts to the screenIt sends emailsIt plays sound alerts
0 Views
0 Downloads
0 Favorites
SSL_fastA
//+------------------------------------------------------------------+
//|                                                     SSL fast.mq4 |
//|                                                           mladen |
//|                                                                  |
//| initial SSL for metatrader developed by Kalenzo                  |
//+------------------------------------------------------------------+
#property copyright "www.forex-tsd.com"
#property link      "www.forex-tsd.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 CornflowerBlue

//
//
//
//
//

extern int  Lb            = 10;
extern bool alertsOn      = false;
extern bool alertsMessage = true;
extern bool alertsSound   = false;
extern bool alertsEmail   = false;

//
//
//
//
//

double ssl[];
double Hlv[];

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//
//

int init()
{
   IndicatorBuffers(2);
   SetIndexBuffer(0,ssl); SetIndexDrawBegin(0,Lb+1);
   SetIndexBuffer(1,Hlv);
   return(0);
}

//
//
//
//
//

int start()
{
   int counted_bars=IndicatorCounted();
   int i,limit;

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
           limit=Bars-counted_bars;

   //
   //
   //
   //
   //

   for(i=limit;i>=0;i--)
   {
      Hlv[i] = Hlv[i+1];
         if(Close[i]>iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1)) Hlv[i] =  1;
         if(Close[i]<iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1))  Hlv[i] = -1;
      
         if(Hlv[i] == -1)
               ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_HIGH,i+1);
         else  ssl[i] = iMA(Symbol(),0,Lb,0,MODE_SMA,PRICE_LOW,i+1);
   }

   //
   //
   //
   //
   //
   
   if (alertsOn)
      if (Hlv[0] != Hlv[1])
      if (Hlv[0] == 1)
            doAlert("up");
      else  doAlert("down");       
   
   return(0);
}

//
//
//
//
//

void doAlert(string doWhat)
{
   static string   previousAlert="nothing";
   static datetime previousTime;
   string message;
   
      if (previousAlert != doWhat || previousTime != Time[0]) {
          previousAlert  = doWhat;
          previousTime   = Time[0];

          //
          //
          //
          //
          //

          message =  StringConcatenate(Symbol()," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," SSL trend changed to ",doWhat);
             if (alertsMessage) Alert(message);
             if (alertsEmail)   SendMail(StringConcatenate(Symbol(),"SSL "),message);
             if (alertsSound)   PlaySound("alert2.wav");
      }
}

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