Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Parabolic_mailalert
//+------------------------------------------------------------------+
//| SAR_COLOR.mq4 |
//| Kalenzo |
//| http://www.foreksik.prv.pl |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "http://www.foreksik.prv.pl"
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_width1 1
#property indicator_width2 1
double sarUp[],sarDn[];//buffers
extern bool AlertsEnabled=false;
extern bool email=false;
extern double Step = 0.02;//was .01
extern double Maximum = 0.2;
extern int Precision = 7;
double alertBar;
extern int TimeFrame=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,STYLE_DOT);
SetIndexStyle(1,DRAW_ARROW,STYLE_DOT);
SetIndexBuffer(0,sarUp);
SetIndexBuffer(1,sarDn);
SetIndexArrow(0,159);
SetIndexArrow(1,159);
IndicatorShortName("SAR COLORED");
SetIndexLabel(0,"SAR Up Channel");
SetIndexLabel(1,"SAR Down Channel");
SetIndexDrawBegin(0,2);
SetIndexDrawBegin(1,2);
//----
switch(TimeFrame)
{
case 1 : string TimeFrameStr="Period_M1"; break;
case 5 : TimeFrameStr="Period_M5"; break;
case 15 : TimeFrameStr="Period_M15"; break;
case 30 : TimeFrameStr="Period_M30"; break;
case 60 : TimeFrameStr="Period_H1"; break;
case 240 : TimeFrameStr="Period_H4"; break;
case 1440 : TimeFrameStr="Period_D1"; break;
case 10080 : TimeFrameStr="Period_W1"; break;
case 43200 : TimeFrameStr="Period_MN1"; break;
default : TimeFrameStr="Current Timeframe";
}
return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
// Plot defined time frame on to current time frame
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
limit=Bars-counted_bars;
for(i=0,y=0;i<limit;i++)
{
if (Time[i]<TimeArray[y]) y++;
double sar = NormalizeDouble(iSAR(Symbol(),TimeFrame,Step,Maximum,y),Precision);
if(sar >= iHigh(Symbol(),0,i))
{
if(AlertsEnabled==true && sarUp[i] == 0 && Bars>alertBar)
{
PlaySound("alert.wav");
// Alert("Parabolic SAR Going Down on ",Symbol(),"-",Period());
if(email)SendMail("Parabolic SAR Going Down on ",Symbol());
alertBar = Bars;
}
sarUp[i] = sar;
sarDn[i] = 0;
}
else
{
if(AlertsEnabled==true && sarDn[i] == 0 && Bars>alertBar)
{
PlaySound("alert.wav");
//Alert("Parabolic SAR Channel Going Up on ",Symbol(),"-",Period());
if(email)SendMail("Parabolic SAR Going Up on ",Symbol());
alertBar = Bars;
}
sarUp[i] = 0;
sarDn[i] = sar;
WindowRedraw();
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---