SoundAtOpenNewBar

Author: Copyright � 2008, Serega Lykov
SoundAtOpenNewBar
Miscellaneous
It plays sound alerts
0 Views
0 Downloads
0 Favorites
SoundAtOpenNewBar
//+------------------------------------------------------------------+
//|                                            SoundAtOpenNewBar.mq4 |
//|                                   Copyright © 2008, Serega Lykov |
//|                                       http://mtexperts.narod.ru/ |
//+------------------------------------------------------------------+

#property copyright "Copyright © 2008, Serega Lykov"
#property link      "http://mtexperts.narod.ru/"

//---- property of indicator ----------------------------------------+
#property indicator_chart_window

//---- external parameters ------------------------------------------+
extern string   SoundFile     = "alert.wav";

//---- global variables ---------------------------------------------+
static datetime bartime;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- initialization of parameters
   bartime = Time[0];
//---- finish of initialization
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- finish of deinitialization
   return(0);
  }

//+------------------------------------------------------------------+
//| Sound At Open New Bar                                            |
//+------------------------------------------------------------------+
int start()
  {
   if(bartime == Time[0]) return(0);
   bartime = Time[0];
   PlaySound(SoundFile);
   // finish of iteration
   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 ---