Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/forex/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/forex/public_html/wp-settings.php on line 18
N :forex decode

N Archives

NRTR_Pilot_alert.mq4

//+------------------------------------------------------------------+
//|                                                         NRTR.mq4 |
//|            Copyright ? 2005, VG many thanks to Konkop and dupidu |
//|                                                      4vg@mail.ru |
//+------------------------------------------------------------------+
#property copyright "VG many thanks to Konkop and dupidu"

#property indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Blue
#property  indicator_color2  Red
#property  indicator_color3  Magenta
#property  indicator_color4  Yellow

double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];
double     ind_buffer4[];

extern double AveragePeriod = 40;
extern bool OCnotAverage = true;
extern int MaxBarsToCount = 200;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(0,AveragePeriod);
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(1,AveragePeriod);
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(2,AveragePeriod);
   SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(3,AveragePeriod);

//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2)
      && !SetIndexBuffer(2,ind_buffer3)&& !SetIndexBuffer(3,ind_buffer4))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("NRTR");
   SetIndexLabel(0,"Sell S/L");
   SetIndexLabel(1,"Buy S/L");
   SetIndexLabel(2,"Sell S/L");
   SetIndexLabel(3,"Buy S/L");

//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int bar, limit, PrevAlertTime;
   double value = 0;
   double price = 0;
   double trend, dK, AvgRange, HLTrend;
//---- TODO: add your code here
   if(Bars<=MaxBarsToCount) return(-1);

for (int shift=MaxBarsToCount; shift>=0; shift--)
    {
    ind_buffer1[shift]=0;
    ind_buffer2[shift]=0;
    ind_buffer3[shift]=0;
    ind_buffer4[shift]=0;
    }

AvgRange=0;
for (int i=1; i<=AveragePeriod; i++) AvgRange+= MathAbs(High[i]-Low[i]);
dK = AvgRange/AveragePeriod/Point/10000;

if (OCnotAverage)
{
if (Close[MaxBarsToCount] > Open[MaxBarsToCount])
   {
   value = Close[MaxBarsToCount] * (1 - dK);
   trend = 1;
   ind_buffer2[MaxBarsToCount] = value;
   }
if (Close[MaxBarsToCount] < Open[MaxBarsToCount])
   {
   value = Close[MaxBarsToCount] * (1 + dK);
   trend = -1;
   ind_buffer1[MaxBarsToCount] = value;
   }
for (bar = MaxBarsToCount - 1; bar >= 0; bar--)
    {
    if (trend >= 0)
       {
       if (Low[bar] > price)  price = Close[bar];
       value = price * (1 - dK);
       if (Close[bar] < value)
          {
          price = Close[bar];
          value = price * (1 + dK);
          trend = -1;
          }
       }
    else
    if (trend <= 0)
       {
       if (High[bar] < price) price = Close[bar];
       value = price * (1 + dK);
       if (Close[bar] > value)
          {
          price = Close[bar];
          value = price * (1 - dK);
          trend = 1;
          }
       }
    if (trend == -1) ind_buffer1[bar] = value;
    if (trend == 1) ind_buffer2[bar] = value;
    }
    if (CurTime() - PrevAlertTime > Period()*60)
    {
    if ((ind_buffer1[0] != ind_buffer1[1]) || (ind_buffer2[0] != ind_buffer2[1]))
       {
       Alert("??? S/L ? ",value);
       PrevAlertTime = CurTime();
       }
    }

}
else
{
if ((High[MaxBarsToCount] + Low[MaxBarsToCount])/2 > (High[MaxBarsToCount-1] + Low[MaxBarsToCount-1])/2)
   {
   value = (High[MaxBarsToCount] + Low[MaxBarsToCount])/2 * (1 - dK);
   HLTrend = 1;
   ind_buffer4[MaxBarsToCount] = value;
   }
   else
   {
   value = (High[MaxBarsToCount] + Low[MaxBarsToCount])/2 * (1 + dK);
   HLTrend = -1;
   ind_buffer3[MaxBarsToCount] = value;
   }
for (bar = MaxBarsToCount - 1; bar >= 0; bar--)
    {
    if (HLTrend >= 0)
       {
       if (Low[bar] > price) price = (High[bar] + Low[bar])/2;
       value = price * (1 - dK);
       if ((High[bar] + Low[bar])/2 < value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 + dK);
          HLTrend = -1;
          }
       }
    else
    if (HLTrend <= 0)
       {
       if (High[bar] < price) price = (High[bar] + Low[bar])/2;
       value = price * (1 + dK);
       if ((High[bar] + Low[bar])/2 > value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 - dK);
          HLTrend = 1;
          }
       }
    if (HLTrend == -1) ind_buffer3[bar] = value;
    if (HLTrend == 1) ind_buffer4[bar] = value;
    }
    if (CurTime() - PrevAlertTime > Period()*60)
    {
    if ((ind_buffer3[0] != ind_buffer3[1]) || (ind_buffer4[0] != ind_buffer4[1]))
       {
       Alert("??? S/L ? ",value);
       PrevAlertTime = CurTime();
       }
    }
}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR_Pilot_2alert.mq4

