Miscellaneous
0
Views
0
Downloads
0
Favorites
Uni_Ind_Sound
//+------------------------------------------------------------------+
//| Universalny_Sound_indicator.mq4
//| Copyright © 2011, lukas1
//| Ïðàâîîáëàäàòåëü Ëóêàøóê Âèêòîð Ãåííàäüåâè÷ aka lukas1
//| Âíèìàíèå: äàííàÿ ïðîãðàììà íå áóäåò ðàáîòàòü ïðèíöèïèàëüíî
//| ñî ñòàíäàðòíûìè âñòðîåííûìè èíäèêàòîðàìè,
//| ðàáîòàåò òîëüêî ñ ïîëüçîâàòåëüñêèìè èíäèêàòîðàìè.
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, lukas1"
#property link "lukas1@ngs.ru"
#include <WinUser32.mqh>
#property indicator_separate_window
//---- indicator parameters
extern string Indicator_Name="Bulls";
extern double Alert_Level = 0;
#property indicator_color1 Silver
//---- indicator buffers
double Buffer2[];
//----
int br1=0;
string ticker;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{ticker=StringTrimRight(StringTrimLeft(Indicator_Name));
IndicatorBuffers (1);
IndicatorDigits (Digits);
IndicatorShortName("UniSound ("+ticker+")");
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,Buffer2);
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{int limit;
int counted_bars = IndicatorCounted();
//---- check for possible errors
if(counted_bars < 0)
return(-1);
//---- last counted bar will be recounted
if(counted_bars > 0)
counted_bars--;
limit = Bars - counted_bars;
if(counted_bars==0) limit--;
//----
for(int i = limit; i >=0; i--)
//for(int i = 1000; i >=0; i--)
{
Buffer2[i]=iCustom(Symbol(),0, ticker, 0,i);
}
if(((Buffer2[2]<0 && Buffer2[1]>Alert_Level) ||
(Buffer2[2]>0 && Buffer2[1]<Alert_Level)) && br1<Bars )
{
PlaySound("alert.wav"); Sleep(500);
PlaySound("alert.wav"); Sleep(500);
PlaySound("alert.wav"); br1=Bars;
Alert("Íà ",Symbol()," \"",Indicator_Name, "\" ïåðåñå÷åíèå ñ =0= ");
Print("Íà ",Symbol()," \"",Indicator_Name, "\" ïåðåñå÷åíèå ñ =0= ");
}
}
//+------------------------------------------------------------------+
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
---