Author: Copyright � 2004, MetaQuotes Software Corp.
Price_main
Miscellaneous
Implements a curve of type %1It plays sound alerts
0 Views
0 Downloads
0 Favorites
Price_main
//+------------------------------------------------------------------+
//|                                                  Heiken Ashi.mq4 |
//|                      Copyright © 2004, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| For Heiken Ashi we recommend next chart settings ( press F8 or   |
//| select on menu 'Charts'->'Properties...'):                       |
//|  - On 'Color' Tab select 'Black' for 'Line Graph'                |
//|  - On 'Common' Tab disable 'Chart on Foreground' checkbox and    |
//|    select 'Line Chart' radiobutton                               |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Magenta
#property indicator_width1 3
#property indicator_width2 3

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double counthigh;
double countlow;
double alertBar;
double prev;
extern int SoundAlertMode = 0;
extern int messageAlert = 1;
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW, STYLE_SOLID);
    SetIndexArrow(0, 233);
  SetIndexBuffer(0, ExtMapBuffer1);
  SetIndexStyle(1,DRAW_ARROW, STYLE_SOLID);
       SetIndexArrow(1,234);
   SetIndexBuffer(1, ExtMapBuffer2);

      
//       SetIndexStyle(2,DRAW_HISTOGRAM);
//           SetIndexArrow(2,233);
//  SetIndexBuffer(2, ExtMapBuffer3);
//   SetIndexStyle(3,DRAW_HISTOGRAM);
//         SetIndexArrow(3,233);
//   SetIndexBuffer(3, ExtMapBuffer4);
//----
   SetIndexDrawBegin(0,5);
//---- indicator buffers mapping
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
//   SetIndexBuffer(2,ExtMapBuffer3);
//   SetIndexBuffer(3,ExtMapBuffer4);
//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double BarOpen, BarHigh, BarLow, BarClose;
   if(Bars<=10) return(0);
   ExtCountedBars=IndicatorCounted();
//---- check for possible errors
   if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
   if (ExtCountedBars>0) ExtCountedBars--;
   int pos=Bars-ExtCountedBars-1;
   while(pos>0)
     {
      BarOpen=Open[pos];
      BarClose=Close[pos];
      BarHigh=High[pos];
      BarLow=Low[pos];
      if (BarOpen<BarClose) 
        {
      if(prev != 2 && Bars>alertBar && BarOpen != BarClose && ExtMapBuffer1[pos] == ExtMapBuffer2[pos]) {ExtMapBuffer1[pos]=BarLow;prev=2;
       if(SoundAlertMode > 0 ) PlaySound("expert.wav");alertBar = Bars;}
   if(ExtMapBuffer1[pos] > ExtMapBuffer2[pos]) counthigh=counthigh + 1;
        } 
    if (BarOpen>BarClose) 
        {
      if(prev != 1 && Bars>alertBar && BarOpen != BarClose && ExtMapBuffer1[pos] == ExtMapBuffer2[pos]) {ExtMapBuffer2[pos]=BarHigh;prev = 1;
       if(SoundAlertMode > 0 ) PlaySound("blip2.wav");alertBar = Bars;}
   if(ExtMapBuffer1[pos] < ExtMapBuffer2[pos]) countlow=countlow + 1;
        } 
  	   pos--;
     }
//----
   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 ---