Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Aroon oscillator - arrows main chart
//+------------------------------------------------------------------+
//| Aroon oscillator.mq4 |
//| mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link "mladenfx@gmail.com"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Red
extern int AroonPeriod = 25;
extern int Filter = 50;
extern string Alerts_Settings = "Settings for alerts";
extern bool alerts.On = false;
extern bool alerts.OnCurrent = false;
extern bool alerts.Message = true;
extern bool alerts.Sound = false;
extern bool alerts.Email = false;
//
//
//
//
//
double buffer1[];
double buffer2[];
double buffer3[];
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
int init()
{
IndicatorBuffers(3);
SetIndexBuffer(0,buffer1); SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,108);
SetIndexBuffer(1,buffer2); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,108);
SetIndexBuffer(2,buffer3);
IndicatorShortName("Aroon oscillator ("+AroonPeriod+")");
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--)
{
double AroonUp = 100.0*(AroonPeriod-iHighest(NULL,0,MODE_HIGH,AroonPeriod,i)+i)/AroonPeriod;
double AroonDn = 100.0*(AroonPeriod- iLowest(NULL,0,MODE_LOW ,AroonPeriod,i)+i)/AroonPeriod;
buffer1[i] = EMPTY_VALUE;
buffer2[i] = EMPTY_VALUE;
buffer3[i] = AroonUp-AroonDn;
if (buffer3[i]> Filter && buffer3[i+1]< Filter) buffer1[i]= Low[i] -iATR(NULL,0,20,i)/2.0;
if (buffer3[i]<-Filter && buffer3[i+1]>-Filter) buffer2[i]= High[i]+iATR(NULL,0,20,i)/2.0;
}
//
//
//
//
//
if (alerts.On)
{
if (alerts.OnCurrent)
int forBar = 0;
else forBar = 1;
//
//
//
//
//
if (buffer1[forBar]!= EMPTY_VALUE) doAlert("Arron oscillator trend chaned to UP");
if (buffer2[forBar]!= EMPTY_VALUE) doAlert("Arron oscillator trend chaned to 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)," Aroon oscillator - ",doWhat);
if (alerts.Message) Alert(message);
if (alerts.Email) SendMail("Arron oscillator",message);
if (alerts.Sound) PlaySound("alert2.wav");
}
}
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
---