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
L :forex decode

L Archives

LWMA-Crossover_Signal.mq4

//+------------------------------------------------------------------+
//|                                         LWMA-Crossover_Signal.mq4 |
//|         Copyright ? 2005, Jason Robinson (jnrtrading)            |
//|                   http://www.jnrtading.co.uk                     |
//+------------------------------------------------------------------+

/*
  +-------------------------------------------------------------------+
  | Allows you to enter two lwma periods and it will then show you at |
  | Which point they crossed over. It is more usful on the shorter    |
  | periods that get obscured by the bars / candlesticks and when     |
  | the zoom level is out. Also allows you then to remove the emas    |
  | from the chart. (lwmas are initially set at 5 and 6)              |
  +-------------------------------------------------------------------+
*/
#property copyright "Copyright ? 2005, Jason Robinson (jnrtrading)"
#property link      "http://www.jnrtrading.co.uk"

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

double CrossUp[];
double CrossDown[];
extern int FasterLWMA = 5;
extern int SlowerLWMA = 6;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0, DRAW_ARROW, EMPTY);
   SetIndexArrow(0, 233);
   SetIndexBuffer(0, CrossUp);
   SetIndexStyle(1, DRAW_ARROW, EMPTY);
   SetIndexArrow(1, 234);
   SetIndexBuffer(1, CrossDown);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
   int limit, i, counter;
   double fasterLWMAnow, slowerLWMAnow, fasterLWMAprevious, slowerLWMAprevious, fasterLWMAafter, slowerLWMAafter;
   double Range, AvgRange;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

   for(i = 0; i <= limit; i++) {

      counter=i;
      Range=0;
      AvgRange=0;
      for (counter=i ;counter<=i+9;counter++) {
         AvgRange=AvgRange+MathAbs(High[counter]-Low[counter]);
      }
      Range=AvgRange/10;

      fasterLWMAnow = iMA(NULL, 0, FasterLWMA, 0, MODE_LWMA, PRICE_CLOSE, i);
      fasterLWMAprevious = iMA(NULL, 0, FasterLWMA, 0, MODE_LWMA, PRICE_CLOSE, i+1);
      fasterLWMAafter = iMA(NULL, 0, FasterLWMA, 0, MODE_LWMA, PRICE_CLOSE, i-1);

      slowerLWMAnow = iMA(NULL, 0, SlowerLWMA, 0, MODE_LWMA, PRICE_CLOSE, i);
      slowerLWMAprevious = iMA(NULL, 0, SlowerLWMA, 0, MODE_LWMA, PRICE_CLOSE, i+1);
      slowerLWMAafter = iMA(NULL, 0, SlowerLWMA, 0, MODE_LWMA, PRICE_CLOSE, i-1);

      if ((fasterLWMAnow > slowerLWMAnow) && (fasterLWMAprevious < slowerLWMAprevious) && (fasterLWMAafter > slowerLWMAafter)) {
         CrossUp[i] = Low[i] - Range*0.5;
      }
      else if ((fasterLWMAnow < slowerLWMAnow) && (fasterLWMAprevious > slowerLWMAprevious) && (fasterLWMAafter < slowerLWMAafter)) {
         CrossDown[i] = High[i] + Range*0.5;
      }
   }
   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 

LSMA_Line.mq4

//+------------------------------------------------------------------+
//|                                                    LSMA_Line.mq4 |
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net/"