//+------------------------------------------------------------------+
//|                                                   wlxBWACsig.mq4 |
//|                        Copyright ? 2005 B.Williams, coding wellx |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005 B.Williams, coding wellx"
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 MediumBlue
#property indicator_color2 HotPink
//---- input parameters
extern int       updown=8;
//---- buffers
double BWACup[];
double BWACdown[];

int pos=0;
double AC1,AC2,AC3,AC4,AC5;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,119);
   SetIndexBuffer(0,BWACup);
   SetIndexEmptyValue(0,0.0);

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,119);
   SetIndexBuffer(1,BWACdown);
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int  cbars=IndicatorCounted();
   if  (cbars<0) return(-1);
   if  (cbars>0) cbars--;

//---- TODO: add your code here
   if (cbars > (Bars-40)) pos=(Bars-40);
   else pos=cbars;
//   pos=10;
   while (pos > 0)
   {
     BWACup[pos]=NULL;
     BWACdown[pos]=NULL;
     AC1=iAC(NULL,0,pos);
     AC2=iAC(NULL,0,pos+1);
     AC3=iAC(NULL,0,pos+2);
     AC4=iAC(NULL,0,pos+3);
     AC5=iAC(NULL,0,pos+4);

     if (((AC4>0 && AC3>0 && AC2>0 && AC1>0) && (AC4>AC3 && AC2>AC3 && AC1>AC2)) ||
         ((AC4<0 && AC3<0 && AC2<0 && AC1>0) && (AC4>AC3 && AC2>AC3 && AC1>AC2)) ||
         ((AC5<0 && AC4<0 && AC3<0 && AC2<0 && AC1<0) &&
          (AC5>AC4 && AC4<AC3 && AC3<AC2 && AC2<AC1)))
             BWACup[pos]=(High[pos]+updown*Point) ;

     if (((AC4<0 && AC3<0 && AC2<0 && AC1<0) && (AC4<AC3 && AC2<AC3 && AC1<AC2)) ||
         ((AC4>0 && AC3>0 && AC2>0 && AC1<0) && (AC4<AC3 && AC2<AC3 && AC1<AC2)) ||
         ((AC5>0 && AC4>0 && AC3>0 && AC2>0 && AC1>0) &&
          (AC5<AC4 && AC4>AC3 && AC3>AC2 && AC2>AC1)))
             BWACdown[pos]=(Low[pos]-updown*Point) ;

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR_Pilot911.mq4

//+------------------------------------------------------------------+
//|                                                         NRTR.mq4 |
//|            Copyright ? 2005, VG many thanks to Konkop and dupidu |
//|                                                      4vg@mail.ru |
//+------------------------------------------------------------------+
#property copyright "VG many thanks to Konkop and dupidu"

#property indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Blue
#property  indicator_color2  Red
#property  indicator_color3  Magenta
#property  indicator_color4  Yellow

double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];
double     ind_buffer4[];

extern double AveragePeriod = 40;
extern bool OCnotAverage = true;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(0,AveragePeriod);
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(1,AveragePeriod);
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(2,AveragePeriod);
   SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(3,AveragePeriod);

//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2)
      && !SetIndexBuffer(2,ind_buffer3)&& !SetIndexBuffer(3,ind_buffer4))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("NRTR");
   SetIndexLabel(0,"Sell");
   SetIndexLabel(1,"Buy");
   SetIndexLabel(2,"Sell S/L");
   SetIndexLabel(3,"Buy S/L");

//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int bar;
   double value = 0;
   double price = 0;
   double trend, dK, AvgRange, HLTrend;
   int SetLoopCount = 0;
//---- TODO: add your code here
for (int shift=Bars-2; shift>=0; shift--)
    {
    ind_buffer1[shift]=0;
    ind_buffer2[shift]=0;
    ind_buffer3[shift]=0;
    ind_buffer4[shift]=0;
    }

AvgRange=0;
for (int i=1; i<=AveragePeriod; i++) AvgRange+= MathAbs(High[i]-Low[i]);
dK = AvgRange/AveragePeriod/Point/10000;

