Miscellaneous
0
Views
0
Downloads
0
Favorites
geAlertPrice[1]
//+------------------------------------------------------------------+
//| geAlertCanal.mq4 |
//| Copyright © 2007, ver 1.0 |
//| Forte928 |
//+------------------------------------------------------------------+
#property copyright "Forte928"
#property link ""
#define IndicatorName "geAlertCanal"
#property indicator_chart_window
//#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Gold//Goldenrod//LightSkyBlue
#property indicator_color2 Lime
#property indicator_color3 Gold//PaleGreen
extern int Canal = 5;
extern color CanalColor = LimeGreen;
extern int StepPoint = 5; // ñèãíàë ïðè èçìåíåíèè öåíû íà
extern bool HighAlert = true;
extern string HighSound = "HighUp.wav";
extern bool LowAlert = true;
extern string LowSound = "LowDown.wav";
extern bool StepAlert = true;
extern string UpperSound = "Upper.wav";
extern string DownerSound = "Downer.wav";
extern bool CenterAlert = true;
extern string CenterSound = "Center.wav";
extern int Counter = 2000;
double FxView1[];
double FxView2[];
double FxView3[];
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~V~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
string PrefixLow="_LOW_";
string PrefixHigh="_HIGH_";
string PrefixPrice="_PRICE_";
double PriceSave=0;
double PriceUpper=0;
double PriceCenter=0;
double PriceLower=0;
double PriceSound=0;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~V~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Custom indicator initialization function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int init()
{
SetupChartLineColor(0,FxView1,0,1,CanalColor,"Upper");
SetupChartLineColor(1,FxView2,0,1,CanalColor,"Center");
SetupChartLineColor(2,FxView3,0,1,CanalColor,"Lower");
PriceUpper=Close[0]+Canal*Point;
PriceCenter=Close[0];
PriceLower=Close[0]-Canal*Point;
PriceSound=PriceCenter;
PriceSave=PriceCenter;
return(0);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~V~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Custom indicator deinitialization function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int deinit()
{
//----
ObjectDelete(PrefixHigh);
ObjectDelete(PrefixPrice);
ObjectDelete(PrefixLow);
//----
return(0);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~V~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Start defination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int start()
{
double Price=Close[0];
bool AlertActive=false;
/* if (ObjectFind(PrefixLow)<0) {
ObjectCreate(PrefixLow,OBJ_LABEL,0,Time[0],PriceLower);
ObjectSet(PrefixLow,OBJPROP_COLOR,CanalColor);
ObjectSet(PrefixLow,OBJPROP_WIDTH,CanalWigth);
ObjectSet(PrefixLow,OBJPROP_ARROWCODE,6);
}
if (ObjectFind(PrefixHigh)<0) {
ObjectCreate(PrefixHigh,OBJ_LABEL,0,Time[0],PriceUpper);
ObjectSet(PrefixHigh,OBJPROP_COLOR,CanalColor);
ObjectSet(PrefixHigh,OBJPROP_WIDTH,CanalWigth);
ObjectSet(PrefixHigh,OBJPROP_ARROWCODE,6);
}
if (ObjectFind(PrefixPrice)<0) {
ObjectCreate(PrefixPrice,OBJ_LABEL,0,Time[0],PriceCenter);
ObjectSet(PrefixPrice,OBJPROP_COLOR,CanalColor);
ObjectSet(PrefixPrice,OBJPROP_WIDTH,CanalWigth);
ObjectSet(PrefixPrice,OBJ_TEXT,DoubleToStr(PriceCenter,MathLog(1/Point)/MathLog(10)));
}
*/
// îïóñêàíèå öåíû íèæå óðîâíÿ êàíàëà
if (PriceLower>Price) {
PriceSave=Price;
PriceSound=Price;
PriceUpper=Price+2*Canal*Point;
PriceCenter=Price+Canal*Point;
PriceLower=Price;
PlaySound(LowSound);
}
// ïîäüåì öåíû âûøå óðîâíÿ êàíàëà
if (PriceUpper<Price) {
PriceSave=Price;
PriceSound=Price;
PriceUpper=Price;
PriceCenter=Price-Canal*Point;
PriceLower=Price-2*Canal*Point;
PlaySound(HighSound);
}
ArrayInitialize(FxView1,PriceUpper);
ArrayInitialize(FxView2,PriceCenter);
ArrayInitialize(FxView3,PriceLower);
Comment((PriceSave-PriceCenter)/Point," ",(Price-PriceCenter)/Point," ",MathAbs(PriceSound-Price)/Point);
// äâèæåíèå öåííû ÷åðåç öåíòð êàíàëà
if (CenterAlert==true){
if ((PriceSave<PriceCenter)&&(PriceCenter<Price)) {
PriceSave=Price;
//PlaySound(UpperSound);Sleep(10000);
PlaySound(CenterSound);
}
if ((PriceSave>PriceCenter)&&(PriceCenter>Price)) {
PriceSave=Price;
//PlaySound(DownerSound);Sleep(10000);
PlaySound(CenterSound);
}
// if (((PriceSave-PriceCenter)*(PriceCenter-Price))<0) PriceSave=Price;
if ((PriceSave-PriceCenter)==0) PriceSave=Price;
}
// èçìåíåíèå öåíû íà øàã
if (((MathAbs(PriceSound-Price)/Point)>=StepPoint)) {
if ((PriceSound<Price)&&(StepAlert==true)) {
PlaySound(UpperSound);//Sleep(10000);PlaySound(StepSound);
}
if ((PriceSound>Price)&&(StepAlert==true)) {
PlaySound(DownerSound);//Sleep(10000);PlaySound(StepSound);
}
PriceSound=Price;
}
//----
return(0);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//------------------------------------------ Style active Line --------------------------
void SetupChartLineColor(int Index,double& ViewAy[],int Style,int Width,color ColorLine,string Label)
{
switch(Style)
{
case 0 : SetIndexStyle(Index,DRAW_LINE,STYLE_DASHDOT,Width,ColorLine);break;
case 1 : SetIndexStyle(Index,DRAW_HISTOGRAM,STYLE_DASHDOT,Width,ColorLine);break;
case 2 : SetIndexStyle(Index,DRAW_ARROW,STYLE_DASHDOT,Width,ColorLine);break;
default : SetIndexStyle(Index,DRAW_LINE,STYLE_DASHDOT,Width,ColorLine);break;
}
if (Label!="") SetIndexLabel(Index,Label);
SetIndexBuffer(Index,ViewAy);
return(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
---