#property indicator_chart_window
//---- indicator parameters
extern int    IdNum   = 1;
extern int    RPeriod = 28;
extern color  LineColor = Red;
extern int    LineWeight   = 1;
extern int    PriceVal = 0;         // 0 = Close, 1 = Low, 2 = High
extern double StDev = 1.618;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//----
  ObjectCreate("Reg_line"+IdNum, OBJ_TREND, 0, 0,0, 0,0);
	ObjectSet("Reg_line"+IdNum, OBJPROP_COLOR, LineColor);
 	ObjectSet("Reg_line"+IdNum, OBJPROP_STYLE, STYLE_SOLID);
 	ObjectSet("Reg_line"+IdNum, OBJPROP_WIDTH, LineWeight);
  ObjectCreate("Reg_upper" +IdNum, OBJ_TREND, 0, 0,0, 0,0);
	ObjectSet("Reg_upper"+IdNum, OBJPROP_COLOR, LineColor);
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_STYLE, STYLE_SOLID);
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_WIDTH, LineWeight);
  ObjectCreate("Reg_lower" +IdNum, OBJ_TREND, 0, 0,0, 0,0);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_COLOR, LineColor);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_STYLE, STYLE_SOLID);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_WIDTH, LineWeight);

  Comment("Auto Regression channel");
   return(0);
  }

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
void deinit() {
  ObjectDelete("Reg_line"+IdNum);
  ObjectDelete("Reg_upper" +IdNum);
  ObjectDelete("Reg_lower" +IdNum);
  Comment("");
}

//+------------------------------------------------------------------+
//| Regression Line                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double y1,y2, price;
   double a1, a2, a3, b1, a, b;
   double stddiv, tmp_div;
   double x_n_up, x_1_up, x_n_down, x_1_down;
   int shift, n;

//----
   if(Bars<=RPeriod) return(0);
   a1 = 0;
   a2 = 0;
   a3 = 0;
   b1 = 0;
   a = 0;
   b = 0;
   y1 = 0;
   y2 = 0;
   tmp_div = 0;
   n = RPeriod;
  	for(shift=RPeriod;shift>0;shift--)
  	{
  	  switch (PriceVal)
  	  {
  	     case 0: price = Close[shift];
  	             break;
  	     case 1: price = Low[shift];
  	             break;
  	     case 2: price = High[shift];
  	             break;
  	  }
     a1 = a1 + shift*price;
     a2 = a2 + shift;
     a3 = a3 + price;
     b1 = b1 + shift*shift;
  }

  b = (n*a1 - a2*a3)/(n*b1 - a2*a2);
  a = (a3 - b*a2)/n;
  y1 = a + b*n;
  y2 = a + b;

 	ObjectSet("Reg_line"+IdNum, OBJPROP_TIME1, Time[RPeriod]);
 	ObjectSet("Reg_line"+IdNum, OBJPROP_TIME2, Time[0]);
 	ObjectSet("Reg_line"+IdNum, OBJPROP_PRICE1, y1);
 	ObjectSet("Reg_line"+IdNum, OBJPROP_PRICE2, y2);

  for (shift=RPeriod; shift>0; shift--) {
  	  switch (PriceVal)
  	  {
  	     case 0: price = Close[shift];
  	             break;
  	     case 1: price = Low[shift];
  	             break;
  	     case 2: price = High[shift];
  	             break;
  	  }

  	tmp_div = tmp_div + (price - (a + b*shift))*(price - (a + b*shift));
  }

  stddiv = MathSqrt(tmp_div/n);

  x_n_up = y1 + StDev*stddiv;
  x_1_up = y2 + StDev*stddiv;

  x_n_down = y1 - StDev*stddiv;
  x_1_down = y2 - StDev*stddiv;

  //upper
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_TIME1, Time[RPeriod]);
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_TIME2, Time[0]);
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_PRICE1, x_n_up);
 	ObjectSet("Reg_upper"+IdNum, OBJPROP_PRICE2, x_1_up);
  //lower
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_TIME1, Time[RPeriod]);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_TIME2, Time[0]);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_PRICE1, x_n_down);
 	ObjectSet("Reg_lower"+IdNum, OBJPROP_PRICE2, x_1_down);

   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 

LSMA_ind_04.mq4

//+------------------------------------------------------------------+
//| LSMA                                                             |
//+------------------------------------------------------------------+
#property  copyright "Copywrong 2005 RonT"
#property  link      "http://www.lightpatch.com/forex/"

//---- indicator settings
#property  indicator_chart_window

#property indicator_buffers   7
#property indicator_color1  Yellow
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_color4  White
#property indicator_color5  White
#property indicator_color6  Green
#property indicator_color7  Red

