BT1_v1

This tool is designed to analyze market trends by identifying specific price actions and translating them into visual signals on your trading chart. Its primary objective is to distinguish between significant momentum shifts and standard market noise, helping traders recognize when a trend is established.

How the Logic Works

The script operates by performing three main analytical steps for every historical data point on your chart:

1. Volatility and Range Analysis The tool first looks at the recent price action to calculate the "Average Range." It measures the distance between the highs and lows over a specific window of time. This helps the script understand what "normal" price movement looks like for the current market condition.

2. Momentum Verification Once the average range is established, the tool searches for two specific types of aggressive movements:

  • Gap/Breakout Detection: It looks for instances where the difference between the opening and closing prices exceeds double the average range.
  • Trend Acceleration: It checks for significant price spans (specifically looking for moves that are more than 4.6 times the average range) within a shorter timeframe.

If these movements are detected, the tool "confirms" that a high-momentum trend is occurring, rather than just random fluctuation.

3. Signal Generation After verifying the momentum, the script uses a specialized calculation (based on a percentage-based oscillator) to determine the strength of the move. It then plots visual indicators based on two thresholds:

  • Bullish Bias: If the upward momentum is sufficiently strong (exceeding a high-percentage threshold), it signals a potential upward trend.
  • Bearish Bias: If the downward momentum is dominant (dropping below a low-percentage threshold), it signals a potential downward trend.

Visual Output

The results are displayed as histogram bars on your chart. These bars effectively act as "trend markers," highlighting areas where the price action has met the mathematical criteria for a significant move, allowing you to see the direction and strength of the market trend more clearly at a glance.

Indicators Used
Larry William percent range indicator
Miscellaneous
Implements a curve of type %1
15 Views
0 Downloads
0 Favorites
BT1_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+-----------------------------------------------------------------------+
//|                                                       BrainTrend1.mq4 |
//|                                   Copyright © 2005. Alejandro Galindo |
//|                                                   http://elCactus.com |
//|         ASCTrend1 modified to generate similar signals to BrainTrend1 |
//|           	Author := C0Rpus - big thanks CHANGE2002, STEPAN and SERSH |
//|	                                 Notes := ASCTrend1 3.0 Open Source |
//+-----------------------------------------------------------------------+

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

//---- input parameters
extern int RISK=3;
extern int CountBars=500;

//---- buffers
double Buffer1[];
double Buffer2[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_HISTOGRAM,0,1);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,1);
   SetIndexBuffer(0,Buffer1);
   SetIndexBuffer(1,Buffer2);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| ASCTrend1                                                  |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=Bars) CountBars=Bars;
   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;
   
   value10=3+RISK*2;
   x1=67+RISK;
   x2=33-RISK;
   value11=value10;
//----
   if(Bars<=value11+1) return(0);
//---- initial zero
   if(counted_bars<value11+1)
   {
      for(i=1;i<=0;i++) Buffer1[CountBars-i]=0.0;
      for(i=1;i<=0;i++) Buffer2[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)
   Buffer1[shift]=0;
	Buffer2[shift]=0;
	if (value2>x1)
		{
		Buffer1[shift]=Low[shift]; Buffer2[shift]=High[shift];
		}
	if (value2<x2)
		{
		Buffer1[shift]=High[shift]; Buffer2[shift]=Low[shift];
		}
      
      shift--;
     }

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


Comments