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

D Archives

Dynamo Stochastic.mq4

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

#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 1
#property indicator_color1 LightSeaGreen
#property  indicator_level1  75
#property indicator_level2  25

//#property indicator_color2 Red
//---- input parameters
extern int KPeriod=5;
extern int DPeriod=3;
extern int Slowing=3;
//---- buffers
double ind_buffer1[];
double MainBuffer[];
double SignalBuffer[];
double HighesBuffer[];
double LowesBuffer[];
//----
int draw_begin1=0;
int draw_begin2=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- 2 additional buffers are used for counting.
   IndicatorBuffers(5);
   SetIndexBuffer(1, MainBuffer);
   SetIndexBuffer(2, SignalBuffer);
   SetIndexBuffer(3, HighesBuffer);
   SetIndexBuffer(4, LowesBuffer);
//---- indicator lines
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0, ind_buffer1);
//---- name for DataWindow and indicator subwindow label
   short_name="Dynamo Sto("+KPeriod+","+DPeriod+","+Slowing+")";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   draw_begin1=KPeriod+Slowing;
   draw_begin2=draw_begin1+DPeriod;
   SetIndexDrawBegin(0,draw_begin1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Stochastic oscillator                                            |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k;
   int    counted_bars=IndicatorCounted();
   double price;
//----
   if(Bars<=draw_begin2) return(0);
//---- initial zero
   if(counted_bars<1)
     {
      for(i=1;i<=draw_begin1;i++) MainBuffer[Bars-i]=0;
      for(i=1;i<=draw_begin2;i++) SignalBuffer[Bars-i]=0;
     }
//---- minimums counting
   i=Bars-KPeriod;
   if(counted_bars>KPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double min=1000000;
      k=i+KPeriod-1;
      while(k>=i)
        {
         price=Low[k];
         if(min>price) min=price;
         k--;
        }
      LowesBuffer[i]=min;
      i--;
     }
//---- maximums counting
   i=Bars-KPeriod;
   if(counted_bars>KPeriod) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double max=-1000000;
      k=i+KPeriod-1;
      while(k>=i)
        {
         price=High[k];
         if(max<price) max=price;
         k--;
        }
      HighesBuffer[i]=max;
      i--;
     }
//---- %K line
   i=Bars-draw_begin1;
   if(counted_bars>draw_begin1) i=Bars-counted_bars-1;
   while(i>=0)
     {
      double sumlow=0.0;
      double sumhigh=0.0;
      for(k=(i+Slowing-1);k>=i;k--)
        {
         sumlow+=Close[k]-LowesBuffer[k];
         sumhigh+=HighesBuffer[k]-LowesBuffer[k];
        }
      if(sumhigh==0.0) MainBuffer[i]=100.0;
      else MainBuffer[i]=sumlow/sumhigh*100;
      i--;
     }
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   int limit=Bars-counted_bars;
//---- signal line is simple movimg average
   for(i=0; i<limit; i++)
      SignalBuffer[i]=iMAOnArray(MainBuffer,Bars,DPeriod,0,MODE_SMA,i);
