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

G Archives

gStdPivots.mq4

//+------------------------------------------------------------------+
//|              cam_H2_H5_Historical_V4.mq4           gStdPivots.mq4|
//|                      Copyright ? 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//| Modified to chart historical camarilla pivots by MrPip           |
//| 3/28/06 Fixed problem of Sunday/Monday pivots                    |
//|         and added some ideas from goodtiding5 (Kenneth Z.)
//| 10/18/06 Modified by Stache to convert to std pivots      |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 Yellow
#property indicator_width1 1
#property indicator_style1 3
#property indicator_color2 DodgerBlue
#property indicator_width2 1
#property indicator_style2 3
#property indicator_color3 FireBrick
#property indicator_width3 1
#property indicator_style3 3
#property indicator_color4 Magenta
#property indicator_width4 1
#property indicator_style4 1
#property indicator_color5 FireBrick
#property indicator_width5 1
#property indicator_style5 3
#property indicator_color6 DodgerBlue
#property indicator_width6 1
#property indicator_style6 3
#property indicator_color7 Yellow
#property indicator_width7 1
#property indicator_style7 3

//---- input parameters

extern int  GMTshift=0;
extern color RColor = Green;
extern color SColor= Red;
extern int fontsize=10;
extern int LabelShift=20;

double R3Buffer[];
double R2Buffer[];
double R1Buffer[];
double PivotBuffer[];
double S1Buffer[];
double S2Buffer[];
double S3Buffer[];

double P, R1,R2,R3,S1,S2,S3;

double prev_high=0;
double prev_low=0;
double prev_close=0;
double cur_day=0;
double prev_day=0;
double day_high=0;
double day_low=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(7);
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,R3Buffer);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,R2Buffer);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,R1Buffer);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,PivotBuffer);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,S1Buffer);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,S2Buffer);
   SetIndexStyle(6,DRAW_LINE);
   SetIndexBuffer(6,S3Buffer);
   SetIndexLabel(0,"S3");
   SetIndexLabel(1,"S2");
   SetIndexLabel(2,"S1");
   SetIndexLabel(3,"Pivot");
   SetIndexLabel(4,"R1");
   SetIndexLabel(5,"R2");
   SetIndexLabel(6,"R3");

//----
//   IndicatorShortName("gStdPivots);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   ObjectDelete("CamPivot");
   ObjectDelete("ResH2");
   ObjectDelete("ResH3");
   ObjectDelete("ResH4");
   ObjectDelete("ResH5");
   ObjectDelete("ResH4");
   ObjectDelete("ResH5");
//----
   return(0);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int cnt, limit;

//---- exit if period is greater than 4 hr charts
   if(Period() > 240)
   {
      Alert("Error - Chart period is greater than 4 Hr.");
      return(-1); // then exit
   }
   if(counted_bars<0) return(-1);

//---- last counted bar will be recounted
//   if(counted_bars>0) counted_bars--;

//   limit=(Bars-counted_bars)-1;
   limit=counted_bars;

//---- Get new daily prices & calculate pivots

   for (cnt=limit;cnt >=0;cnt--)
   {
   	if (TimeDayOfWeek(Time[cnt]) == 0)
	   {
        cur_day = prev_day;
	   }
	   else
	   {
        cur_day = TimeDay(Time[cnt]- (GMTshift*3600));
	   }

   	if (prev_day != cur_day)
   	{
	   	prev_close = Close[cnt+1];
		   prev_high = day_high;
		   prev_low = day_low;

	      day_high = High[cnt];
 	      day_low  = Low[cnt];

   P  = (prev_high + prev_low + prev_close)/3;//Pivot
   R1 = (2*P)-prev_low;
   S1 = (2*P)-prev_high;
   R2 = P+(prev_high - prev_low);
   S2 = P-(prev_high - prev_low);
   R3 = (2*P)+(prev_high-(2*prev_low));
   S3 = (2*P)-((2* prev_high)-prev_low);

		   prev_day = cur_day;
	   }
      if (High[cnt]>day_high)
      {
         day_high = High[cnt];
      }
      if (Low[cnt]<day_low)
      {
         day_low = Low[cnt];
      }

//         day_low=Open[cnt]; day_high=Open[cnt];

//---  Draw  Pivot lines on chart

      PivotBuffer[cnt]=P;
      R3Buffer[cnt]=R3;
      R2Buffer[cnt]=R2;
      R1Buffer[cnt]=R1;
      S1Buffer[cnt]=S1;
      S2Buffer[cnt]=S2;
      S3Buffer[cnt]=S3;
   }

   if (cur_day == TimeDay(CurTime()))   DisplayLabels();
//----
   return(0);
  }