//---- buffers
double ExtMapBuffer1[];  //Yellow
double ExtMapBuffer2[];  //Green
double ExtMapBuffer3[];  //Red
double XBuffer[];        //White
double ZBuffer[];        //White
double ExtMapBuffer6[];  //Green
double ExtMapBuffer7[];  //Red

extern int extRperiod = 32;
extern int extDraw4HowLong = 500;

int    flip=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0,ExtMapBuffer1);   //Yellow
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,ExtMapBuffer2);  //Green
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,ExtMapBuffer3);  //Red
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   // 233 up arrow
   // 234 down arrow
   // 158 little dot
   // 159 big dot
   // 168 open square
   // 120 box with X
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, XBuffer);     //White
   SetIndexArrow(3,120);

   SetIndexStyle(4,DRAW_ARROW);
   SetIndexBuffer(4, ZBuffer);     //White
   SetIndexArrow(4,158);

   SetIndexBuffer(5,ExtMapBuffer6);  //Green
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(6,ExtMapBuffer7);  //Red
   SetIndexStyle(6, DRAW_LINE, STYLE_SOLID, 2);

   return(0);
  }

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

   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) XBuffer[i]=0;
   for( i=0; i<Bars; i++ ) ZBuffer[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer6[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer7[i]=0;

   return(0);
  }

int start()
  {

   //----- variables
   int    c;
   int    i;
   int    length;
   double lengthvar;
   int    loopbegin;
   int    pos;
   double sum;
   double tmp;
   int    width;

   double wtp; //previous value
   double wt;  //current value
   int    rc=0;
   int    gc=0;
   int   qualcount;

   double p=Point;

   length = extRperiod;
   loopbegin = extDraw4HowLong - length - 1;

   for(pos = loopbegin; pos >= 0; pos--)
     {
      sum = 0;
      for(i = length; i >= 1  ; i--)
        {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum+=tmp;
        }

      wtp=wt;
      wt = sum*6/(length*(length+1));

      ExtMapBuffer1[pos] = wt;   //yellow
      ExtMapBuffer2[pos] = wt;   //green
      ExtMapBuffer3[pos] = wt;   //red
      //ExtMapBuffer6[pos] = wt-(p*3);   //green
      //ExtMapBuffer7[pos] = wt+(p*3);   //red

      if (wtp > wt)
        {
         ExtMapBuffer2[pos] = EMPTY_VALUE; //remove GREEN
         //ExtMapBuffer6[pos] = wt-(p*10); //remove GREEN
         rc++;
         // Close any orders
         if (gc>0) {gc=0; flip++;}
         ZBuffer[pos]=Low[pos];
        }
      else
        {
         ExtMapBuffer3[pos] = EMPTY_VALUE; //remove RED
         //ExtMapBuffer7[pos] = wt+(p*10); //remove RED
         gc++;
         if (rc>0) {rc=0; flip++;}
         ZBuffer[pos]=High[pos];
        }

      //Comment("wtp=",wtp,"\nwt=",wt,"\nRed=",rc,"\nGreen=",gc);

      if (flip==1) {qualcount=6;}
      if (flip>1)  {qualcount=9;}

      if (gc==qualcount)
        {
         // indicate buy order
         XBuffer[pos]=High[pos];
         flip=0;
        }

      if (rc==qualcount)
        {
         // indicate sell order
         XBuffer[pos]=Low[pos];
         flip=0;
        }

     }

   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 

LSMA_ind_03x.mq4

//+------------------------------------------------------------------+
//| LSMA indicator with global variables to drive a companion expert |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window

#property indicator_buffers   4
#property indicator_color1  Yellow
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_color4  White

//---- buffers
double ExtMapBuffer1[];  //Yellow
double ExtMapBuffer2[];  //Green
double ExtMapBuffer3[];  //Red
double XBuffer[];        //White

extern int extRperiod = 48;
extern int extDraw4HowLong = 500;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0,ExtMapBuffer1);   //Yellow
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,ExtMapBuffer2);  //Green
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,ExtMapBuffer3);  //Red
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 168 open square
   // 120 box with X
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, XBuffer);     //White
   SetIndexArrow(3,159);

   return(0);
  }

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

   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) XBuffer[i]=0;

   return(0);
  }

