HA_Signal_1

Download script
HA_Signal_1

This script is a technical analysis tool designed to identify potential trend reversal points by analyzing price volatility and momentum. It simplifies complex market movements into visual signals on your trading chart, helping traders spot where a move might be exhausting or shifting direction.

How the Logic Works

The script operates by looking at three specific layers of market data:

1. Volatility and Range Analysis First, the tool calculates the "average range" of price movement over a rolling window of recent bars. It measures the distance between the highest and lowest prices to understand how much the market is currently "breathing." It then uses this average to identify significant price gaps or sudden bursts of movement that exceed standard volatility.

2. Momentum Tracking The script monitors the momentum of the market using a modified calculation (similar to a Williams Percent Range). It adjusts its sensitivity based on the specific behavior of the price—specifically checking for large candles or significant jumps in closing prices. By doing this, it attempts to determine if the current trend is still strong or if it is beginning to lose steam.

3. Signal Generation (Buy and Sell) The core logic looks for a "breakout" from a neutral zone:

  • Sell Signals: When the momentum drops below a certain threshold (indicating a downward move) and then pushes significantly higher than the previous trend's range, the script identifies a potential reversal. It marks this on your chart with a specific arrow.
  • Buy Signals: Conversely, when momentum rises above a certain threshold (indicating an upward move) and then drops significantly below the previous range, it identifies a potential buying opportunity and marks it with a different arrow.

Key Features for the User

  • Visual Alerts: Instead of raw numbers, the script places arrows directly on your chart to highlight these turning points in real-time.
  • Risk Customization: You can adjust the "Risk" parameter, which modifies how sensitive the tool is to price fluctuations. A higher risk setting makes the signals more conservative, while a lower setting makes them more sensitive to minor moves.
  • Audio Notifications: The script includes a notification system that triggers an audible alert when a new Buy or Sell signal appears on the most recent candle, ensuring you don't miss a move while away from the screen.
  • Dynamic Context: It automatically filters out "noise" by checking if the price has moved enough to be considered a meaningful shift, rather than just minor market fluctuation.
Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
15 Views
0 Downloads
0 Favorites
HA_Signal_1
//+------------------------------------------------------------------+
//| ASCTrend1sig_noSound.mq4 
//| Ramdass - Conversion only
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Yellow

//---- input parameters
extern int RISK=3;
extern int CountBars=300;
extern bool SoundON=true;
bool TurnedUp = false;
bool TurnedDown = false;  

//---- buffers
double val1[];
double val2[];


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,234);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,233);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| ASCTrend1sig                                                     |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=1000) CountBars=950;
   SetIndexDrawBegin(0,Bars-CountBars+11+1);
   SetIndexDrawBegin(1,Bars-CountBars+11+1);
   int i,shift,counted_bars=IndicatorCounted();
   int Counter,i1,value10,value11;
   double value1,x1,x2;
   double value2,value3;
   double TrueCount,Range,AvgRange,MRO1,MRO2;
   double Table_value2[1000];
   
   value10=3+RISK*2;
   x1=67+RISK;
   x2=33-RISK;
   value11=value10;
//----
   if(Bars<=11+1) return(0);
//---- initial zero
   if(counted_bars<11+1)
   {
      for(i=1;i<=0;i++) val1[CountBars-i]=0.0;
      for(i=1;i<=0;i++) val2[CountBars-i]=0.0;
   }
//----
   shift=CountBars-11-1;
   while(shift>=0)
     {
     
   Counter=shift;
	Range=0.0;
	AvgRange=0.0;
	for (Counter=shift; Counter<=shift+9; Counter++) AvgRange=AvgRange+MathAbs(High[Counter]-Low[Counter]);
		
	Range=AvgRange/10;
	Counter=shift;
	TrueCount=0;
	while (Counter<shift+9 && TrueCount<1)
		{if (MathAbs(Open[Counter]-Close[Counter+1])>=Range*2.0) TrueCount=TrueCount+1;
		Counter=Counter+1;
		}
	if (TrueCount>=1) {MRO1=Counter;} else {MRO1=-1;}
	Counter=shift;
	TrueCount=0;
	while (Counter<shift+6 && TrueCount<1)
		{if (MathAbs(Close[Counter+3]-Close[Counter])>=Range*4.6) TrueCount=TrueCount+1;
		Counter=Counter+1;
		}
	if (TrueCount>=1) {MRO2=Counter;} else {MRO2=-1;}
	if (MRO1>-1) {value11=3;} else {value11=value10;}
	if (MRO2>-1) {value11=4;} else {value11=value10;}
	value2=100-MathAbs(iWPR(NULL,0,value11,shift)); // PercentR(value11=9)
	Table_value2[shift]=value2;
	val1[shift]=0;
	val2[shift]=0;
	value3=0;
	if (value2<x2)
		{i1=1;
		while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
		if (Table_value2[shift+i1]>x1) 
			{
			value3=High[shift]+Range*0.5;
			val1[shift]=value3;
			  if (shift == 0 && SoundON==true && !TurnedUp){
            Alert("EJ Sell signal at ", Symbol(),"-",Period());
            TurnedUp = true;
            TurnedDown = false;
      }
			  Comment("High val1= ",val1[shift],"val2= ",val2[shift],"value2= ",value2,"value3= ",value3,"shift= ",shift);
			} 
		}
	if (value2>x1)
		{i1=1;
		while (Table_value2[shift+i1]>=x2 && Table_value2[shift+i1]<=x1){i1++;}
		if (Table_value2[shift+i1]<x2) 
			{
			value3=Low[shift]-Range*0.5;
			val2[shift]=value3;
       if (shift == 0 && SoundON==true && !TurnedDown){
            Alert("EJ Buy signal at ",Symbol(),"-",Period());
            TurnedDown = true;
            TurnedUp = false;
      }
					  Comment("Low val1= ",val1[shift],"val2= ",val2[shift],"value2= ",value2,"value3= ",value3,"shift= ",shift);
	
			}
  		}

      shift--;
     }

   return(0);
  }
//+------------------------------------------------------------------+


Comments