if (OCnotAverage)
{
if (Close[Bars-1] > Open[Bars-1])
   {
   value = Close[Bars - 1] * (1 - dK);
   trend = 1;
   ind_buffer2[Bars - 1] = value;
   }
if (Close[Bars-1] < Open[Bars-1])
   {
   value = Close[Bars - 1] * (1 + dK);
   trend = -1;
   ind_buffer1[Bars - 1] = value;
   }
for (bar = Bars - 2; bar >= 0; bar--)
    {
    if (trend >= 0)
       {
       if (Low[bar] > price)  price = Close[bar];
       value = price * (1 - dK);
       if (Close[bar] < value)
          {
          price = Close[bar];
          value = price * (1 + dK);
          trend = -1;
          }
       }
    else
    if (trend <= 0)
       {
       if (High[bar] < price) price = Close[bar];
       value = price * (1 + dK);
       if (Close[bar] > value)
          {
          price = Close[bar];
          value = price * (1 - dK);
          trend = 1;
          }
       }
    if (trend == -1) ind_buffer1[bar] = value;
    if (trend == 1) ind_buffer2[bar] = value;
    }
}
else
{
if ((High[Bars-1] + Low[Bars-1])/2 > (High[Bars-2] + Low[Bars-2])/2)
   {
   value = (High[Bars-1] + Low[Bars-1])/2 * (1 - dK);
   HLTrend = 1;
   ind_buffer4[Bars - 1] = value;
   }
   else
   {
   value = (High[Bars-1] + Low[Bars-1])/2 * (1 + dK);
   HLTrend = -1;
   ind_buffer3[Bars - 1] = value;
   }
for (bar = Bars - 2; bar >= 0; bar--)
    {
    if (HLTrend >= 0)
       {
       if (Low[bar] > price) price = (High[bar] + Low[bar])/2;
       value = price * (1 - dK);
       if ((High[bar] + Low[bar])/2 < value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 + dK);
          HLTrend = -1;
          }
       }
    else
    if (HLTrend <= 0)
       {
       if (High[bar] < price) price = (High[bar] + Low[bar])/2;
       value = price * (1 + dK);
       if ((High[bar] + Low[bar])/2 > value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 - dK);
          HLTrend = 1;
          }
       }
    if (HLTrend == -1) ind_buffer3[bar] = value;
    if (HLTrend == 1) ind_buffer4[bar] = value;
    }
}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR_color_line1.mq4

//+------------------------------------------------------------------+
//|                                              NRTR_color_line.mq4 |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int ATRPeriod=14;
extern double Coefficient=4.0;
extern int StartBar=1000;

//---- buffers
double value1[];
double value2[];

bool TrendUP;
double Extremum,TR,ATR,Values[100],ChannelWidth;
int J,Head,Weight,Curr;

int init() {

//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexArrow(0,167);
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexArrow(1,167);
   SetIndexBuffer(0,value1);
   SetIndexBuffer(1,value2);
   return(0);
}

int start() {
   int Shift;

   if (Close[StartBar-2] > Close[StartBar-1]) TrendUP = true;
   else TrendUP = false;
   Extremum = Close[ StartBar - 2 ];

   for (Shift = StartBar - 3; Shift>=0; Shift--) {
	   TR = High[Shift] - Low[Shift];
	   if ( MathAbs( High[ Shift ] - Close[ Shift + 1 ]) > TR ) TR = MathAbs( High[ Shift ] - Close[ Shift + 1 ]);
	   if ( MathAbs( Low[ Shift ] - Close[ Shift + 1 ]) > TR )  TR = MathAbs( Low[ Shift ] - Close[ Shift + 1 ]);
	   if (Shift == StartBar - 3)
		   for (J = 0; J<ATRPeriod; J++) {
			   Values[J] = TR;
		   }
	   Values[ Head ] = TR;
	   ATR = 0;
	   Weight = ATRPeriod;
	   Curr = Head;
	   for (J = 0; J<ATRPeriod; J++) {
		   ATR += Values[ Curr ] * Weight;
		   Weight -= 1;
		   Curr -= 1;
		   if ( Curr == -1 ) Curr = ATRPeriod - 1;
	   }
	   ATR = ( 2.0 * ATR ) / ( ATRPeriod * ( ATRPeriod + 1.0 ));
	   Head += 1;
	   if (Head == ATRPeriod) Head = 0;
	   ChannelWidth = Coefficient * ATR;
	   if (TrendUP && ( Low[ Shift ] < ( Extremum - ChannelWidth ) ) )  {
		   TrendUP = false;
		   Extremum = High[ Shift ];
	   }
	   if ( !TrendUP && ( High[ Shift ] > ( Extremum + ChannelWidth) ) ) {
		   TrendUP = true;
		   Extremum = Low[ Shift ];
	   }

	   if ( TrendUP && ( Low[Shift] > Extremum ) ) Extremum = Low[ Shift ];
	   if ( !TrendUP && ( High[ Shift ] < Extremum ) ) Extremum = High[ Shift ];

	   if (TrendUP) {
		   value1[Shift]=Extremum - ChannelWidth;
		   value2[Shift]=0;
	   } else {
		   value1[Shift]=0;
		   value2[Shift]=Extremum + ChannelWidth;
	   }
	}
}

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR_color_line.mq4

//+------------------------------------------------------------------+
//|                                              NRTR_color_line.mq4 |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int ATRPeriod=14;
extern double Coefficient=4.0;
extern int StartBar=1000;

//---- buffers
double value1[];
double value2[];

bool TrendUP;
double Extremum,TR,ATR,Values[100],ChannelWidth;
int J,Head,Weight,Curr;

int init() {

//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexArrow(0,167);
   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexArrow(1,167);
   SetIndexBuffer(0,value1);
   SetIndexBuffer(1,value2);
   return(0);
}

