Fozzy_Alert

Author: Fozzy
Fozzy_Alert
Indicators Used
Relative strength indexMoving average indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
0 Views
0 Downloads
0 Favorites
Fozzy_Alert
//+------------------------------------------------------------------+
//|                Fozzy Daily Indicator                           |
//|                Programmed by Aidrian O'Connor                  |
//|                http://www.unitone.org            |
//+------------------------------------------------------------------+
#property copyright "Fozzy"
#property link      "http://"

#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_color3 MediumSeaGreen
#property indicator_color4 MediumSeaGreen
#property indicator_color5 MediumSeaGreen

//---- indicator parameters
extern int    RSIPeriod = 9;
extern int    RSIMAPeriod = 8;
extern int    BandsPeriod=40;
extern int    BandsShift=0;
extern double BandsDeviations=2.0;

//---- buffers
double RSI[];
double RSIMA[];
double BBMid[];
double BBUp[];
double BBDn[];
int i;
  
int init()
  {

  IndicatorBuffers(5);
 
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(0,i-1);
   SetIndexBuffer(0, RSI);
   SetIndexLabel(0,"RSI");

   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,i-1);
   SetIndexBuffer(1, RSIMA);
   SetIndexLabel(1,"RSI-MA");
   
   SetIndexStyle(2,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
   SetIndexDrawBegin(2,i-1);
   SetIndexBuffer(2, BBMid);
   SetIndexLabel(2,"BB-Mid");
   
   SetIndexStyle(3,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
   SetIndexDrawBegin(3,i-1);
   SetIndexBuffer(3, BBUp);
   SetIndexLabel(3,"BB-Up");
   
   SetIndexStyle(4,DRAW_LINE,STYLE_DOT,0,MediumSeaGreen);
   SetIndexDrawBegin(4,i-1);
   SetIndexBuffer(4, BBDn);
   SetIndexLabel(4,"BB-Dn");
 
   return(0);
  }

//--------------- Alert Code ---------------\\

bool Crossed (double line1 , double line2 )
{

static string last_direction = "";
string current_direction = "";

if(line1>line2)current_direction = "up";
if(line1<=line2)current_direction = "down";

if(current_direction != last_direction) 
{
      Alert("Fozzy Cross for "+Symbol()+" on the "+Period()+" minute chart.");
      last_direction = current_direction;
      return (true);
}
else
{
      return (false);

}
 
} 
//------------------------------------------\\


int start()
  {
   i=Bars-BandsPeriod;
   while(i>=0) {
     RSI[i] = iRSI(NULL,0,RSIPeriod,PRICE_CLOSE,i);
   i--;
   }
   
   i=Bars-BandsPeriod;
   while(i>=0) {
     RSIMA[i] = iMAOnArray(RSI,0,RSIMAPeriod,0,MODE_SMA,i);
   i--;
   }
   
   i=Bars-BandsPeriod;
   while(i>=0) {
     BBMid[i] = iMAOnArray(RSIMA,0,BandsPeriod,BandsShift,MODE_SMA,i);
     BBUp[i] = iBandsOnArray(RSIMA,0,BandsPeriod,BandsDeviations,BandsShift,MODE_UPPER,i);
     BBDn[i] = iBandsOnArray(RSIMA,0,BandsPeriod,BandsDeviations,BandsShift,MODE_LOWER,i);
   i--;
   }
   
     Print(Crossed (RSI[0],RSIMA[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 ---