BtTrendSignal

Download script
Author: Paul Y. Shimada
BtTrendSignal

This script functions as a specialized visual tool designed to help traders identify shifts in market momentum and trend direction. Instead of just showing the price movement, it analyzes underlying mathematical trends to highlight specific "trigger" points where a shift from one trend to another might be occurring.

Core Logic Overview

The tool operates by calculating a trend factor based on recent price history. It looks at a specific window of past bars (the user-defined timeframe) to determine the strength and direction of the current market movement. By comparing these results against pre-set thresholds, it identifies "breakout" moments where the trend crosses important boundaries.

How it Identifies Signals

The logic focuses on four primary types of market movements, which are displayed as visual icons on your chart:

  • Bullish Momentum (Buy signals): The script monitors when the trend factor rises from a negative territory into a positive zone or crosses a specific upper boundary. When these conditions align, it places a signal below the price.
  • Bearish Momentum (Sell signals): Conversely, it tracks when the trend factor drops from positive territory into a negative zone or breaks through a lower boundary. It marks these points above the price.
  • Trend Reversals: The tool is designed to recognize "cross-overs." It identifies moments where the trend value flips from positive to negative (or vice versa) more sharply than standard fluctuations, helping to highlight potential exhaustion in one direction and the beginning of another.

Visual Representation

To make this information easy to read at a glance:

  1. Upward Signals: Indicated by specific icons appearing below the candles, signaling potential bullish strength.
  2. Downward Signals: Indicated by specific icons appearing above the candles, signaling potential bearish strength.
  3. Trend Clarity: By using distinct colors and positions, the tool allows a trader to quickly see whether the current market "temperature" is heating up in a buying direction or cooling down into a selling trend.

Key Variables for Customization

While the internal math remains consistent, the script allows you to adjust how sensitive it is:

  • Computation Window: You can change how many past bars the script considers when calculating the trend.
  • Thresholds: You can adjust the "boundaries" (upper and lower limits) that trigger the icons, allowing you to filter out minor market noise and focus only on significant moves.
Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
BtTrendSignal
//+------------------------------------------------------------------------+
//| MQL to MQ4 by Maloma                              BtTrendTrigger-T.mq4 |
//| Modified version of Trend Trigger Factor by Tartan                     |
//| Technical Analysis of Stocks and Commodities, Dec. 2004,p.28. M.H. Pee |
//+------------------------------------------------------------------------+
#property copyright "Paul Y. Shimada"
#property  link     "PaulYShimada@Y..."

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Gold
#property indicator_color2 Lime
#property indicator_color3 Red
#property indicator_width1  3
#property indicator_width2  3
#property indicator_width3  3

extern int    TTFbars=15; //15=default number of bars for computation.
extern int    t3_period=5;
extern double b=0.7;
extern int    ppor=50;
extern int    mpor=-50;
extern int    barBegin=1000; //<1000 recommended for faster speed, 0=All bars computed & plotted.

double Buffer1[];
double Buffer2[];
double Buffer3[];
double ATTF[];

int loopBegin;

double HighestHighRecent=0, HighestHighOlder=0, LowestLowRecent=0, LowestLowOlder=0;

int init()
  {
//---- indicator buffers mapping  
    SetIndexBuffer(0,Buffer1);
    SetIndexBuffer(1,Buffer2);   
    SetIndexBuffer(2,Buffer3);
//---- drawing settings
    SetIndexStyle(0,DRAW_ARROW);
    SetIndexArrow(0,241);
    SetIndexStyle(1,DRAW_ARROW);
    SetIndexArrow(1,242);
    SetIndexStyle(2,DRAW_ARROW);
    SetIndexArrow(2,159);
//----
    SetIndexEmptyValue(0,0.0);
    SetIndexEmptyValue(1,0.0);
    SetIndexEmptyValue(1,0.0);
//---- name for DataWindow
    SetIndexLabel(0,"BTS1");
    SetIndexLabel(1,"BTS2");
    SetIndexLabel(1,"xxx");
//---- initialization done   
    IndicatorShortName("BtTrendSignal");
    ArrayResize(ATTF,barBegin); 
   return(0);
  }

int    ks=0,kb=0,kss=0,ksb=0,m=0;

int start()
{
 loopBegin = loopBegin - TTFbars + 1;
 m=0;  
 for(int i=loopBegin;i>=0;i--)
  {m++;
   ATTF[m]=iCustom(Symbol(),0,"BtTrendTrigger-T",TTFbars,t3_period,b,ppor,mpor,barBegin,0,i);
   if(ATTF[m-1]<ATTF[m] && ATTF[m]<ppor && ATTF[m-1]>0) kb=0;
   if(ATTF[m-1]>ATTF[m] && ATTF[m]>mpor && ATTF[m-1]<0) ks=0;
   if(ATTF[m-1]<0 && ATTF[m]>0) ksb=0;
   if(ATTF[m-1]>0 && ATTF[m]<0) kss=0;
   if(ATTF[m-1]<mpor && ATTF[m]>mpor && kb==0)
    {
     kb=1;
     Buffer1[i]=Low[i]-6*Point;
    }
   if(((ATTF[m-1]>ppor && ATTF[m]<ppor) || (ATTF[m-1]>0 && ATTF[m]<0)) && ksb==0)
    {
     ksb=1;
     Buffer3[i]=High[i];
    }
   
   if(ATTF[m-1]>ppor && ATTF[m]<ppor && ks==0)
    {
     ks=1;
     Buffer2[i]=High[i]+6*Point;
    }
   if(((ATTF[m-1]<mpor && ATTF[m]>mpor) || (ATTF[m-1]<0 && ATTF[m]>0)) && kss==0)
    {
     kss=1;
     Buffer3[i]=Low[i];
    } 
  }
 return(0);
}









Comments