int start() {
   int Shift;

   if (Close[StartBar-2] > Close[StartBar-1]) TrendUP = true;
   else TrendUP = false;
   Extremum = Close[ StartBar - 2 ];

   for (Shift = StartBar - 3; Shift>=0; Shift--) {
	   TR = High[Shift] - Low[Shift];
	   if ( MathAbs( High[ Shift ] - Close[ Shift + 1 ]) > TR ) TR = MathAbs( High[ Shift ] - Close[ Shift + 1 ]);
	   if ( MathAbs( Low[ Shift ] - Close[ Shift + 1 ]) > TR )  TR = MathAbs( Low[ Shift ] - Close[ Shift + 1 ]);
	   if (Shift == StartBar - 3)
		   for (J = 0; J<ATRPeriod; J++) {
			   Values[J] = TR;
		   }
	   Values[ Head ] = TR;
	   ATR = 0;
	   Weight = ATRPeriod;
	   Curr = Head;
	   for (J = 0; J<ATRPeriod; J++) {
		   ATR += Values[ Curr ] * Weight;
		   Weight -= 1;
		   Curr -= 1;
		   if ( Curr == -1 ) Curr = ATRPeriod - 1;
	   }
	   ATR = ( 2.0 * ATR ) / ( ATRPeriod * ( ATRPeriod + 1.0 ));
	   Head += 1;
	   if (Head == ATRPeriod) Head = 0;
	   ChannelWidth = Coefficient * ATR;
	   if (TrendUP && ( Low[ Shift ] < ( Extremum - ChannelWidth ) ) )  {
		   TrendUP = false;
		   Extremum = High[ Shift ];
	   }
	   if ( !TrendUP && ( High[ Shift ] > ( Extremum + ChannelWidth) ) ) {
		   TrendUP = true;
		   Extremum = Low[ Shift ];
	   }

	   if ( TrendUP && ( Low[Shift] > Extremum ) ) Extremum = Low[ Shift ];
	   if ( !TrendUP && ( High[ Shift ] < Extremum ) ) Extremum = High[ Shift ];

	   if (TrendUP) {
		   value1[Shift]=Extremum - ChannelWidth;
		   value2[Shift]=0;
	   } else {
		   value1[Shift]=0;
		   value2[Shift]=Extremum + ChannelWidth;
	   }
	}
}

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR.mq4

//+------------------------------------------------------------------+
//|                                                         NRTR.mq4 |
//|                                                                  |
//|                                        Ramdass - Conversion only |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet
//---- input parameters
extern int AveragePeriod=10;
extern int CountBars=300;
//---- buffers
double value1[];
double value2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexBuffer(0,value1);
   SetIndexBuffer(1,value2);
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| NRTR                                                             |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars+1);
   SetIndexDrawBegin(1,Bars-CountBars+1);
   int i,counted_bars=IndicatorCounted();
   double value;
   double trend=0,dK,AvgRange,price;
//----
   if(Bars<=AveragePeriod) return(0);
//---- initial zero
   if(counted_bars<1)
   {
      for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0;
      for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0;
   }

AvgRange=0;
for (i=1 ; i<=AveragePeriod ; i++) AvgRange+= MathAbs(High[i]-Low[i]);
if (Symbol() == "USDJPY" || Symbol() == "GBPJPY" || Symbol() == "EURJPY")
{dK = (AvgRange/AveragePeriod)/100;}
else {dK = AvgRange/AveragePeriod;}

if (Close[CountBars-1] > Open[CountBars-1])
   {
   value1[CountBars - 1] = Close[CountBars - 1] * (1 - dK);
   trend = 1; value2[CountBars - 1] = 0.0;
   }
if (Close[CountBars-1] < Open[CountBars-1])  {
   value2[CountBars - 1] = Close[CountBars - 1] * (1 + dK);
   trend = -1; value1[CountBars - 1] = 0.0;
   }
//----
   i=CountBars-1;
   while(i>=0)
     {
value1[i]=0; value2[i]=0;
if (trend >= 0)
       {
       if (Close[i] > price) price = Close[i];
       value = price * (1 - dK);
       if (Close[i] < value)
          {
          price = Close[i];
          value = price * (1 + dK);
          trend = -1;
          }
       }
    else
       {
    if (trend <= 0)
       {
       if (Close[i] < price) price = Close[i];
       value = price * (1 + dK);
       if (Close[i] > value)
          {
          price = Close[i];
          value = price * (1 - dK);
          trend = 1;
          }
       }
       }
if (trend == 1)  {value1[i]=value; value2[i]=0.0;}
if (trend == -1)  {value2[i]=value; value1[i]=0.0;}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR WATR.mq4

//+------------------------------------------------------------------+
//|                                                    NRTR WATR.mq4 |
//|                                                                  |
//|                                        Ramdass - Conversion only |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
//---- input parameters
extern int AveragePeriod=10;
extern int Variant=2;
extern int CountBars=300;

//---- buffers
double value1[];
double value2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,167);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,167);
   SetIndexBuffer(0,value1);
   SetIndexBuffer(1,value2);
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| NRTR WATR                                                        |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=Bars) CountBars=Bars - AveragePeriod - 2;
//   CountBars = CountBars - AveragePeriod - 3;
   SetIndexDrawBegin(0,Bars-CountBars+1);
   SetIndexDrawBegin(1,Bars-CountBars+1);
   int i,i2,bar,counted_bars=IndicatorCounted();
   double value,WATR;
   double trend=1,dK,AvgRange,price,AveragePeriod_D;
   AveragePeriod_D=AveragePeriod;
//----
   if(Bars<=AveragePeriod) return(0);
//---- initial zero
   if(counted_bars<1)
   {
      for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0;
      for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0;
   }
AvgRange=0;

if ((Variant == 2) || (Variant == 3))
   {
   for (i=AveragePeriod; i>=1; i--)
       {
       dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
       AvgRange=AvgRange + dK*MathAbs(High[i]-Low[i]);
       }
   if (Symbol()=="USDJPY" || Symbol()=="GBPJPY" || Symbol()=="EURJPY")
   {WATR = AvgRange/AveragePeriod_D/100;}
   else
   {WATR = AvgRange/AveragePeriod_D;}
   }

if (Variant == 1)
   {
   for (i=1; i<=AveragePeriod; i++)
       {
       dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
       AvgRange=AvgRange + dK*MathAbs(High[CountBars + i]-Low[CountBars + i]);
       }
   WATR = AvgRange/AveragePeriod_D;
   }

if (Close[CountBars-1] > Open[CountBars-1])
   {
   value1[CountBars - 1] = Close[CountBars - 1] * (1 - WATR);
   trend = 1; value2[CountBars - 1] = 0.0;
   }

if (Close[CountBars-1] < Open[CountBars-1])
   {
   value2[CountBars - 1] = Close[CountBars - 1] * (1 + WATR);
   trend = -1; value1[CountBars - 1] = 0.0;
   }

//----
   bar=CountBars;
   while(bar>=0)
     {
value1[bar]=0.0; value2[bar]=0.0;

    if (Variant == 3)
    {
        AvgRange=0;
        for (i=1; i<=AveragePeriod; i++)
            {
            dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
            AvgRange=AvgRange+ dK*MathAbs(High[bar + i]-Low[bar + i]);
            }
        WATR = AvgRange/AveragePeriod_D;
    }
    if (trend == 1)
      {
       if (Close[bar] > price) price = Close[bar];
       value = price * (1 - WATR);
       if (Close[bar] < value)
         {
          price = Close[bar];
          value = price * (1 + WATR);
          trend = -1;
          }
       }
    if (trend == -1)
      {
       if (Close[bar] < price) price = Close[bar];
       value = price * (1 + WATR);
       if (Close[bar] > value)
          {
          price = Close[bar];
          value = price * (1 - WATR);
          trend = 1;
          }
       }

if (trend == 1)  {value1[bar]=value; value2[bar]=0.0;}
if (trend == -1)  {value2[bar]=value; value1[bar]=0.0;}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR WATR-hist.mq4

//+------------------------------------------------------------------+
//|                                                    NRTR WATR.mq4 |
//|                                                                  |
//|                                        Ramdass - Conversion only |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Tomato
#property indicator_color2 DeepSkyBlue
//---- input parameters
extern int AveragePeriod=10;
extern int Variant=2;
extern int CountBars=300;

//---- buffers
double value1[];
double value2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

//---- indicator line
   IndicatorBuffers(4);
   SetIndexStyle(0,DRAW_HISTOGRAM,0,2);//SetIndexStyle(0,DRAW_ARROW);
   //SetIndexArrow(0,167);
   SetIndexStyle(1,DRAW_HISTOGRAM,0,2);//SetIndexStyle(1,DRAW_ARROW);
   //SetIndexArrow(1,167);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,2);
   SetIndexStyle(3,DRAW_HISTOGRAM,0,2);
   SetIndexBuffer(0,value1);
   SetIndexBuffer(1,value2);
//----
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| NRTR WATR                                                        |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=Bars) CountBars=Bars - AveragePeriod - 2;
//   CountBars = CountBars - AveragePeriod - 3;
   SetIndexDrawBegin(0,Bars-CountBars+1);
   SetIndexDrawBegin(1,Bars-CountBars+1);
   int i,i2,bar,counted_bars=IndicatorCounted();
   double value,WATR;
   double trend=1,dK,AvgRange,price,AveragePeriod_D;
   AveragePeriod_D=AveragePeriod;
//----
   if(Bars<=AveragePeriod) return(0);
//---- initial zero
   if(counted_bars<1)
   {
      for(i=1;i<=AveragePeriod;i++) value1[Bars-i]=0.0;
      for(i=1;i<=AveragePeriod;i++) value2[Bars-i]=0.0;
   }
AvgRange=0;

if ((Variant == 2) || (Variant == 3))
   {
   for (i=AveragePeriod; i>=1; i--)
       {
       dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
       AvgRange=AvgRange + dK*MathAbs(High[i]-Low[i]);
       }
   if (Symbol()=="USDJPY" || Symbol()=="GBPJPY" || Symbol()=="EURJPY")
   {WATR = AvgRange/AveragePeriod_D/100;}
   else
   {WATR = AvgRange/AveragePeriod_D;}
   }

if (Variant == 1)
   {
   for (i=1; i<=AveragePeriod; i++)
       {
       dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
       AvgRange=AvgRange + dK*MathAbs(High[CountBars + i]-Low[CountBars + i]);
       }
   WATR = AvgRange/AveragePeriod_D;
   }

if (Close[CountBars-1] > Open[CountBars-1])
   {
   value1[CountBars - 1] = Close[CountBars - 1] * (1 - WATR);
   trend = 1; value2[CountBars - 1] = 0.0;
   }

