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);
}













Sample





Analysis



Market Information Used:

Series array that contains the lowest prices of each bar
Series array that contains the highest prices of each bar


Indicator Curves created:


Implements a curve of type DRAW_ARROW

Indicators Used:




Custom Indicators Used:
BtTrendTrigger-T

Order Management characteristics:

Other Features: