AC Arows Alerts

Author: Winidecorw
Indicators Used
Bill Williams Accelerator/Decelerator oscillator
Miscellaneous
It issuies visual alerts to the screen
2 Views
0 Downloads
0 Favorites
AC Arows Alerts
//+------------------------------------------------------------------+
//|                                       AC Arrows y SendAlerts.mq4 |
//|                                       Copyright 2024, Winidecorw |
//|                                       https://www.winidecorw.es  |
//+------------------------------------------------------------------+
#property copyright "Winidecorw"
#property link      "https://www.mql5.com/es/users/wini"
#property version   "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   2
//--- plot UP
#property indicator_label1  "UP"
#property indicator_type1   DRAW_ARROW
#property indicator_color1  clrDeepSkyBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  2
//--- plot DOWN
#property indicator_label2  "DOWN"
#property indicator_type2   DRAW_ARROW
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  2
//--- indicator buffers
double         UPBuffer[];
double         DOWNBuffer[];

extern int ArrowUP = 233;   // Arrow UP
extern int ArrowDwon = 234; // Arrow DOWN

input bool SendAlert = true; // Send Alerts ?
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,UPBuffer);
   SetIndexArrow(0,ArrowUP);



   SetIndexBuffer(1,DOWNBuffer);
   SetIndexArrow(1,ArrowDwon);

//--- setting a code from the Wingdings charset as the property of PLOT_ARROW
   PlotIndexSetInteger(0,PLOT_ARROW,ArrowUP);
   PlotIndexSetInteger(1,PLOT_ARROW,ArrowDwon);

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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 VelasAtras = (1000 - prev_calculated);

   for(int i = VelasAtras; i>=0; i--)

     {

      double ActualValue =iAC(Symbol(),0,i);
      double CandleOne =iAC(Symbol(),0,i+1);



      if((ActualValue < 0) && (CandleOne > 0))

        {

         DOWNBuffer[i] = (High [i] + 0.0005);
         UPBuffer[i] = EMPTY_VALUE;

         if(i == 0 && SendAlert)   // If i is actual candle & SendAlert is "true"
           {
            Alert("Sell Now!");
           }


        }

      if((ActualValue > 0) && (CandleOne < 0))

        {

         UPBuffer[i] = (Low [i] - 0.0005);
         DOWNBuffer[i] = EMPTY_VALUE;

         if(i == 0 && SendAlert)    // If i is actual candle & SendAlert is "true"
           {
            Alert("Buy Now!");
           }


        }





     }



//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+

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