if (Close[CountBars-1] < Open[CountBars-1])
   {
   value2[CountBars - 1] = Close[CountBars - 1] * (1 + WATR);
   trend = -1; value1[CountBars - 1] = 0.0;
   }

//----
   bar=CountBars;
   while(bar>=0)
     {
value1[bar]=0.0; value2[bar]=0.0;

    if (Variant == 3)
    {
        AvgRange=0;
        for (i=1; i<=AveragePeriod; i++)
            {
            dK = 1+(AveragePeriod_D-i)/AveragePeriod_D;
            AvgRange=AvgRange+ dK*MathAbs(High[bar + i]-Low[bar + i]);
            }
        WATR = AvgRange/AveragePeriod_D;
    }
    if (trend == 1)
      {
       if (Close[bar] > price) price = Close[bar];
       value = price * (1 - WATR);
       if (Close[bar] < value)
         {
          price = Close[bar];
          value = price * (1 + WATR);
          trend = -1;
          }
       }
    if (trend == -1)
      {
       if (Close[bar] < price) price = Close[bar];
       value = price * (1 + WATR);
       if (Close[bar] > value)
          {
          price = Close[bar];
          value = price * (1 - WATR);
          trend = 1;
          }
       }

if (trend == 1)  {value1[bar]=Low[bar]; value2[bar]=High[bar];}//if (trend == 1)  {value1[bar]=value; value2[bar]=0.0;}
if (trend == -1)  {value2[bar]=Low[bar]; value1[bar]=High[bar];}//if (trend == -1)  {value2[bar]=value; value1[bar]=0.0;}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR Rosh v2.mq4

//+------------------------------------------------------------------+
//|                                                 NRTR Rosh v2.mq4 |
//|                                                             Rosh |
//|                           http://forexsystems.ru/phpBB/index.php |
//+------------------------------------------------------------------+
#property copyright "Rosh"
#property link      "http://forexsystems.ru/phpBB/index.php"

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Tomato
#property indicator_color2 DeepSkyBlue
#property indicator_color3 DeepSkyBlue
#property indicator_color4 Tomato
//---- input parameters
extern int       PerATR=40;
extern double    kATR=2.0;
extern bool      useSendMail=true;
//---- buffers
double SellBuffer[];
double BuyBuffer[];
double Ceil[];
double Floor[];
double Trend[];
int sm_Bars;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(5);

   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,251);
   SetIndexBuffer(0,SellBuffer);
   SetIndexEmptyValue(0,0.0);

   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,251);
   SetIndexBuffer(1,BuyBuffer);
   SetIndexEmptyValue(1,0.0);

   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,159);
   SetIndexBuffer(2,Ceil);
   SetIndexEmptyValue(2,0.0);

   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,159);
   SetIndexBuffer(3,Floor);
   SetIndexEmptyValue(3,0.0);

   SetIndexBuffer(4,Trend);
   SetIndexEmptyValue(4,0);
   //----
   return(0);
  }
//+------------------------------------------------------------------+
//| ???? ??? ?????                              |
//+------------------------------------------------------------------+
bool BreakDown(int shift)
  {
   bool result=false;
   if (Close[shift]>SellBuffer[shift+1]) result=true;
   return(result);
  }

//+------------------------------------------------------------------+
//| ???? ?? ????                              |
//+------------------------------------------------------------------+
bool BreakUp(int shift)
  {
   bool result=false;
   if (Close[shift]<BuyBuffer[shift+1]) result=true;
   return(result);
  }

//+------------------------------------------------------------------+
//| ???? ??? ???? ? ?????                             |
//+------------------------------------------------------------------+
bool BreakFloor(int shift)
  {
   bool result=false;
   if (High[shift]<Floor[shift+1]) result=true;
   return(result);
  }

//+------------------------------------------------------------------+
//| ???? ??? ????? ? ????                              |
//+------------------------------------------------------------------+
bool BreakCeil(int shift)
  {
   bool result=false;
   if (Low[shift]>Ceil[shift+1]) result=true;
   return(result);
  }

//+------------------------------------------------------------------+
//| ?????? ?????? ???                                   |
//+------------------------------------------------------------------+
bool Uptrend(int shift)
  {
   //Print("Trend=",Trend[shift+1]);
   bool result=false;
   if (Trend[shift+1]==1) result=true;
   if (Trend[shift+1]==-1) result=false;
   if ((Trend[shift+1]!=1)&&(Trend[shift+1]!=-1)) Print("????! ??? ? ?????, ??? ?? ? ???. ?? ? ??? ",(Bars-shift));
   return(result);
  }

//+------------------------------------------------------------------+
//| ????? ???????                                         |
//+------------------------------------------------------------------+
double ATR(int iPer,int shift)
  {
   double result;
   //result=iMA(NULL,0,Per,0,MODE_SMA,PRICE_HIGH,shift+1)-iMA(NULL,0,Per,0,MODE_SMA,PRICE_LOW,shift+1);
   result=iATR(NULL,0,iPer,shift);
   //if (result>1.0) Alert("???? ??=",result);
   //Print("ATR[",shift,"]=",result);
   return(result);
  }