//---- Dynamo of %K
   for(i=0; i<limit; i++)
      ind_buffer1[i]=50-SignalBuffer[i]+MainBuffer[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 

DynamicRS.mq4

/*

Original Formula

WH:=HHV(HIGH,5);
WL:=LLV(LOW,5);
WBP:=(HHV(HIGH,5)+LLV(LOW,5)+CLOSE)/3;

RBAND:=VALUEWHEN(1,CROSS(MOV(WBP,25,S),WBP),
HHV(WH,25));

SBAND:=VALUEWHEN(1,CROSS(WBP,MOV(WBP,25,S)),
LLV(WL,25));

MSWNG:=(RBAND+SBAND)/2;

*/

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Green
#property indicator_color3 Gray

//---- input parameters
extern int ShortPeriod=5;
extern int LongPeriod=25;

//---- buffers  WHH=HHV(WH,25);WLL=LLV(WL,25);WBP_MA=MOV(WBP,25,S)
double S[];
double R[];
double MS[];
double WBP[],WBP_MA[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- 3 additional buffers are used for counting.
   IndicatorBuffers(5);
//---- name for DataWindow and indicator subwindow label

   SetIndexBuffer(3, WBP);

   SetIndexBuffer(4, WBP_MA);

//----
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,2);
   SetIndexBuffer(0, R);
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,2);SetIndexBuffer(1, S);
   SetIndexStyle(2,DRAW_LINE,STYLE_DASHDOT,2);SetIndexBuffer(2, MS);
   short_name="Dynamic Support/Resistance";
   IndicatorShortName(short_name);
   SetIndexLabel(0,"Dynamic Resistance");
   SetIndexLabel(1,"Dynamic Support");
   SetIndexLabel(2,"MeanSwing");
   SetIndexDrawBegin(0,LongPeriod);
 SetIndexDrawBegin(1,LongPeriod);
  SetIndexDrawBegin(2,LongPeriod);

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Dynamic Support/Resistance                                        |
//+------------------------------------------------------------------+
int start()
  {
   int    i,k,counted_bars=IndicatorCounted();

   if(Bars<=LongPeriod) return(0);
//---- initial zero

//---- last counted bar will be recounted
   int limit=Bars-counted_bars;
   if(counted_bars>0) limit++; else { i=limit;
            {R[i]=High[i];S[i]=Low[i];}
          }

//---- WH,WL,WBP calculation

   for(i=0; i<limit; i++)
      WBP[i] = (High[Highest(NULL,0,MODE_HIGH,ShortPeriod,i)] + Low[Lowest(NULL,0,MODE_LOW,ShortPeriod,i)] + Close[i])/3;

//---- WBP MA calculation
for(i=0; i<limit; i++)
WBP_MA[i]=iMAOnArray(WBP,Bars,LongPeriod,0,MODE_SMA,i);

//---- Drawing Lines
for(i=limit-1; i>=0; i--)
  if (WBP[i+1]>WBP_MA[i+1] && WBP[i]<WBP_MA[i])
      R[i]=High[Highest(NULL,0,MODE_HIGH,ShortPeriod+LongPeriod,i)];
        else R[i]=R[i+1];
for(i=limit-1; i>=0; i--)
   if (WBP[i+1]<WBP_MA[i+1] && WBP[i]>WBP_MA[i])
      S[i]=Low[Lowest(NULL,0,MODE_LOW,ShortPeriod+LongPeriod,i)];
        else S[i]=S[i+1];
   for(i=0; i<limit; i++)
      MS[i]=(R[i]+S[i])/2;
/**/
   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 

Dynamic Zone RSI2.mq4

//+------------------------------------------------------------------+
//|                                             Dynamic Zone RSI.mq4 |
//|                                   Copyright ? 2005, Pavel Kulko. |
//|                                                  polk@alba.dp.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 SlateBlue
#property indicator_color3 Orange

#property indicator_separate_window

extern int RSIPeriod = 14;
extern int BandPeriod = 20;

double RSIBuf[],UpZone[],DnZone[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(0,RSIBuf);
   SetIndexBuffer(1,UpZone);
   SetIndexBuffer(2,DnZone);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double MA, RSI[];
   ArrayResize(RSI,BandPeriod);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iRSI(NULL,0,RSIPeriod,PRICE_WEIGHTED,i);
      MA = 0;
      for(int j=i; j<i+BandPeriod; j++) {
         RSI[j-i] = RSIBuf[j];
         MA += RSIBuf[j]/BandPeriod;
      }
      UpZone[i] = MA + (1.3185 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.3185 * StDev(RSI,BandPeriod));
   }

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

double StDev(double& Data[], int Per)
{
  return(MathSqrt(Variance(Data,Per)));
}

double Variance(double& Data[], int Per)
{
  double sum, ssum;
  for (int i=0; i<Per; i++)
  {
    sum += Data[i];
    ssum += MathPow(Data[i],2);
  }
  return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+

[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 

Dynamic Zone RSI1(02SEP05).mq4

//+------------------------------------------------------------------+
//|                                             Dynamic Zone RSI.mq4 |
//|                                   Copyright ? 2005, Pavel Kulko. |
//|                                                  polk@alba.dp.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 SlateBlue
#property indicator_color3 Orange

#property indicator_separate_window

extern int RSIPeriod = 5;
extern int BandPeriod = 30;

double RSIBuf[],UpZone[],DnZone[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(0,RSIBuf);
   SetIndexBuffer(1,UpZone);
   SetIndexBuffer(2,DnZone);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double MA, RSI[];
   ArrayResize(RSI,BandPeriod);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      MA = 0;
      for(int j=i; j<i+BandPeriod; j++) {
         RSI[j-i] = RSIBuf[j];
         MA += RSIBuf[j]/BandPeriod;
      }
      UpZone[i] = MA + (1.3185 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.3185 * StDev(RSI,BandPeriod));
   }

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

double StDev(double& Data[], int Per)
{
  return(MathSqrt(Variance(Data,Per)));
}

double Variance(double& Data[], int Per)
{
  double sum, ssum;
  for (int i=0; i<Per; i++)
  {
    sum += Data[i];
    ssum += MathPow(Data[i],2);
  }
  return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+

[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 

Dynamic Zone RSI.mq4

//+------------------------------------------------------------------+
//|                                             Dynamic Zone RSI.mq4 |
//|                                   Copyright ? 2005, Pavel Kulko. |
//|                                                  polk@alba.dp.ua |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Pavel Kulko"
#property link      "polk@alba.dp.ua"
#property indicator_buffers 3
#property indicator_color1 Lime
#property indicator_color2 SlateBlue
#property indicator_color3 Orange

#property indicator_separate_window

extern int RSIPeriod = 5;
extern int BandPeriod = 30;

double RSIBuf[],UpZone[],DnZone[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(0,RSIBuf);
   SetIndexBuffer(1,UpZone);
   SetIndexBuffer(2,DnZone);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   double MA, RSI[];
   ArrayResize(RSI,BandPeriod);
   int counted_bars=IndicatorCounted();
   int limit = Bars-counted_bars-1;
   for(int i=limit; i>=0; i--)
   {
      RSIBuf[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      MA = 0;
      for(int j=i; j<i+BandPeriod; j++) {
         RSI[j-i] = RSIBuf[j];
         MA += RSIBuf[j]/BandPeriod;
      }
      UpZone[i] = MA + (1.3185 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.3185 * StDev(RSI,BandPeriod));
   }

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

double StDev(double& Data[], int Per)
{
  return(MathSqrt(Variance(Data,Per)));
}

double Variance(double& Data[], int Per)
{
  double sum, ssum;
  for (int i=0; i<Per; i++)
  {
    sum += Data[i];
    ssum += MathPow(Data[i],2);
  }
  return((ssum*Per - sum*sum)/(Per*(Per-1)));
}
//+------------------------------------------------------------------+

[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 

DT-ZigZag.mq4

//+------------------------------------------------------------------+
//|                                                    DT-ZigZag.mq4 |
//+------------------------------------------------------------------+
#property copyright "klot"
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Yellow
//---- input parameters
extern int GrossPeriod=60;
extern int ExtDepth=12;
extern int ExtDeviation=5;
extern int ExtBackstep=3;
//---- buffers
double ExtMapBuffer1[];
datetime daytimes[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
//----
   if (Period()>GrossPeriod) { Alert("DT-ZigZag: ???? ????? ??? ?? ??? ?? ", GrossPeriod); return(0); }
   // ?? Time[] ??? ???? ??????? ? ?????? ?????
   ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    limit, bigshift;
   int    counted_bars=IndicatorCounted();
//----
   if (counted_bars<0) return(-1);

   if (counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

   for (int i=0; i<limit; i++)
   {
   if(Time[i]>=daytimes[0]) bigshift=0;
   else
     {
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND);
      if(Period()<=GrossPeriod) bigshift++;
     }
  ExtMapBuffer1[i]=iCustom(NULL,GrossPeriod,"ZigZag",ExtDepth,ExtDeviation,ExtBackstep,0,bigshift);
   }
//----
   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 

DT-ZigZag-Lauer.mq4

//+------------------------------------------------------------------+
//|                                              DT-ZigZag-Lauer.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, klot"
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int       depth=5;
extern int GrossPeriod=240;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
datetime daytimes[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
//----
   if (Period()>GrossPeriod) { Alert("DT-ZigZag: ???? ????? ??? ?? ??? ?? ", GrossPeriod); return(0); }
   // ?? Time[] ??? ???? ??????? ? ?????? ?????
   ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int    limit=300,bigshift;
   double zigzag1;
   if (counted_bars<0) return(-1);

   if (counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;
//----
   for (int i=0; i<limit; i++)
   {
   if(Time[i]>=daytimes[0]) bigshift=0;
   else
     {
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND);
      if(Period()<=GrossPeriod) bigshift++;
     }
      for (int cnt=bigshift; cnt<(100+bigshift); cnt++)
      {
         zigzag1=iCustom(NULL,GrossPeriod,"ZigZag",depth,5,3,0,cnt+1);
         if ( zigzag1!=0 ) break;
      }

   if (  iClose(NULL,0,i+1)<=zigzag1 )  ExtMapBuffer2[i]=zigzag1; else ExtMapBuffer2[i]=0.0;
   if (  iClose(NULL,0,i+1)>=zigzag1  )  ExtMapBuffer1[i]=zigzag1; else ExtMapBuffer1[i]=0.0;
   ObjectsRedraw();
   }
 // Comment("zigzag1 = ",zigzag1);
//----
   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 

DT-RSI-Sig.mq4

//+------------------------------------------------------------------+
//|                                                   DT-RSI-Sig.mq4 |
//+------------------------------------------------------------------+
#property copyright "klot"
#property link      "klot@mail.ru"

#property indicator_separate_window
#property indicator_minimum 20
#property indicator_maximum 80
#property indicator_buffers 5
#property indicator_color1 Aqua
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Blue
//---- input parameters
extern int       PeriodRSI=14;
//---- 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_ARROW);
   SetIndexArrow(1,242);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexArrow(2,241);
   SetIndexBuffer(2,ExtMapBuffer3);
   SetIndexEmptyValue(2,0.0);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexArrow(3,159);
   SetIndexBuffer(3,ExtMapBuffer4);
   SetIndexEmptyValue(3,0.0);
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexArrow(4,159);
   SetIndexBuffer(4,ExtMapBuffer5);
   SetIndexEmptyValue(4,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
      ObjectsDeleteAll(1, OBJ_TREND);
   	ObjectsRedraw();
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    k,limit,pos1,pos2,pos3,pos4;
   int    counted_bars=IndicatorCounted();
   double rsi1,rsi2,rsi3,vol1,vol2,vol3,vol4;
//----
if (counted_bars<0) return(-1);

   if (counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

   for (int i=0; i<limit; i++)
      {
         ExtMapBuffer1[i]=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,i);

         rsi1=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,i+1);
         rsi2=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,i+2);
         rsi3=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,i+3);

         if  (rsi1<rsi2 && rsi2>rsi3) ExtMapBuffer5[i+2]=rsi2; //????. RSI ?????? ??
         if  (rsi1>rsi2 && rsi2<rsi3) ExtMapBuffer4[i+2]=rsi2; //????. RSI ?????? ???
      }
      //------ ??? ???? ------
   k=0;
   for (i=0; i<500; i++)
      {
         if (ExtMapBuffer5[i]>40 && k==0) { vol1=ExtMapBuffer5[i]; pos1=i; k++;}
         if (ExtMapBuffer5[i]>60 && ExtMapBuffer5[i]>vol1 && k!=0) { vol2=ExtMapBuffer5[i]; pos2=i; k++;}
         if (k>1) break;
      }
   // ?? ?? ???? ?? 40, ? ??? ??? ? ???, ?.?. ???? ?? ?????? ??? ?????
   for (i=0; i<pos2; i++)
   {
   if ( ExtMapBuffer4[i]!=0 && ExtMapBuffer4[i]<40) {vol1=0; vol2=0;}
   }
      //----- ??? ???? ------
    k=0;
   for (i=0; i<500; i++)
      {
         if (ExtMapBuffer4[i]<60 && ExtMapBuffer4[i]!=0 && k==0) { vol3=ExtMapBuffer4[i]; pos3=i; k++;}
         if (ExtMapBuffer4[i]!=0 && ExtMapBuffer4[i]<40 && ExtMapBuffer4[i]<vol3 && k!=0) { vol4=ExtMapBuffer4[i]; pos4=i; k++;}
         if (k>1) break;
      }
   // ?? ?? ???? ??? 60, ??? ??? ??? ? ???, ?.?. ???? ?? ?????? ??? ?????
   for (i=0; i<pos4; i++)
   {
   if ( ExtMapBuffer5[i]!=0 && ExtMapBuffer5[i]>60) {vol3=0; vol4=0;}
   }

    // ---- ???? ?? ??? Buy ? Sell
         rsi1=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,1);
         rsi2=iRSI(NULL,0,PeriodRSI,PRICE_CLOSE,2);

      //------------
      double volDW,volDW1,volDW2,volUP,volUP1,volUP2;
      if (vol3!=0 && vol4!=0)
      {
      volDW=vol3+((pos3)*(vol3-vol4)/(pos4-pos3));
      volDW1=vol3+((pos3-1)*(vol3-vol4)/(pos4-pos3));
      volDW2=vol3+((pos3-2)*(vol3-vol4)/(pos4-pos3));
      }
      if (volDW!=0 && rsi2>50 && rsi1<volDW1 && rsi2>volDW2 ) ExtMapBuffer2[0]=volDW; // ??? Sell
      //------------
      //------------
      if (vol1!=0 && vol2!=0)
		{
		volUP=vol1+(pos1*(vol1-vol2)/(pos2-pos1));
		volUP1=vol1+((pos1-1)*(vol1-vol2)/(pos2-pos1));
		volUP2=vol1+((pos1-2)*(vol1-vol2)/(pos2-pos1));
		}
		if (volUP!=0 && rsi2<50 && rsi2>40 && rsi1>volUP1 && rsi2<volUP2 ) ExtMapBuffer3[0]=volUP; // ??? Buy
		//------------
	/*
    Comment(" vol1 = ",vol1, "  pos1 = ",pos1,"\n",
           " vol2 = ",vol2, "  pos2 = ",pos2,"\n",
           " vol3 = ",vol3, "  pos3 = ",pos3,"\n",
           " vol4 = ",vol4, "  pos4 = ",pos4,"\n",
           "   VOLDW = ", volDW,"\n",
           "   VOLUP = ", volUP, "\n") ;
    */
      ObjectsDeleteAll(1, OBJ_TREND);
      ObjectsRedraw();
      if (vol3!=0 && vol4!=0 )
      {
      ObjectCreate("Sell",OBJ_TREND,1,Time[pos4],vol4,Time[pos3],vol3);
		ObjectSet("Sell",OBJPROP_COLOR,Red);
		ObjectSet("Sell",OBJPROP_WIDTH,2);
		ObjectSet("Sell",OBJPROP_STYLE,STYLE_SOLID);
		}
		if (vol1!=0 && vol2!=0 )
		{
		ObjectCreate("Buy",OBJ_TREND,1,Time[pos2],vol2,Time[pos1],vol1);
		ObjectSet("Buy",OBJPROP_COLOR,Blue);
		ObjectSet("Buy",OBJPROP_WIDTH,2);
		ObjectSet("Buy",OBJPROP_STYLE,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 

DT-RFTL.mq4

//+------------------------------------------------------------------+
//|                                                       DT-FATL.mq4 |
//+------------------------------------------------------------------+
#property copyright "klot"
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Magenta

extern int GrossPeriod=240; // ???? ??? ? ????

datetime daytimes[];
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   if (Period()>GrossPeriod) { Alert("DT-RSTL: ???? ????? ??? ?? ??? ?? ", GrossPeriod); return(0); }
//----

// ?? Time[] ??? ???? ??????? ? ?????? ?????
ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod);

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

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    limit, bigshift;
   int    counted_bars=IndicatorCounted();
//----
   if (counted_bars<0) return(-1);

   if (counted_bars>0) counted_bars--;

   limit=Bars-counted_bars;

   for (int i=0; i<limit; i++)
   {
   if(Time[i]>=daytimes[0]) bigshift=0;
   else
     {
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND);
      if(Period()<=GrossPeriod) bigshift++;
     }
  ExtMapBuffer1[i]=iCustom(NULL,GrossPeriod,"RFTL",0,bigshift);
   }
//----
   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 

DPO.mq4

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

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue

extern int x_prd=14;
extern int CountBars=300;
//---- buffers
double dpo[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,dpo);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| DPO                                                              |
//+------------------------------------------------------------------+
int start()
  {
   if (CountBars>=Bars) CountBars=Bars;
   SetIndexDrawBegin(0,Bars-CountBars+x_prd+1);
   int i,counted_bars=IndicatorCounted();
   double t_prd;
//----
   if(Bars<=x_prd) return(0);
//---- initial zero
   if(counted_bars<x_prd)
   {
      for(i=1;i<=x_prd;i++) dpo[CountBars-i]=0.0;
   }
//----
   i=CountBars-x_prd-1;
   t_prd=x_prd/2+1;

   while(i>=0)
     {
     dpo[i]=Close[i]-iMA(NULL,0,x_prd,t_prd,MODE_SMA,PRICE_CLOSE,i);

      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 

 Page 1 of 5  1  2  3  4  5 »

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