Bar_ytg_Alert_New_Bar

Author: Yuriy Tokman
Bar_ytg_Alert_New_Bar
Miscellaneous
It issuies visual alerts to the screenIt plays sound alerts
0 Views
0 Downloads
0 Favorites
Bar_ytg_Alert_New_Bar
//+------------------------------------------------------------------+
//|                                            ytg_Alert_New_Bar.mq4 |
//|                                                     Yuriy Tokman |
//|                                            yuriytokman@gmail.com |
//+------------------------------------------------------------------+
#property copyright "Yuriy Tokman"
#property link      "yuriytokman@gmail.com"
//Çâóêîâàÿ èíäèêàöèÿ íîâîãî áàðà
//Ïî èäåå Bidrio

#property indicator_chart_window

extern bool off_Alert      = false;
extern bool off_Play_Sound = false;
string NameFileSound       = "expert.wav";

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   if(NevBar())
    {
     if(!off_Alert)Alert("New Bar;"," Time Frame=",GetNameTF(),"; CurTime=",TimeToStr(TimeCurrent(), TIME_MINUTES));
     if(!off_Play_Sound)PlaySound(NameFileSound);
    }
   return(0);
  }
//+----------------------------------------------------------------------------+
// Ôóíêöèÿ êîíòðîëÿ íîâîãî áàðà                                                |
//-----------------------------------------------------------------------------+
bool NevBar(){
   static int PrevTime=0;
   if (PrevTime==Time[0]) return(false);
   PrevTime=Time[0];
   return(true);}
//+----------------------------------------------------------------------------+
//|  Àâòîð    : Êèì Èãîðü Â. aka KimIV,  http://www.kimiv.ru                   |
//+----------------------------------------------------------------------------+
//|  Âåðñèÿ   : 01.09.2005                                                     |
//|  Îïèñàíèå : Âîçâðàùàåò íàèìåíîâàíèå òàéìôðåéìà                             |
//+----------------------------------------------------------------------------+
//|  Ïàðàìåòðû:                                                                |
//|    TimeFrame - òàéìôðåéì (êîëè÷åñòâî ñåêóíä)      (0 - òåêóùèé ÒÔ)         |
//+----------------------------------------------------------------------------+
string GetNameTF(int TimeFrame=0) {
  if (TimeFrame==0) TimeFrame=Period();
  switch (TimeFrame) {
    case PERIOD_M1:  return("M1");
    case PERIOD_M5:  return("M5");
    case PERIOD_M15: return("M15");
    case PERIOD_M30: return("M30");
    case PERIOD_H1:  return("H1");
    case PERIOD_H4:  return("H4");
    case PERIOD_D1:  return("Daily");
    case PERIOD_W1:  return("Weekly");
    case PERIOD_MN1: return("Monthly");
    default:         return("UnknownPeriod");
  }
}

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