//+------------------------------------------------------------------+
//| ????? ??? ???? ????                                  |
//+------------------------------------------------------------------+
void NewCeil(int shift)
  {
   Ceil[shift]=Close[shift];
   Floor[shift]=0.0;
  }

//+------------------------------------------------------------------+
//| ????? ??? ???? ??                                     |
//+------------------------------------------------------------------+
void NewFloor(int shift)
  {
   Floor[shift]=Close[shift];
   Ceil[shift]=0.0;
  }

//+------------------------------------------------------------------+
//| ????? ???? ????? ????                              |
//+------------------------------------------------------------------+
void SetBuyBuffer(int shift)
  {
   BuyBuffer[shift]=Close[shift]-kATR*ATR(PerATR,shift);
   SellBuffer[shift]=0.0;
  }

//+------------------------------------------------------------------+
//| ????? ???? ????? ?????                            |
//+------------------------------------------------------------------+
void SetSellBuffer(int shift)
  {
   SellBuffer[shift]=Close[shift]+kATR*ATR(PerATR,shift);
   BuyBuffer[shift]=0.0;
  }

//+------------------------------------------------------------------+
//| ??? ??? ? ????? ??? ????                          |
//+------------------------------------------------------------------+
void NewTrend(int shift)
  {
   if (Trend[shift+1]==1)
      {
      Trend[shift]=-1;
      NewFloor(shift);
      SetSellBuffer(shift);
      }
   else
      {
      Trend[shift]=1;
      NewCeil(shift);
      SetBuyBuffer(shift);
      }
   if ((Trend[shift+1]!=1)&&(Trend[shift+1]!=-1)) Print("????! ??? ? ?????, ??? ?? ? ???");
  }

//+------------------------------------------------------------------+
//| ?????? ???                                               |
//+------------------------------------------------------------------+
void CopyLastValues(int shift)
  {
   SellBuffer[shift]=SellBuffer[shift+1];
   BuyBuffer[shift]=BuyBuffer[shift+1];
   Ceil[shift]=Ceil[shift+1];
   Floor[shift]=Floor[shift+1];
   Trend[shift]=Trend[shift+1];
  }
//+------------------------------------------------------------------+
//| ?????? ???                                               |
//+------------------------------------------------------------------+
void SendSMS(int shift)
  {
  if (sm_Bars!=Bars)
   sm_Bars=Bars;
   if ((Trend[shift+1]*Trend[shift+2]==-1)&&(shift==0)&&useSendMail) // ????? ???
      {
      if (Trend[shift+1]==1)
         {
         SendMail("NRTR",Symbol()+" "+Period()+" ?????? ???, Bid="+NormalizeDouble(Bid,Digits));
         }
      else
         {
         SendMail("NRTR",Symbol()+" "+Period()+" ?????? ??, Bid="+Bid);
         }
      }
   return;
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit;
   if (counted_bars>0) limit=Bars-counted_bars;
   if (counted_bars<0) return(0);
   if (counted_bars==0)
      {
      limit=Bars-PerATR-1;
      if (Close[limit+1]>Open[limit+1]) {Trend[limit+1]=1;Ceil[limit+1]=Close[limit+1];BuyBuffer[limit+1]=Close[limit+1]-kATR*ATR(PerATR,limit+1);}
      if (Close[limit+1]<Open[limit+1]) {Trend[limit+1]=-1;Floor[limit+1]=Close[limit+1];SellBuffer[limit+1]=Close[limit+1]+kATR*ATR(PerATR,limit+1);}
      if (Close[limit+1]==Open[limit+1]) {Trend[limit+1]=1;Ceil[limit+1]=Close[limit+1];BuyBuffer[limit+1]=Close[limit+1]-kATR*ATR(PerATR,limit+1);}
      }
//----
   for (int cnt=limit;cnt>=0;cnt--)
      {
      SendSMS(cnt);
      if (Uptrend(cnt))
         {
         //Print("UpTrend");
         if (BreakCeil(cnt))
            {
            NewCeil(cnt);
            SetBuyBuffer(cnt);
            Trend[cnt]=1;
            continue;
            }
         if (BreakUp(cnt))
            {
            NewTrend(cnt);
            continue;
            }
         CopyLastValues(cnt);
         }
      else
         {
         //Print("DownTrend");
         if (BreakFloor(cnt))
            {
            NewFloor(cnt);
            SetSellBuffer(cnt);
            Trend[cnt]=-1;
            continue;
            }
         if (BreakDown(cnt))
            {
            NewTrend(cnt);
            continue;
            }
         CopyLastValues(cnt);
         }
      }

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

NRTR Pilot Alert.mq4

//+------------------------------------------------------------------+
//|                                                         NRTR.mq4 |
//|            Copyright ? 2005, VG many thanks to Konkop and dupidu |
//|                                                      4vg@mail.ru |
//+------------------------------------------------------------------+
#property copyright "VG many thanks to Konkop and dupidu"

#property indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Blue
#property  indicator_color2  Red
#property  indicator_color3  Magenta
#property  indicator_color4  Yellow

double     ind_buffer1[];
double     ind_buffer2[];
double     ind_buffer3[];
double     ind_buffer4[];

extern double AveragePeriod = 40;
extern bool OCnotAverage = true;
extern int MaxBarsToCount = 200;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- drawing settings
   SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(0,AveragePeriod);
   SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,1);
   SetIndexDrawBegin(1,AveragePeriod);
   SetIndexStyle(2,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(2,AveragePeriod);
   SetIndexStyle(3,DRAW_ARROW,STYLE_SOLID,3);
   SetIndexDrawBegin(3,AveragePeriod);

//---- indicator buffers mapping
   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2)
      && !SetIndexBuffer(2,ind_buffer3)&& !SetIndexBuffer(3,ind_buffer4))
      Print("cannot set indicator buffers!");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName("NRTR");
   SetIndexLabel(0,"Sell S/L");
   SetIndexLabel(1,"Buy S/L");
   SetIndexLabel(2,"Sell S/L");
   SetIndexLabel(3,"Buy S/L");

//---- initialization done
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int bar, limit, PrevAlertTime;
   double value = 0;
   double price = 0;
   double trend, dK, AvgRange, HLTrend;
//---- TODO: add your code here
   if(Bars<=MaxBarsToCount) return(-1);

for (int shift=MaxBarsToCount; shift>=0; shift--)
    {
    ind_buffer1[shift]=0;
    ind_buffer2[shift]=0;
    ind_buffer3[shift]=0;
    ind_buffer4[shift]=0;
    }

AvgRange=0;
for (int i=1; i<=AveragePeriod; i++) AvgRange+= MathAbs(High[i]-Low[i]);
dK = AvgRange/AveragePeriod/Point/10000;

if (OCnotAverage)
{
if (Close[MaxBarsToCount] > Open[MaxBarsToCount])
   {
   value = Close[MaxBarsToCount] * (1 - dK);
   trend = 1;
   ind_buffer2[MaxBarsToCount] = value;
   }
if (Close[MaxBarsToCount] < Open[MaxBarsToCount])
   {
   value = Close[MaxBarsToCount] * (1 + dK);
   trend = -1;
   ind_buffer1[MaxBarsToCount] = value;
   }
for (bar = MaxBarsToCount - 1; bar >= 0; bar--)
    {
    if (trend >= 0)
       {
       if (Low[bar] > price)  price = Close[bar];
       value = price * (1 - dK);
       if (Close[bar] < value)
          {
          price = Close[bar];
          value = price * (1 + dK);
          trend = -1;
          }
       }
    else
    if (trend <= 0)
       {
       if (High[bar] < price) price = Close[bar];
       value = price * (1 + dK);
       if (Close[bar] > value)
          {
          price = Close[bar];
          value = price * (1 - dK);
          trend = 1;
          }
       }
    if (trend == -1) ind_buffer1[bar] = value;
    if (trend == 1) ind_buffer2[bar] = value;
    }
    if (CurTime() - PrevAlertTime > Period()*60)
    {
    if ((ind_buffer1[0] != ind_buffer1[1]) || (ind_buffer2[0] != ind_buffer2[1]))
       {
       Alert("??? S/L ? ",value);
       PrevAlertTime = CurTime();
       }
    }

}
else
{
if ((High[MaxBarsToCount] + Low[MaxBarsToCount])/2 > (High[MaxBarsToCount-1] + Low[MaxBarsToCount-1])/2)
   {
   value = (High[MaxBarsToCount] + Low[MaxBarsToCount])/2 * (1 - dK);
   HLTrend = 1;
   ind_buffer4[MaxBarsToCount] = value;
   }
   else
   {
   value = (High[MaxBarsToCount] + Low[MaxBarsToCount])/2 * (1 + dK);
   HLTrend = -1;
   ind_buffer3[MaxBarsToCount] = value;
   }
for (bar = MaxBarsToCount - 1; bar >= 0; bar--)
    {
    if (HLTrend >= 0)
       {
       if (Low[bar] > price) price = (High[bar] + Low[bar])/2;
       value = price * (1 - dK);
       if ((High[bar] + Low[bar])/2 < value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 + dK);
          HLTrend = -1;
          }
       }
    else
    if (HLTrend <= 0)
       {
       if (High[bar] < price) price = (High[bar] + Low[bar])/2;
       value = price * (1 + dK);
       if ((High[bar] + Low[bar])/2 > value)
          {
          price = (High[bar] + Low[bar])/2;
          value = price * (1 - dK);
          HLTrend = 1;
          }
       }
    if (HLTrend == -1) ind_buffer3[bar] = value;
    if (HLTrend == 1) ind_buffer4[bar] = value;
    }
    if (CurTime() - PrevAlertTime > Period()*60)
    {
    if ((ind_buffer3[0] != ind_buffer3[1]) || (ind_buffer4[0] != ind_buffer4[1]))
       {
       Alert("??? S/L ? ",value);
       PrevAlertTime = CurTime();
       }
    }
}

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

[Post to Twitter] Tweet This Post  [Post to Delicious] Delicious This Post  [Post to Ping.fm] Ping This Post  [Post to StumbleUpon] Stumble This Post 

 Page 1 of 3  1  2  3 »

Tweet This Post links powered by Tweet This v1.3.9, a WordPress plugin for Twitter.