//+------------------------------------------------------------------+
//| T3_TRIX_exit.mq4 |
//| main idea kalenzo, simone@konto.pl |
//| modify hada |
//+------------------------------------------------------------------+
#property copyright "Kalenzo"
#property link "http://www.forex-tsd.com"
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
extern int A_t3_period=50;
extern int num_bars=1500;
extern int is_A_open_price=0;
extern int B_t3_period_ac=34;
extern int diferential=0;
extern double hot=0.5;
double exitL[],exitS[];
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_ARROW,EMPTY,1);
SetIndexStyle(1,DRAW_ARROW,EMPTY,1);
SetIndexBuffer(0,exitL);
SetIndexBuffer(1,exitS);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) counted_bars=0;
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
//----
for(int i = 0 ;i < limit ;i++)
{
double f1u = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,0,i);
double f2u = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,0,i+1);
double f3u = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,0,i+2);
double f1d = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,1,i);
double f2d = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,1,i+1);
double f3d = iCustom(Symbol(),0,"T3 TRIX",A_t3_period,num_bars,is_A_open_price,B_t3_period_ac,diferential,hot,1,i+2);
if(f1u < f2u && f2u > f3u)
{
exitL[i] = Low[i];
exitS[i] = 0.0;
}
else if(f1d > f2d && f2d < f3d)
{
exitS[i] = High[i];
exitL[i] = 0.0;
}
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments