geAlertPrice[1]

Download script
Author: Forte928
geAlertPrice[1]

The geAlertCanal script is an automated monitoring tool designed to track live price movements and provide real-time audio alerts based on specific boundary conditions. Instead of just showing static data, it acts as a dynamic "tracking channel" that follows the market price and triggers notifications when certain price thresholds are breached.

Core Logic and Functionality

Dynamic Boundary Tracking The primary purpose of this script is to maintain three specific price levels: an Upper level, a Center level, and a Lower level. These levels are not fixed; they shift dynamically based on the current market price. The script constantly calculates these positions to ensure that a "channel" exists around the current price action.

Automatic Channel Adjustment The script is programmed to react intelligently when the price pushes outside of its established boundaries:

  • Upper Breach: If the market price rises above the set upper limit, the script automatically shifts the entire channel upward to accommodate the new price movement and plays a corresponding high-alert sound.
  • Lower Breach: Conversely, if the price drops below the lower limit, the script shifts the channel downward and triggers a low-alert sound.

Key Alert Triggers The tool is designed to notify the user of three specific types of market behavior:

  1. Boundary Crossings (High/Low): These are the primary alerts triggered when the price breaks out of the dynamic range established by the script.
  2. Centerline Penetration: The script monitors if the price crosses through the middle (Center) of the current channel. If the price moves from one side of the center to the other, it triggers a specific "Center" audio notification. This is useful for identifying shifts in momentum or local trends.
  3. Significant Distance Alerts (Step Alerts): The script tracks how far the current price has moved away from its "reference sound" point. If the price moves by a pre-defined number of points (the "StepPoint"), it triggers a secondary alert. This helps traders monitor volatility or rapid expansions in price movement that may occur within a single trend.

Visual and Audio Feedback

To ensure the user is always aware of the market state without needing to constantly watch the screen:

  • Visuals: The script draws lines on the chart representing the Upper, Center, and Lower levels, providing a clear visual "zone" for the price.
  • Audio: Each of the logical conditions mentioned above (High, Low, Center, and Step) can be assigned a unique sound file. This creates an auditory map of market behavior, allowing the user to distinguish between a trend continuation, a centerline break, or a significant price jump just by listening.

Summary for the User

In short, this script creates a "floating" safety net around the current price. It follows the price as it moves, alerts you when that price breaks out of the net, notifies you when it passes through the middle of the net, and gives you a secondary signal if the price moves too quickly in one direction.

Miscellaneous
It plays sound alertsImplements a curve of type %1
18 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