int start()
  {

   //----- variables
   int    c;
   int    i;
   int    length;
   double lengthvar;
   int    loopbegin;
   int    pos;
   double sum;
   double tmp;
   int    width;

   double wtp; //previous value
   double wt;  //current value
   int    rc=0;
   int    gc=0;

   double p=Point;

   length = extRperiod;
   loopbegin = extDraw4HowLong - length - 1;

   for(pos = loopbegin; pos >= 0; pos--)
     {
      sum = 0;
      for(i = length; i >= 1  ; i--)
        {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum+=tmp;
        }

      wtp=wt;
      wt = sum*6/(length*(length+1));

      ExtMapBuffer1[pos] = wt;   //yellow
      ExtMapBuffer2[pos] = wt;   //green
      ExtMapBuffer3[pos] = wt;   //red

      if (wtp > wt)
        {
         ExtMapBuffer2[pos+1] = EMPTY_VALUE; //remove GREEN
         rc++;
        }
      else
        {
         ExtMapBuffer3[pos+1] = EMPTY_VALUE; //remove RED
         gc++;
        }

      //Comment("wtp=",wtp,"\nwt=",wt,"\nRed=",rc,"\nGreen=",gc);

      if (gc>0 && rc>0)
        {
         // Close any orders
         gc=0;
         rc=0;
        }

      if (gc==5)
        {
         // indicate buy order
         XBuffer[pos]=High[pos];
        }

      if (rc==5)
        {
         // indicate sell order
         XBuffer[pos]=Low[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 

LSMA_ind_03.mq4

//+------------------------------------------------------------------+
//|                                                        |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window

#property indicator_buffers   4
#property indicator_color1  Yellow
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_color4  White

//---- buffers
double ExtMapBuffer1[];  //Yellow
double ExtMapBuffer2[];  //Green
double ExtMapBuffer3[];  //Red
double XBuffer[];        //White
double XBuffer[];        //White

extern int extRperiod = 48;
extern int extDraw4HowLong = 500;

//----- variables
int    c;
int    i;
int    length;
double lengthvar;
int    loopbegin;
int    pos;
double sum;
double tmp;
int    width;

double wtp; //previous value
double wt;  //current value

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0,ExtMapBuffer1);   //Yellow
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,ExtMapBuffer2);  //Green
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,ExtMapBuffer3);  //Red
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 168 open square
   // 120 box with X
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, XBuffer);     //White
   SetIndexArrow(3,159);

   return(0);
  }

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

   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) XBuffer[i]=0;

   return(0);
  }

int start()
  {

   bool i_am_red=false;
   bool i_am_green=false;
   bool i_am_yellow=false;

   int redcount=0;
   int greencount=0;
   int yellowcount=0;

   double p=Point;

   length = extRperiod;
   loopbegin = extDraw4HowLong - length - 1;

   for(pos = loopbegin; pos >= 0; pos--)
     {
      sum = 0;
      for(i = length; i >= 1  ; i--)
        {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum+=tmp;
        }

      wtp=wt;
      wt = sum*6/(length*(length+1));

      ExtMapBuffer1[pos] = wt;   //yellow
      ExtMapBuffer2[pos] = wt;   //green
      ExtMapBuffer3[pos] = wt;   //red

      i_am_red=false;
      i_am_green=false;

      if (wtp > wt)
        {
         //ExtMapBuffer2[pos+1] = EMPTY_VALUE; //remove GREEN
         ExtMapBuffer2[pos+1] = EMPTY_VALUE; //remove GREEN
         i_am_red=true;
         redcount++;
        }
      else
        {
         //ExtMapBuffer3[pos+1] = EMPTY_VALUE; //remove RED
         ExtMapBuffer3[pos+1] = EMPTY_VALUE; //remove RED
         i_am_green=true;
         greencount++;
        }

      if (i_am_yellow) {yellowcount++;}

     }

   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 

LSMA_ind_02.mq4

//+------------------------------------------------------------------+
//|                                                        |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window

#property indicator_buffers   4
#property indicator_color1  Yellow
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_color4  White

//---- buffers
double ExtMapBuffer1[];  //Yellow
double ExtMapBuffer2[];  //Green
double ExtMapBuffer3[];  //Red
double XBuffer[];        //White

extern int extRperiod = 48;
extern int extDraw4HowLong = 500;

//----- variables
int    c;
int    i;
int    length;
double lengthvar;
int    loopbegin;
int    pos;
double sum;
double tmp;
int    width;

double wtp; //previous value
double wt;  //current value

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0,ExtMapBuffer1);   //Yellow
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,ExtMapBuffer2);  //Green
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,ExtMapBuffer3);  //Red
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   // 233 up arrow
   // 234 down arrow
   // 159 big dot
   // 168 open square
   // 120 box with X
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, XBuffer);     //White
   SetIndexArrow(3,159);

   return(0);
  }

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

   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) XBuffer[i]=0;

   return(0);
  }