void DisplayLabels()
{
      if(ObjectFind("CamPivot") != 0)
      {
        ObjectCreate("StsPivot", OBJ_TEXT, 0, 0,0);
        ObjectSetText("StdPivot", "                 Pivot",fontsize,"Arial",Yellow);
      }
      else
      {
        ObjectMove("StdPivot", 0, Time[20],P);
      }

      if(ObjectFind("Res 3") != 0)
      {
      ObjectCreate("Res 3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res 3", "      R 3",fontsize,"Arial",RColor);
      }
      else
      {
         ObjectMove("Res 3", 0, Time[20],R3);
      }

      if(ObjectFind("Res 2") != 0)
      {
      ObjectCreate("Res 2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res 2", "      R 2",fontsize,"Arial",RColor);
      }
      else
      {
         ObjectMove("Res 2", 0, Time[20],R2);
      }

      if(ObjectFind("Res 1") != 0)
      {
      ObjectCreate("Res 1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Res 1", "      R 1",fontsize,"Arial",RColor);
      }
      else
      {
         ObjectMove("Res 1", 0, Time[20],R1);
      }

      if(ObjectFind("Sup 1") != 0)
      {
      ObjectCreate("Sup 1", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup 1", "      S 1",fontsize,"Arial",SColor);
      }
      else
      {
         ObjectMove("Sup 1", 0, Time[20],S1);
      }

      if(ObjectFind("Sup 2") != 0)
      {
      ObjectCreate("Sup 2", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup 2", "      S 2",fontsize,"Arial",SColor);
      }
      else
      {
         ObjectMove("Sup 2", 0, Time[20],S2);
      }
      if(ObjectFind("Sup 3") != 0)
      {
      ObjectCreate("Sup 3", OBJ_TEXT, 0, 0, 0);
      ObjectSetText("Sup 3", "      S 3",fontsize,"Arial",SColor);
      }
      else
      {
         ObjectMove("Sup 3", 0, Time[20],S3);
      }

}
//+------------------------------------------------------------------+

[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 

Grid_v1_0.mq4

//+------------------------------------------------------------------+
//|                                                         Grid.mq4 |
//|                                                          4xcoder |
//|                                              4xcoder@4xcoder.com |
//+------------------------------------------------------------------+
#property copyright "4xcoder"
#property link      "4xcoder@4xcoder.com"

#property indicator_chart_window
//---- input parameters
extern int       HGrid.Weeks=10;       // Period over which to calc High/Low of gird
extern int       HGrid.Pips=20;        // Size of grid in Pips
extern color     HLine=DimGray;        // Color of grid
extern color     HLine2=DarkGreen;     // Every 100 pips, change grid color to this.

extern int       GridTime=15;          // Number of periods (days or weeks) to draw time grid
extern int       TimeGrid=PERIOD_H4;   // Grid period in minutes
extern int       ColorHour=16;         // For hour grids, draw color line at this hour (broker time)
extern color     TimeLine=DimGray;     // Color of grid
extern color     TimeLine2=DarkGreen;  // Color of special bars

// Recommends settings:
// 1 minute - HGrid.Pips=10, TimeGrid = 10
// 5, 15 minutes - HGrid.Pips=20, TimeGrid= PERIOD_H1 (60)
// 30, 60 minutes - HGrid.Pips=20, TimeGrid = PERIOD_H4 (240) or 2 hours (120)
// 4 hour - HGrid.Pips=50, TimeGrid = PERIOD_D1 (1440) or 12 hours (720)
// 1 day - HGrid.Pips=50, TimeGrid = PERIOD_W1 (10800).

bool firstTime = true;
datetime lastTime = 0;
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   if ( true /*lastTime == 0 || CurTime() - lastTime > 5*/ ) {
      firstTime = false;
      lastTime = CurTime();

      if ( HGrid.Weeks > 0 && HGrid.Pips > 0 ) {
         double weekH = iHigh( NULL, PERIOD_W1, 0 );
         double weekL = iLow( NULL, PERIOD_W1, 0 );

         for ( int i = 1; i < HGrid.Weeks; i++ ) {
            weekH = MathMax( weekH, iHigh( NULL, PERIOD_W1, i ) );
            weekL = MathMin( weekL, iLow( NULL, PERIOD_W1, i ) );
         }

         double pipRange = HGrid.Pips * Point;
         if ( Symbol() == "GOLD" )
            pipRange = pipRange * 10.0;

         double topPips = (weekH + pipRange) - MathMod( weekH, pipRange );
         double botPips = weekL - MathMod( weekL, pipRange );

         for ( double p = botPips; p <= topPips; p += pipRange ) {
            string gridname = "grid_" + DoubleToStr( p, Digits );
            ObjectCreate( gridname, OBJ_HLINE, 0, 0, p );

            double pp = p / Point;
            int pInt = MathRound( pp );
            int mod = 100;
            if ( Symbol() == "GOLD" )
               mod = 1000;
            if ( (pInt % mod) == 0 )
               ObjectSet( gridname, OBJPROP_COLOR, HLine2 );
            else
               ObjectSet( gridname, OBJPROP_COLOR, HLine );
            ObjectSet( gridname, OBJPROP_STYLE, STYLE_DOT );
            ObjectSet( gridname, OBJPROP_PRICE1, p );
            ObjectSet( gridname, OBJPROP_BACK, true );
         }
      }

   }

   datetime start;
   if ( TimeGrid == PERIOD_W1 ) {
      int weekCount = GridTime - 1;
      int bar=0;
      while ( weekCount >= 0 && bar < Bars ) {
         if ( TimeDayOfWeek( Time[bar] ) == 1 && TimeHour( Time[bar] ) == 0  ) {
            start = Time[bar];
            gridname = "grid_" + DoubleToStr( start, 0 );
            ObjectCreate( gridname, OBJ_VLINE, 0, start, 0 );
            if ( TimeHour( start ) == ColorHour && TimeMinute( start ) == 0 )
               ObjectSet( gridname, OBJPROP_COLOR, TimeLine2 );
            else
               ObjectSet( gridname, OBJPROP_COLOR, TimeLine );
            ObjectSet( gridname, OBJPROP_STYLE, STYLE_DASHDOTDOT );
            ObjectSet( gridname, OBJPROP_TIME1, start );
            ObjectSet( gridname, OBJPROP_BACK, true );
            weekCount--;
         }
         bar++;
      }
   }

   if ( TimeGrid > 0 ) {
      start = Time[0];
      int skip = TimeGrid * 60;

      start = start - (start % skip) + skip;

      int thisDay = TimeDay( start );
      int dayCount = GridTime - 1;

      while ( dayCount >= 0 ) {
         gridname = "grid_" + DoubleToStr( start, 0 );
         ObjectCreate( gridname, OBJ_VLINE, 0, start, 0 );
         if ( TimeHour( start ) == ColorHour && TimeMinute( start ) == 0 )
            ObjectSet( gridname, OBJPROP_COLOR, TimeLine2 );
         else
            ObjectSet( gridname, OBJPROP_COLOR, TimeLine );
         ObjectSet( gridname, OBJPROP_STYLE, STYLE_DASHDOTDOT );
         ObjectSet( gridname, OBJPROP_TIME1, start );
         ObjectSet( gridname, OBJPROP_BACK, true );

         start = start - skip;
         if ( TimeDay( start ) != thisDay ) {
            dayCount--;
            thisDay = TimeDay( start );
         }
      }

   }

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

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   firstTime = true;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

   for ( int i = ObjectsTotal() - 1; i >= 0; i-- ) {
      string name = ObjectName( i );
      if ( StringFind( name, "grid_" ) >= 0 )
         ObjectDelete( name );
   }

//----
   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 

Grid Builder.mq4

//+------------------------------------------------------------------+
//|                                      2Extreme4U Grid Builder.mq4 |
//|                     Copyright ? 2005, Siddiqi, Alejandro Galindo |
//|                                              http://elCactus.com |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Siddiqi, Alejandro Galindo"
#property link      "http://elCactus.com"

#property indicator_chart_window
extern int GridSpace=50;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   double shift=0;
   double HighPrice=0;
   double LowPrice=0;

   double Divisor = 0.1/Point;

   HighPrice = MathRound(High[Highest(NULL,0,2, Bars - 2,  2)] * Divisor);
   //SL = High[Highest(MODE_HIGH, SLLookback, SLLookback)];
   LowPrice = MathRound(Low[Lowest(NULL,0,1, Bars - 1, 2)] * Divisor);
   for(shift=LowPrice;shift<=HighPrice;shift++)
   {
      ObjectDelete("Grid"+shift);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   double I=0;
   double HighPrice=0;
   double LowPrice=0;
   int GridS=0;
   int SL=0;
//----

   double Divisor = 0.1/Point;

   HighPrice = MathRound(High[Highest(NULL,0,MODE_HIGH, Bars - 2, 2)] * Divisor);
   //SL = High[Highest(MODE_HIGH, SLLookback, SLLookback)];
   LowPrice = MathRound(Low[Lowest(NULL,0,MODE_LOW, Bars - 1, 2)] * Divisor);
   GridS = GridSpace / 10;

   for(I=LowPrice;I<=HighPrice;I++)
   {
	  //Print("mod(I, GridSpace): " + MathMod(I, GridS) + " I= " + I);
	  //Print(LowPrice + " " + HighPrice);
	  if (MathMod(I, GridS) == 0)
	  {
         if (ObjectFind("Grid"+I) != 0)
         {
            ObjectCreate("Grid"+I, OBJ_HLINE, 0, Time[1], I/Divisor);
            ObjectSet("Grid"+I, OBJPROP_STYLE, STYLE_SOLID);
            ObjectSet("Grid"+I, OBJPROP_COLOR, MediumSeaGreen);
         }
		 //MoveObject(I + "Grid", OBJ_HLINE, Time[Bars - 2], I/1000, Time[1], I/1000, MediumSeaGreen, 1, STYLE_SOLID);
	  }
   }
//----
   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 

Good_Macd.mq4

//+------------------------------------------------------------------+
//|                                                         MACD.mq4 |
//|                                Copyright ? 2005, David W. Thomas |
//|                                           mailto:davidwt@usa.net |
//+------------------------------------------------------------------+
// This is the correct computation and display of MACD.
#property copyright "Copyright ? 2005, David W. Thomas"
#property link      "mailto:davidwt@usa.net"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_color3 Green

//---- input parameters
extern int       FastMAPeriod=12;
extern int       SlowMAPeriod=26;
extern int       SignalMAPeriod=9;

//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
double HistogramBuffer[];

//---- variables
double alpha = 0;
double alpha_1 = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   //---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MACDLineBuffer);
   SetIndexDrawBegin(0,SlowMAPeriod);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,SignalLineBuffer);
   SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,HistogramBuffer);
   SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod);
   //---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   //----
	alpha = 2.0 / (SignalMAPeriod + 1.0);
	alpha_1 = 1.0 - alpha;
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   //----

   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   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(int i=limit; i>=0; i--)
   {
      MACDLineBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i);
      SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1];
      HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[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 

Good_Macd dark screen.mq4

//+------------------------------------------------------------------+
//|                                                         MACD.mq4 |
//|                                Copyright ? 2005, David W. Thomas |
//|                                           mailto:davidwt@usa.net |
//+------------------------------------------------------------------+
// This is the correct computation and display of MACD.
#property copyright "Copyright ? 2005, David W. Thomas"
#property link      "mailto:davidwt@usa.net"

#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2 DeepPink
#property indicator_color3 MintCream

//---- input parameters
extern int       FastMAPeriod=12;
extern int       SlowMAPeriod=26;
extern int       SignalMAPeriod=9;

//---- buffers
double MACDLineBuffer[];
double SignalLineBuffer[];
double HistogramBuffer[];

//---- variables
double alpha = 0;
double alpha_1 = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
{
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);
   //---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,MACDLineBuffer);
   SetIndexDrawBegin(0,SlowMAPeriod);
   SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
   SetIndexBuffer(1,SignalLineBuffer);
   SetIndexDrawBegin(1,SlowMAPeriod+SignalMAPeriod);
   SetIndexStyle(2,DRAW_HISTOGRAM);
   SetIndexBuffer(2,HistogramBuffer);
   SetIndexDrawBegin(2,SlowMAPeriod+SignalMAPeriod);
   //---- name for DataWindow and indicator subwindow label
   IndicatorShortName("MACD("+FastMAPeriod+","+SlowMAPeriod+","+SignalMAPeriod+")");
   SetIndexLabel(0,"MACD");
   SetIndexLabel(1,"Signal");
   //----
	alpha = 2.0 / (SignalMAPeriod + 1.0);
	alpha_1 = 1.0 - alpha;
   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{
   //----

   //----
   return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
{
   int limit;
   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(int i=limit; i>=0; i--)
   {
      MACDLineBuffer[i] = iMA(NULL,0,FastMAPeriod,0,MODE_EMA,PRICE_CLOSE,i) - iMA(NULL,0,SlowMAPeriod,0,MODE_EMA,PRICE_CLOSE,i);
      SignalLineBuffer[i] = alpha*MACDLineBuffer[i] + alpha_1*SignalLineBuffer[i+1];
      HistogramBuffer[i] = MACDLineBuffer[i] - SignalLineBuffer[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 

GMMA Short.mq4

//+------------------------------------------------------------------+
//|                        Guppy Mulitple Moving Average (Short).mq4 |
//|                                  Code written by - Matt Trigwell |
//|                                                                  |
//+------------------------------------------------------------------+

// ***** For information on how to use this fantastic indicator *****
// http://www.guppytraders.com/
// http://www.market-analyst.com/kb/article.php/Guppy_Multiple_Moving_Average
// http://tradermike.net/2004/05/another_look_at_multiple_moving_averages

// ***** INSTRUCTIONS *****
// Add the GMMA Short indicator and the GMMA Long indicator to your charts.
// This is the GMMA Short indicator

#property copyright "Code written by - Matt Trigwell"

#property indicator_chart_window
#property indicator_buffers 5
#property indicator_color1 ForestGreen
#property indicator_color2 ForestGreen
#property indicator_color3 ForestGreen
#property indicator_color4 ForestGreen
#property indicator_color5 ForestGreen

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

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,0,10,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer4[i]=iMA(NULL,0,12,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer5[i]=iMA(NULL,0,15,0,MODE_EMA,PRICE_CLOSE,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 

GMMA Long.mq4

//+------------------------------------------------------------------+
//|                        Guppy Mulitple Moving Average (Long).mq4 |
//|                                  Code written by - Matt Trigwell |
//|                                                                  |
//+------------------------------------------------------------------+

// ***** INSTRUCTIONS *****
// Add the GMMA Short indicator and the GMMA Long indicator to your charts.
// This is the GMMA Long indicator

// ***** For information on how to use this fantastic indicator *****
// http://www.guppytraders.com/
// http://www.market-analyst.com/kb/article.php/Guppy_Multiple_Moving_Average
// http://tradermike.net/2004/05/another_look_at_multiple_moving_averages

#property copyright "Code written by - Matt Trigwell"

#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Blue
#property indicator_color2 Blue
#property indicator_color3 Blue
#property indicator_color4 Blue
#property indicator_color5 Blue
#property indicator_color6 Blue

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
double ExtMapBuffer6[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexStyle(4,DRAW_LINE);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexStyle(5,DRAW_LINE);
   SetIndexBuffer(5,ExtMapBuffer6);
//----
   return(0);
  }

int deinit()
  {
   return(0);
  }

int start()
  {
   int i,j,limit,counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(i=0; i<limit; i++){
      ExtMapBuffer1[i]=iMA(NULL,0,30,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer2[i]=iMA(NULL,0,35,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer3[i]=iMA(NULL,0,40,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer4[i]=iMA(NULL,0,45,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer5[i]=iMA(NULL,0,50,0,MODE_EMA,PRICE_CLOSE,i);
      ExtMapBuffer6[i]=iMA(NULL,0,60,0,MODE_EMA,PRICE_CLOSE,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 

GetNewsFF_v02.mq4

//=============================================================================
//                                                            GetNewsFF.mq4
//                                            Copyright ? 2006, Derk Wehler
//                   Code derieved from original by: Copyright ? 2006, Abhi
//
// This "indicator" calls DLLs to fetch the ForexFactory web page in order
// to retreive announcement information for the week.  It writes this web
// page out to an .htm file, but more importantly, parses the page to extract
// announcement information and writes this to a .csv file in the folder:
// experts/files.  It does once the first time it is run, and then again
// once at the top of each hour (in case of updates).
//
// In order for this to work correctly and synchronize with your broker's
// server time, you must enter the proper value for "TimeZone".  This is
// entered relative to GMT.  For example, my broker's server time is GMT+1,
// so I have the default set to 1.  If your broker uses GMT+3, enter 3.
// If your broker uses GMT-2, then enter -2.
//
//=============================================================================
#property copyright "Copyright ? 2006, Derk Wehler"
#property link      ""

#property indicator_chart_window

#include <WinInet.mqh>

extern string	sUrl = "http://www.forexfactory.com/index.php?s=&page=calendar&timezoneoffset=g";
extern string 	Outputfile = 		"NewsItems.csv";
extern bool 	IncludeHigh = 		true;
extern bool 	IncludeMedium =		true;
extern bool 	IncludeLow = 		false;
extern bool 	IncludeSpeaks = 	true; 	// news items with "Speaks" in them have very different characteristics
extern bool 	RemoveDuplicates = 	true;	// only one news item per time
extern string 	ConvertUSDto = 		"USD"; 	// can change this to a full currency pair such as "GBPUSD"
extern string	TimeZone = 			"1";	// Set this to the GMT addition, so "1" for GMT+1, "-3" for GMT-3
extern int		DebugLevel =		0;

int handle;
int bytes;
int beginning, finalend,end,i;
string sData, csvoutput;
string lastNewsdate, lastNewstime, lastCountry;
string aju, text, newsdate, newstime, country, news, level, actual, forecast, previous;

static bool FirstRun = true;

int init()
{
	return(0);
}

int deinit()
{
	return(0);
}

int start()
{
	// All this code was originally in the init() function in Abhi's code.
	// I have moved it to the start() function so that it will not run
	// until the EA is enabled
	if (DebugLevel > 0)
		Comment("Cur Min = ", Minute(), "\n");

	// Run on startup, and Re-run once at the top of each hour
	if (!FirstRun && Minute() != 0)
		return (0);
	FirstRun = false;

	string myUrl = sUrl + TimeZone;
	if (DebugLevel > 1)
		Print("myUrl == ", myUrl);

	// THIS CALL WAS DONATED BY PAUL TO HELP FIX THE RESOURCE ERROR
	GrabWeb(myUrl, sData);

	// Write the contents of the ForexFactory page to an .htm file
	handle = FileOpen(Day() + "-" + Month() + "-" + Year() + "-" + "grabweb.htm", FILE_BIN|FILE_READ|FILE_WRITE);
	if (handle < 1)
	{
		if (DebugLevel > 0)
			Print("Can\'t open htm file, the last error is ", GetLastError());
		return(false);
	}
	FileWriteString(handle, sData, StringLen(sData));
	FileClose(handle);

	// THIS BLOCK OF CODE DONATED BY WALLY TO FIX THE RESOURCE ERROR
	//--- Look for the end HTML tag to ensure that a complete page was downloaded ---//
	beginning = 1;
	beginning = StringFind(sData, "</html>", beginning);

	if (beginning <= 0)
	{
		Alert("GetNewsFF Error - Web page download was not complete!");
		return(false);
	}
	//-------------------------------------------------------------------------------//

	if (DebugLevel > 1)
		Print("bytes: "+bytes);

	// Now the .htm file is written; let's parse it now and write to csv file
	handle = FileOpen(Outputfile, FILE_CSV|FILE_WRITE, ",");
	if (handle < 1)
	{
		if (DebugLevel > 0)
			Print("Can\'t open csv file, the last error is ", GetLastError());
		return(false);
	}

	FileWrite(handle, "Description", "Currency", "DateTime", "TimeZone", "Level");

	beginning = 1;
	beginning = StringFind(sData, "<span class=\"smallfont\">Info.</span>", beginning) + 36;
	finalend = StringFind(sData, "</table>", beginning) - 1235;

	while (beginning < finalend)
	{
		for (i=0; i < 8; i++)
		{
			beginning = StringFind(sData, "<span class=\"smallfont\"", beginning)+23;
			beginning = StringFind(sData, ">", beginning)+1;
			end = StringFind(sData, "</span>", beginning)-0;
			if (end != beginning)
			{
				text = StringSubstr(sData, beginning, end-beginning);
			}
			else
			{
				text = "";
			}

			if (i == 0)
			{
				if (text != "")
				{
					newsdate = text;
				}
				else
				{
					text = newsdate;
				}
			}

		// date and time conversion here if needed

			if (i == 1)
			{
				text = StringTrimLeft(text);
				newstime = StringTrimRight(text);
			}

			if (i == 2)
			{
				country = text;
			}
			if (i == 3)
			{
				news = text;
				beginning = StringFind(sData, "src=\"http://www.forexfactory.com/forexforum/images/misc/", beginning) + 59;
				end = StringFind(sData, ".gif", beginning);
				text = StringSubstr(sData, beginning, end-beginning);
				level = text;
			}
			if (i == 4)
			{
				actual = text;
			}
			if (i == 5)
			{
				forecast = text;
			}
			if (i == 6)
			{
				previous = text;
			}

         }
//		csvoutput = newsdate + ", " + newstime + ", " + country + ", " + news + ", " +level + ", " + actual + ", " + forecast + ", " + previous;

		if (!IncludeHigh && level == "high")
			continue;
		if (!IncludeMedium && level == "med")
			continue;
		if (!IncludeLow && level == "low")
			continue;
		if (!IncludeSpeaks && (StringFind(news,"speaks") != -1 || StringFind(news,"Speaks") != -1) )
			continue;
		if (newstime == "tentative" || newstime == "Tentative")
			continue;
		if (RemoveDuplicates && lastNewsdate == newsdate && lastNewstime == newstime && lastCountry == country)
			continue;

		if (country == "USD")
			country = ConvertUSDto;

		int nLevel = 0;
		if (level == "high")
			nLevel = 3;
		if (level == "med")
			nLevel = 2;
		if (level == "low")
			nLevel = 1;

		lastNewsdate = newsdate;
		lastNewstime = newstime;
		lastCountry = country;

		string tz = "GMT";
		if (StrToInteger(TimeZone) > 0)
			tz = tz + "+";
		tz = tz + TimeZone;

		csvoutput = StringConcatenate(news, ",", country, ",", MakeDateTime(newsdate,newstime), ",", tz, ",", nLevel);
		if (DebugLevel > 1)
			Print("newslist: " + csvoutput);
		FileWrite(handle, news, country, MakeDateTime(newsdate,newstime), tz, nLevel);
	}
	FileClose(handle);

	return (0);
}

string MakeDateTime(string strDate, string strTime)
{
	// converts forexfactory time & date into yyyy.mm.dd hh:mm
	int nDateSpacePos = StringFind(strDate," ");
	int nDateSlashPos = StringFind(strDate,"/");

	string strMonth = StringSubstr(strDate,nDateSpacePos+1,nDateSlashPos-nDateSpacePos-1);
	string strDay = StringSubstr(strDate,nDateSlashPos+1);

	int nTimeColonPos	= StringFind(strTime,":");
	string strHour = StringSubstr(strTime,0,nTimeColonPos);
	string strMinute = StringSubstr(strTime,nTimeColonPos+1,2);
	string strAM_PM = StringSubstr(strTime,StringLen(strTime)-2);

	int nHour24 = StrToInteger(strHour);
	if (strAM_PM == "pm" || strAM_PM == "PM" && nHour24 != 12)
	{
		nHour24 += 12;
	}
	string strHourPad = "";
	if (nHour24 < 10) strHourPad = "0";

	return(StringConcatenate(Year(),".",strMonth,".",strDay," ",strHourPad,nHour24,":",strMinute));
}

[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 

GentorCCI.mq4

//+------------------------------------------------------------------+
//|                                                   GentorCCIM .mq4 |
//|                                                   Egorov Gennadiy |
//+------------------------------------------------------------------+
#property copyright "Egorov Gennadiy"
#property link      ""

#property indicator_separate_window
#property indicator_buffers 5

#property indicator_color1 Red
#property indicator_color2 Black
#property indicator_color3 Lime
#property indicator_color4 Yellow
#property indicator_color5 Green

#property indicator_level1 300
#property indicator_level2 200
#property indicator_level3 100
#property indicator_level4 50
#property indicator_level5 -50
#property indicator_level6 -100
#property indicator_level7 -200
#property indicator_level8 -300
//---- input parameters
extern int       A_period=14;
extern int       B_period=6;
extern int       EMA=34;
extern int       num_bars=300;
// parameters
int shift=0;

//---- buffers
double FastWoodieCCI[];
double SlowWoodieCCI[];
double HistoWoodieCCI[];
double LineHighEMA[];
double LineLowEMA[];

//---- indicator buffers

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorDigits(2);
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexBuffer(0,FastWoodieCCI);
   SetIndexStyle(1,DRAW_LINE,0,2);
   SetIndexBuffer(1,SlowWoodieCCI);
   SetIndexStyle(2,DRAW_HISTOGRAM,0,1);
   SetIndexBuffer(2,HistoWoodieCCI);
   SetIndexStyle(3,DRAW_LINE,1,3);
   SetIndexBuffer(3,LineHighEMA);
   SetIndexStyle(4,DRAW_LINE,1,3);
   SetIndexBuffer(4,LineLowEMA);

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

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int   i;
   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--;

   counted_bars = Bars - counted_bars;

   for (shift = 0; shift < counted_bars; shift++)
   {
      //
      FastWoodieCCI[shift]=iCCI(NULL,0,B_period,PRICE_TYPICAL,shift);
      SlowWoodieCCI[shift]=iCCI(NULL,0,A_period,PRICE_TYPICAL,shift);
      HistoWoodieCCI[shift]=iCCI(NULL,0,A_period,PRICE_TYPICAL,shift);
//----------------color coding---------------------------
      LineLowEMA[shift]=0;
      LineHighEMA[shift]=0;

      double EmaValue = iMA( NULL, 0, EMA, 0, MODE_EMA, PRICE_TYPICAL, shift );
      if ( Close[shift] > EmaValue )
         LineHighEMA[shift]=EMPTY_VALUE;
      else
      if (Close[shift] < EmaValue )
         LineLowEMA[shift]=EMPTY_VALUE;

   }

//---- done
   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 

GannZigZag.mq4

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

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DeepSkyBlue
#property indicator_color2 Black
//---- input parameters
extern int GSv_range=2;
//---- buffers
double GSv_sl[];
double GSv_m[];
//----
bool draw_up=0,draw_dn=0,initfl=0;
int  fPoint_i,sPoint_i,s_up,s_dn,drawf,lb,idFile;
double h,l;
bool cur_h=0,cur_l=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_SECTION,STYLE_DOT);
   //SetIndexStyle(1,DRAW_SECTION);
   SetIndexBuffer(0,GSv_sl);
   //SetIndexBuffer(1,GSv_m);
   SetIndexEmptyValue(0,0.0);
   //SetIndexEmptyValue(1,0.0);
   FileDelete("Gann.txt");
   idFile=FileOpen("Gann.txt",FILE_READ|FILE_WRITE,"  ");
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   int cb,limit,i;
//----
   if( GSv_range<1 )
   {
      Alert("????? ?????? ????? /n ?? ????? GSv_range ? ??? 1!!!");
      return(-1);
   }
   if( counted_bars<0 )
   {
      return(-1);
   }
   else
   {
      if( Bars-1-counted_bars<=0 )
      {
         limit=0;
      }
      else
      {
         limit=Bars-1-counted_bars;
      }
   }
   //???????? ???????
   if( initfl!=1 )
   {
      myInit();
   }
   //FileWrite(idFile,"  0. ??? ? ???? "+Bars);
   //?? ? ???
   for( cb=limit;cb>=0;cb--)
   {
      if( cb==0 ) FileWrite(idFile,"---- ??? ???? ?? "+cb+" "+(Bars-1-cb)+" ??? "+TimeToStr(Time[cb])+" ??? ? ???? "+Bars);
      //?? ? ????? ?? ?? ????? ?????
      if( GSv_sl[cb+1]>0 && lb!=Bars-1-cb )
      {
         if( draw_up!=0 )
         {
            s_dn=0;
            if( cb==0 ) FileWrite(idFile,"  1. ?? ????? ????, ???? ????? ????");
         }
         else
         {
            if( draw_dn!=0 )
            {
               s_up=0;
               if( cb==0 ) FileWrite(idFile,"  2. ?? ????? ????, ???? ????? ????");
            }
         }
      }
      if( lb!=Bars-1-cb )
      {
         cur_h=0;
         cur_l=0;
         if( cb==0 ) FileWrite(idFile,"  2.1 ??? ?? ??? ???? ????? ? ???? ????");
      }
      if( cb>Bars-2-drawf || (High[cb]<=High[cb+1] && Low[cb]>=Low[cb+1]) )
      {
         if( cb==0 ) FileWrite(idFile,"  3. ?? ?? '?????', ?? ? ???? ?????");
         continue;
      }
      if( draw_up!=0 )
      {
         if( cb==0 ) FileWrite(idFile,"  4. ????? ????? ???");
         //?? ??? ????? ???
         if( High[cb]>h )
         {
            //?? ????? ??? ????
            h=High[cb];
            cur_h=1;
            if( cb==0 ) FileWrite(idFile,"  5. ????? ??? ???? = "+h+" cur_h "+cur_h);
         }
         if( Low[cb]<l )
         {
            //?? ????? ??? ????
            l=Low[cb];
            if( cb==0 ) FileWrite(idFile,"  6. ????? ??? ???? = "+l);
            //?? ?? ? ?? ? ??? ??
            if( lb!=Bars-1-cb || cur_l!=1 ) s_dn++;
            cur_l=1;
            if( cb==0 ) FileWrite(idFile,"  7. ?? ???, ???? ????? ???? "+s_dn+" cur_l "+cur_l);
         }
         //?? ???? ???
         if( s_up==s_dn )
         {
            if( cb==0 ) FileWrite(idFile,"  8. ???? ???");
            //?? ????? ?? ?????? ??? ???? ? ????
            if( cur_h==cur_l && cur_l==1 )
            {
               if( cb==0 ) FileWrite(idFile,"  9. ?? ?? ?????");
               //?? ??? ?????
               if( Close[cb]<=Open[cb] )
               {
                  draw_up=0;
                  draw_dn=1;
                  fPoint_i=sPoint_i;
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=l;
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  10. ??? ?????, ??? ??? = "+draw_up+", ??? ??,"+draw_dn+" fPoint_i = "+fPoint_i+" sPoint_i "+sPoint_i+" ????? = "+GSv_sl[cb]);
               }
               else
               {
                  //?? ??? ???
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=h;
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  11. ??? ???, ??? ??? = "+draw_up+", ??? ??,"+draw_dn+" fPoint_i = "+fPoint_i+" sPoint_i "+sPoint_i+" ????? = "+GSv_sl[cb]);
               }
            }
            else
            {
               //?? ????? ?? ??? ??? ????
               if( cur_h==1 )
               {
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=h;
                  l=Low[cb];
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  12. ??? ????, ????? = "+GSv_sl[cb]+" sPoint_i "+sPoint_i+" l "+l);
               }
               else
               {
                  if( cur_l==1 )
                  {
                     //?? ????? ?? ??? ??? ????
                     draw_up=0;
                     draw_dn=1;
                     fPoint_i=sPoint_i;
                     sPoint_i=Bars-1-cb;
                     GSv_sl[cb]=l;
                     h=High[cb];
                     for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                     {
                        GSv_sl[i]=0;
                     }
                     if( cb==0 ) FileWrite(idFile,"  13. ??? ????, ????? = "+GSv_sl[cb]+" fPoint_i "+fPoint_i+" sPoint_i "+sPoint_i+" draw_up "+draw_up+" draw_dn "+draw_dn+" h "+h);
                  }
               }
            }
         }
         else
         {
            //??? ?? ??? ?????? ?? ??? (???? Dn ??? ? ??? GSv_range)
            if( cb==0 ) FileWrite(idFile,"  14. ???? ? ???");
            //?? ????? ??? ????
            if( cur_h==1 )
            {
               sPoint_i=Bars-1-cb;
               GSv_sl[cb]=h;
               for( i=cb+1;i<Bars-1-fPoint_i;i++ )
               {
                  GSv_sl[i]=0;
               }
               l=Low[cb];
               if( cb==0 ) FileWrite(idFile,"  15. ?? ??? ????, ????? "+GSv_sl[cb]+" sPoint_i "+sPoint_i+" l "+l);
            }
         }
      }
      else
      {
         //?? ??? ????? ??
         if( cb==0 ) FileWrite(idFile,"  16. ????? ????? ??");
         if( High[cb]>h )
         {
            //?? ????? ??? ????
            h=High[cb];
            if( cb==0 ) FileWrite(idFile,"  17. ????? ??? ???? "+h);
            if( lb!=Bars-1-cb || cur_h!=1 ) s_up++;
            cur_h=1;
            //?? ?? ? ?? ? ??? ??
            if( cb==0 ) FileWrite(idFile,"  18. ??? ??, ???? ????? ???? "+s_up+" cur_h "+cur_h+" h "+h);
         }
         if( Low[cb]<l )
         {
            //?? ????? ??? ????
            l=Low[cb];
            cur_l=1;
            if( cb==0 ) FileWrite(idFile,"  19. ????? ??? ???? "+l+" cur_l "+cur_l);
         }
         //?? ???? ???
         if( s_up==s_dn )
         {
            if( cb==0 ) FileWrite(idFile,"  20. ???? ???");
            //?? ????? ?? ?????? ??? ???? ? ????
            if( cur_h==cur_l && cur_l==1 )
            {
               if( cb==0 ) FileWrite(idFile,"  21. ?? ?? ?????");
               //?? ??? ?????
               if( Close[cb]<=Open[cb] )
               {
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=l;
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  22. ??? ?????, ????? "+GSv_sl[cb]+" sPoint_i "+sPoint_i);
               }
               else
               {
                  //?? ??? ???
                  draw_up=1;
                  draw_dn=0;
                  fPoint_i=sPoint_i;
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=h;
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  23. ??? ???, ????? "+GSv_sl[cb]+" draw_up "+draw_up+" draw_dn "+draw_dn+" sPoint_i "+sPoint_i+" fPoint_i "+fPoint_i);
               }
            }
            else
            {
               //?? ????? ?? ??? ??? ????
               if( cur_h==1 )
               {
                  draw_up=1;
                  draw_dn=0;
                  fPoint_i=sPoint_i;
                  sPoint_i=Bars-1-cb;
                  GSv_sl[cb]=h;
                  l=Low[cb];
                  for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                  {
                     GSv_sl[i]=0;
                  }
                  if( cb==0 ) FileWrite(idFile,"  24. ??? ????, ????? "+GSv_sl[cb]+" draw_up "+draw_up+" draw_dn "+draw_dn+" sPoint_i "+sPoint_i+" fPoint_i "+fPoint_i+" l "+l);
               }
               else
               {
                  if( cur_l==1 )
                  {
                     //?? ????? ?? ??? ??? ????
                     sPoint_i=Bars-1-cb;
                     GSv_sl[cb]=l;
                     h=High[cb];
                     for( i=cb+1;i<Bars-1-fPoint_i;i++ )
                     {
                        GSv_sl[i]=0;
                     }
                     if( cb==0 ) FileWrite(idFile,"  25. ??? ????, ????? "+GSv_sl[cb]+" sPoint_i "+sPoint_i+" h "+h);
                  }
               }
            }
         }
         else
         {
            //??? ?? ??? ?????? ?? ??? (???? Up ??? ? ??? GSv_range)
            if( cb==0 ) FileWrite(idFile,"  26. ???? ? ???");
            //?? ????? ??? ????
            if( cur_l==1 )
            {
               sPoint_i=Bars-1-cb;
               GSv_sl[cb]=l;
               for( i=cb+1;i<Bars-1-fPoint_i;i++ )
               {
                  GSv_sl[i]=0;
               }
               h=High[cb];
               if( cb==0 ) FileWrite(idFile,"  27. ????? ??? ????, ????? "+GSv_sl[cb]+" sPoint_i "+sPoint_i+" h "+h);
            }
         }
      }
      if( lb!=Bars-1-cb ) lb=Bars-1-cb;
   }

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

//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   FileClose(idFile);
//----
   return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
// ???? ????? ??????? ?????                        |
//+------------------------------------------------------------------+
void myInit()
  {
//----
   int cb;
   fPoint_i=0;
   h=High[Bars-1];
   l=Low[Bars-1];
   for( cb=Bars-2;cb>=0;cb--)
   {
      if( High[cb]>High[cb+1] || Low[cb]<Low[cb+1] )
      {
         if( High[cb]>h && High[cb]>High[cb+1] )
         {
            s_up++;
         }
         if( Low[cb]<l && Low[cb]<Low[cb+1] )
         {
            s_dn++;
         }
      }
      else
      {
         continue;
      }
      if( s_up==s_dn && s_up==GSv_range )
      {
         h=High[cb];
         l=Low[cb];
         sPoint_i=Bars-1-cb;
         if( Close[cb]>=Open[cb] )
         {
            s_dn=0;
            GSv_sl[Bars-1]=Low[Bars-1];
            GSv_sl[cb]=High[cb];
            draw_up=1;
            break;
         }
         else
         {
            s_up=0;
            GSv_sl[Bars-1]=High[Bars-1];
            GSv_sl[cb]=Low[cb];
            draw_dn=1;
            break;
         }
      }
      else
      {
         h=High[cb];
         l=Low[cb];
         sPoint_i=Bars-1-cb;
         if( s_up==GSv_range )
         {
            s_dn=0;
            GSv_sl[Bars-1]=Low[Bars-1];
            GSv_sl[cb]=High[cb];
            draw_up=1;
            break;
         }
         else
         {
            if( s_dn==GSv_range )
            {
               s_up=0;
               GSv_sl[Bars-1]=High[Bars-1];
               GSv_sl[cb]=Low[cb];
               draw_dn=1;
               break;
            }
         }
      }
   }
   initfl=1;
   drawf=sPoint_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 

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