int start()
  {
   length = extRperiod;
   loopbegin = extDraw4HowLong - length - 1;

   for(pos = loopbegin; pos >= 0; pos--)
     {
      sum = 0;
      for(i = length; i >= 1  ; i--)
        {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum+=tmp;
        }

      wtp=wt;
      wt = sum*6/(length*(length+1));

      ExtMapBuffer1[pos] = wt;   //yellow
      ExtMapBuffer2[pos] = wt;   //green
      ExtMapBuffer3[pos] = wt;   //red

      if (wtp > wt)
        {
         ExtMapBuffer2[pos+1] = EMPTY_VALUE; // remove the GREEN
        }
      else
        {
         ExtMapBuffer3[pos+1] = EMPTY_VALUE; // remove the RED
        }
      }

   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 

LSMA_ind_01b.mq4

//+------------------------------------------------------------------+
//|                                                        |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
int width;

extern int Rperiod = 34;
extern int Draw4HowLong = 500;

int shift;
int i;
int loopbegin;
double sum[];
int length;
double lengthvar;
double tmp ;
double wt[];
int c;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(5);

//---- drawing settings
   SetIndexBuffer(2,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(0,ExtMapBuffer3);
   SetIndexBuffer(3,sum);
   SetIndexBuffer(4,wt);

   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

//---- initialization done
   return(0);
  }

int start()

  {
      //Draw4HowLong = Bars-Rperiod - 5;
      length = Rperiod;
      loopbegin = Draw4HowLong - length - 1;

      for(shift = loopbegin; shift >= 0; shift--)
      {
         sum[1] = 0;
         for(i = length; i >= 1  ; i--)
         {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+shift];
         sum[1]+=tmp;
         }
         wt[shift] = sum[1]*6/(length*(length+1));

//========== COLOR CODING ===========================================

       ExtMapBuffer3[shift] = wt[shift]; //red
       ExtMapBuffer2[shift] = wt[shift]; //green
       ExtMapBuffer1[shift] = wt[shift]; //yellow

       //  for(c=loopbegin;c==shift;c++)
       // {
        if (wt[shift+1] > wt[shift])
        {
        ExtMapBuffer2[shift+1] = EMPTY_VALUE;
  // ObjectCreate("smiley_face", OBJ_ARROW, 0, Time[shift], Low[shift]-Point*20);
  // Print("time=  ",Time[shift]);
  // ObjectSet("smiley_face", OBJPROP_ARROWCODE, 242);
  // ObjectSet("smiley_face", OBJPROP_COLOR , Red);
  // ObjectSet("smiley_face", OBJPROP_WIDTH  , 1);
  // ObjectsRedraw();

        //ExtMapBuffer3[shift+1] = EMPTY_VALUE;
        //ExtMapBuffer3[shift+1] = EMPTY_VALUE;

        }
       else if (wt[shift+1] < wt[shift])
        {
        ExtMapBuffer1[shift+1] = EMPTY_VALUE; //-1 red/greem tight
       //ExtMapBuffer3[shift+1] = EMPTY_VALUE;

        }
         else
         {

         ExtMapBuffer1[shift+1]=CLR_NONE;//EMPTY_VALUE;
         ExtMapBuffer2[shift+1]=CLR_NONE;//EMPTY_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 

LSMA_ind_01.mq4

//+------------------------------------------------------------------+
//|                                                        |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window

#property  indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

extern int Rperiod = 48;
extern int Draw4HowLong = 500;

//----- variables
int    c;
int    i;
int    length;
double lengthvar;
int    loopbegin;
int    pos;
int    width;

// arrays
double sum[];
double tmp ;
double wt[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   //2 additional buffers are used for counting.
   IndicatorBuffers(5);

   SetIndexBuffer(2,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(0,ExtMapBuffer3);
   SetIndexBuffer(3,sum);
   SetIndexBuffer(4,wt);

   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   return(0);
  }

int start()

  {
      length = Rperiod;
      loopbegin = Draw4HowLong - length - 1;

      for(pos = loopbegin; pos >= 0; pos--)
      {
         sum[1] = 0;
         for(i = length; i >= 1  ; i--)
         {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum[1]+=tmp;
         }

         wt[pos] = sum[1]*6/(length*(length+1));

//========== COLOR CODING ===========================================

      // 1 Yellow
      // 2 Green
      // 3 Red

       ExtMapBuffer3[pos] = wt[pos]; //red
       ExtMapBuffer2[pos] = wt[pos]; //green
       ExtMapBuffer1[pos] = wt[pos]; //yellow

        if (wt[pos+1] > wt[pos])
        {
        ExtMapBuffer2[pos+1] = EMPTY_VALUE;
        }
       else if (wt[pos+1] < wt[pos])
        {
        ExtMapBuffer1[pos+1] = EMPTY_VALUE; //-1 red/greem tight
        }
         else
         {
         ExtMapBuffer1[pos+1]=CLR_NONE;//EMPTY_VALUE;
         ExtMapBuffer2[pos+1]=CLR_NONE;//EMPTY_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 

LSMA_in_color_00a.mq4

//+------------------------------------------------------------------+
//| LSMA indicator with global variables to drive a companion expert |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window

#property indicator_buffers   5
#property indicator_color1  Yellow
#property indicator_color2  Green
#property indicator_color3  Red
#property indicator_color4  White
#property indicator_color5  White

//---- buffers
double ExtMapBuffer1[];  //Yellow
double ExtMapBuffer2[];  //Green
double ExtMapBuffer3[];  //Red
double XBuffer[];        //White
double ZBuffer[];        //White

extern int extRperiod = 32;
extern int extDraw4HowLong = 500;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {

   SetIndexBuffer(0,ExtMapBuffer1);   //Yellow
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(1,ExtMapBuffer2);  //Green
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2);

   SetIndexBuffer(2,ExtMapBuffer3);  //Red
   SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2);

   // 233 up arrow
   // 234 down arrow
   // 158 little dot
   // 159 big dot
   // 168 open square
   // 120 box with X
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexBuffer(3, XBuffer);     //White
   SetIndexArrow(3,120);

   SetIndexStyle(4,DRAW_ARROW);
   SetIndexBuffer(4, ZBuffer);     //White
   SetIndexArrow(4,159);

   return(0);
  }

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

   for( i=0; i<Bars; i++ ) ExtMapBuffer1[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer2[i]=0;
   for( i=0; i<Bars; i++ ) ExtMapBuffer3[i]=0;
   for( i=0; i<Bars; i++ ) XBuffer[i]=0;
   for( i=0; i<Bars; i++ ) ZBuffer[i]=0;

   return(0);
  }

int start()
  {

   //----- variables
   int    c;
   int    i;
   int    length;
   double lengthvar;
   int    loopbegin;
   int    pos;
   double sum;
   double tmp;
   int    width;

   double wtp; //previous value
   double wt;  //current value
   int    rc=0;
   int    gc=0;

   double p=Point;

   length = extRperiod;
   loopbegin = extDraw4HowLong - length - 1;

   for(pos = loopbegin; pos >= 0; pos--)
     {
      sum = 0;
      for(i = length; i >= 1  ; i--)
        {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+pos];
         sum+=tmp;
        }

      wtp=wt;
      wt = sum*6/(length*(length+1));

      ExtMapBuffer1[pos] = wt;   //yellow
      ExtMapBuffer2[pos] = wt+(10*Point());   //green
      ExtMapBuffer3[pos] = wt-(10*Point());   //red

      if (wtp > wt)
        {
         ExtMapBuffer2[pos+1] = wt; //remove GREEN
         rc++;
         ZBuffer[pos]=Low[pos];
        }
      else
        {
         ExtMapBuffer3[pos+1] = wt; //remove RED
         gc++;
         ZBuffer[pos]=High[pos];
        }

      //Comment("wtp=",wtp,"\nwt=",wt,"\nRed=",rc,"\nGreen=",gc);

      if (gc>0 && rc>0)
        {
         // Close any orders
         gc=0;
         rc=0;
        }

      if (gc==6)
        {
         // indicate buy order
         XBuffer[pos]=High[pos];
        }

      if (rc==6)
        {
         // indicate sell order
         XBuffer[pos]=Low[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 

LSMA_in_Color3.mq4

//+------------------------------------------------------------------+
//|                                                        |
//|                      Copyright ? 2004, MetaQuotes Software Corp. |
//|                                       http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property  copyright "Copyright ? 2005, FX Sniper "
#property  link      "http://www.metaquotes.net/"

//---- indicator settings
#property  indicator_chart_window
#property  indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Green
#property indicator_color3 Red

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
int width;

extern int Rperiod = 14;
extern int Draw4HowLongg = 1500;
int Draw4HowLong;
int shift;
int i;
int loopbegin;
double sum[];
int length;
double lengthvar;
double tmp ;
double wt[];
int c;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(5);

//---- drawing settings
   SetIndexBuffer(2,ExtMapBuffer1);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexBuffer(0,ExtMapBuffer3);
   SetIndexBuffer(3,sum);
   SetIndexBuffer(4,wt);

   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);

//---- initialization done
   return(0);
  }

int start()

  {   Draw4HowLong = Bars-Rperiod - 5;
      length = Rperiod;
      loopbegin = Draw4HowLong - length - 1;

      for(shift = loopbegin; shift >= 0; shift--)
      {
         sum[1] = 0;
         for(i = length; i >= 1  ; i--)
         {
         lengthvar = length + 1;
         lengthvar /= 3;
         tmp = 0;
         tmp = ( i - lengthvar)*Close[length-i+shift];
         sum[1]+=tmp;
         }
         wt[shift] = sum[1]*6/(length*(length+1));

//========== COLOR CODING ===========================================

       ExtMapBuffer3[shift] = wt[shift]; //red
       ExtMapBuffer2[shift] = wt[shift]; //green
       ExtMapBuffer1[shift] = wt[shift]; //yellow

       //  for(c=loopbegin;c==shift;c++)
       // {
        if (wt[shift+1] > wt[shift])
        {
        ExtMapBuffer2[shift] = EMPTY_VALUE;
  // ObjectCreate("smiley_face", OBJ_ARROW, 0, Time[shift], Low[shift]-Point*20);
  // Print("time=  ",Time[shift]);
  // ObjectSet("smiley_face", OBJPROP_ARROWCODE, 242);
  // ObjectSet("smiley_face", OBJPROP_COLOR , Red);
  // ObjectSet("smiley_face", OBJPROP_WIDTH  , 1);
  // ObjectsRedraw();

        //ExtMapBuffer3[shift+1] = EMPTY_VALUE;
        //ExtMapBuffer3[shift+1] = EMPTY_VALUE;

        }
       else if (wt[shift+1] < wt[shift])
        {
        ExtMapBuffer1[shift] = EMPTY_VALUE; //-1 red/greem tight
       //ExtMapBuffer3[shift+1] = EMPTY_VALUE;

        }
         else
         {

         ExtMapBuffer1[shift]=EMPTY_VALUE;//EMPTY_VALUE;
         ExtMapBuffer2[shift]=EMPTY_VALUE;//EMPTY_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 

 Page 1 of 4  1  2  3  4 »

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