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

E Archives

exoticwavein.mq4

//+------------------------------------------------------------------+
//|                  Copyright ? 2005, FX Waves  :) //+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Sprrite&Lemon"
#property link      "wladimir447@yandex.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue

//---- input parameters
int              Bar;
extern int       LastBar=0;
extern int       cnttik = 3 ;
double           ExtMapBuffer1[];

// ???????  ????  ?  ??  ?????? N-?  ??? ?????????  ???? ?????????
int tick = 0 ;
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----

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

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   string sName="",ss1=" ",ss2=" ";
   int file=0, NumBar=0, shift=0;
   int Ye=0,Mo=0,Da=0,Ho=0,Mi=0,Se=0,Ti=0;
   int    counted_bars=IndicatorCounted();

   //---- check for possible errors
   if (counted_bars<0) return(-1);

   // ???????  ????   ;
    tick++;
    if  ( tick <= cnttik  )
      {
        Print(" Tick  =  ", tick);
        Comment( tick ,"/", cnttik ," |  " , Bars);
        // ????? ????  ! -  ?????????
        return(0) ;
       }
    else
    {
       tick =  0 ;
       // ??????? ??????????? ????
       //int rfile = FileOpen("sprrite.csv",FILE_CSV|FILE_WRITE,",");
       //FileWrite(rfile,"yes");
       //FileClose(rfile);

    }

    //int  filesh = FileOpen("zag.csv",FILE_CSV|FILE_READ);
   // string sh = FileReadString(filesh);
  //  FileClose( filesh );

//----
 if ( 1 == 1)
	{
     //  ???
     if (Period()==10080) sName="monthly"+"\\"+Symbol()+Period()+".csv";
     if (Period()==43200) sName="weekly"+"\\"+Symbol()+Period()+".csv";
     if (Period()==1440) sName="daily"+"\\"+Symbol()+Period()+".csv";
     if (Period()==240) sName="4_hour"+"\\"+Symbol()+Period()+".csv";
     if (Period()==60) sName="1_hour"+"\\"+Symbol()+Period()+".csv";
     if (Period()==30) sName="half_hour"+"\\"+Symbol()+Period()+".csv";
     if (Period()==15) sName="quarter_hour"+"\\"+Symbol()+Period()+".csv";
     if (Period()==5) sName="5_min"+"\\"+Symbol()+Period()+".csv";
     if (Period()==1) sName="1_min"+"\\"+Symbol()+Period()+".csv";

     // ??????? ??????????
     FileDelete(sName);
     file =FileOpen(sName,FILE_CSV|FILE_WRITE,",");

    // FileWrite(file,sh);

    shift=Bars+LastBar-1;
     while(shift>=0)

     {
				Ti=Time[shift];
				Ye=TimeYear(Ti);
				Mo=TimeMonth(Ti);
				Da=TimeDay(Ti);

				Ho=TimeHour(Ti);
				Mi=TimeMinute(Ti);
				if ( Ho == 0 && Mi == 0  ) Mi = 1 ;
				Se=TimeSeconds(Ti);
				ss1=Ye;
				if (Mo<10) ss1=ss1+"0"+Mo; else ss1=ss1+Mo;
				if (Da<10) ss1=ss1+"0"+Da; else ss1=ss1+Da;
				if (Ho<10) ss2="0"+Ho; else ss2=Ho;
				if (Mi<10) ss2=ss2+"0"+Mi; else ss2=ss2+Mi;

       FileWrite(file,ss1,ss2,Open[shift],High[shift],Low[shift],Close[shift],Volume[shift]);
     shift--;
     }
     Comment( "  Save of "+ss1+" "+ss2+" is ok" ,  "  === " , Bars);

     NumBar=counted_bars;
     FileClose(file);
     Print(" ????????  " , Bars);
   }
//----
   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 

exoticwave.mq4

//+------------------------------------------------------------------+
//|                  Copyright ? 2005, FX Waves  :) //+------------------------------------------------------------------+
#property copyright "Copyright ? 2005, Sprrite&Lemon"
#property link      "wladimir447@yandex.ru"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue

//---- input parameters
extern int       Bar=1900;
extern int       LastBar=0;
extern int       cnttik = 3 ;
double           ExtMapBuffer1[];

// ???????  ????  ?  ??  ?????? N-?  ??? ?????????  ???? ?????????
int tick = 0 ;
int init()
  {

//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----

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

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   string sName="",ss1=" ",ss2=" ";
   int file=0, NumBar=0, shift=0;
   int Ye=0,Mo=0,Da=0,Ho=0,Mi=0,Se=0,Ti=0;
   int    counted_bars=IndicatorCounted();

   //---- check for possible errors
   if (counted_bars<0) return(-1);

   // ???????  ????   ;
    tick++;
    if  ( tick <= cnttik  )
      {
        Print(" Tick  =  ", tick);
        Comment( tick ,"/", cnttik ," |  " , Bars);
        // ????? ????  ! -  ?????????
        return(0) ;
       }
    else
    {
       tick =  0 ;
       // ??????? ??????????? ????
       //int rfile = FileOpen("sprrite.csv",FILE_CSV|FILE_WRITE,",");
       //FileWrite(rfile,"yes");
       //FileClose(rfile);

    }

    //int  filesh = FileOpen("zag.csv",FILE_CSV|FILE_READ);
   // string sh = FileReadString(filesh);
  //  FileClose( filesh );

//----
 if ( 1 == 1)
	{
     //  ???
     sName=Symbol()+Period()+".csv";

     // ??????? ??????????
     FileDelete(sName);
     file =FileOpen(sName,FILE_CSV|FILE_WRITE,",");

    // FileWrite(file,sh);

     shift=Bar+LastBar-1;
     while(shift>=0)
     {
				Ti=Time[shift];
				Ye=TimeYear(Ti);
				Mo=TimeMonth(Ti);
				Da=TimeDay(Ti);

				Ho=TimeHour(Ti);
				Mi=TimeMinute(Ti);
				if ( Ho == 0 && Mi == 0  ) Mi = 1 ;
				Se=TimeSeconds(Ti);
				ss1=Ye;
				if (Mo<10) ss1=ss1+"0"+Mo; else ss1=ss1+Mo;
				if (Da<10) ss1=ss1+"0"+Da; else ss1=ss1+Da;
				if (Ho<10) ss2="0"+Ho; else ss2=Ho;
				if (Mi<10) ss2=ss2+"0"+Mi; else ss2=ss2+Mi;

       FileWrite(file,ss1,ss2,Open[shift],High[shift],Low[shift],Close[shift],Volume[shift]);
     shift--;
     }
     Comment( "  Save of "+ss1+" "+ss2+" is ok" ,  "  === " , Bars);

     NumBar=counted_bars;
     FileClose(file);
     Print(" ????????  " , Bars);
   }
//----
   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 

EWOCCI_Indicator.mq4

//+---------------------------------------------------------+
//| T3 Trix crossing  signals.mq4
//|
//| Perky..
//+------------------------------------------------------------------+
#property  copyright "Author - Perky Aint no Porky"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_width1 3
#property indicator_color2 Red
#property indicator_width2 3

//---- input parameters
extern int smoothing=13;
extern int  timeframe=0;
extern int       A_t3_period=18;
extern int       num_bars=350;

extern int CountBars=350;
extern bool UseAlert=True;
extern bool SignalCandle=1;

//---- buffers
double val1[];
double val2[];
double CCI,CCIb4;
double EWO;
 double MA5,MA35;
int Timer;
string UD="";
double PrevPrice;
double PrevHigh  ;
double PrevLow  ;
double P  ;
double Price;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {
  // if (CountBars>=500) CountBars=500;
  // SetIndexDrawBegin(0,500-CountBars);
  // SetIndexDrawBegin(1,500-CountBars);
  int i,shift,counted_bars=IndicatorCounted();

   //---- check for possible errors
  // if(counted_bars<0) return(-1);

   //---- initial zero
  // if(counted_bars<1)
   //  {
    //  for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
    //  for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
    // }

for ( shift = CountBars; shift>=0; shift--)
{
      PrevPrice = iClose(NULL,PERIOD_D1,SignalCandle+1);
      PrevHigh  = iHigh(NULL,PERIOD_D1,SignalCandle+1);
      PrevLow   = iLow(NULL,PERIOD_D1,SignalCandle+1);
      P = (PrevHigh + PrevLow + PrevPrice)/3;
      Price = iClose(NULL,PERIOD_H1,1); //gets close of last closed candle

    CCI =iCCI(NULL,0,55,PRICE_CLOSE,SignalCandle+shift);
    CCIb4=iCCI(NULL,0,55,PRICE_CLOSE,SignalCandle+shift+1);
    //Elliot Wave
    MA5=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,SignalCandle+shift);
    MA35=iMA(NULL,0,35,0,MODE_SMA,PRICE_MEDIAN,SignalCandle+shift);
    EWO=MA5-MA35;  // yes thats it - Elliot Wave
//Comment ( "mtfstochs=",mtfstochs,"mtfstochsb4=",mtfstochsb4,"\nmtfstochs1=",mtfstochs1,"mtfstochs1b4=",mtfstochs1b4);
 	   val1[shift]=0;
		val2[shift]=0;

if(ObjectFind("P label") != 0)
      {
      ObjectCreate("P label", OBJ_TEXT, 0, Time[20], P);
      ObjectSetText("P label", "Pivot", 8, "Arial", Magenta);
      }
       if(ObjectFind("P line") != 0)
      {
      ObjectCreate("P line", OBJ_HLINE, 0, Time[40], P);
      ObjectSet("P line", OBJPROP_STYLE, STYLE_DOT);
      ObjectSet("P line", OBJPROP_COLOR, Magenta);
      }
//if ( TTb4>TT1b4 && TT<TT1 )

 if ( CCI>=0 && CCIb4<0 &&   EWO>0)

{
		val1[shift]=Low[shift]-8*Point;

	if (shift < 2 )

	{
	   UD=" UP.";
		DoAlert(UD);
	}

}
// if ( TTb4<TT1b4 && TT>TT1)
 if ( CCI<=0 && CCIb4> 0 &&  EWO<0)
{
	val2[shift]=High[shift]+8*Point;

	 if (shift < 2 )
  {
  UD=" DOWN.";
  DoAlert(UD);
  }
}

}
   //return(0);
  }

void DoAlert(string UD)
{
   if (!NewBar() || !UseAlert)
      return;
     Alert (Symbol()," ",Period(),"T3 TRIX cross ",UD);

}

  bool NewBar()
{
   static datetime dt  = 0;
   if (dt != Time[0])
   {
      dt = Time[0];
      return(true);
   }

}

//+------------------------------------------------------------------+

[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 

EWOCCI_Indicator.2.mq4

//+---------------------------------------------------------+
//| T3 Trix crossing  signals.mq4
//|
//| Perky..(Based on xxDavidxSxx's Ewocci Method)
//+------------------------------------------------------------------+
#property  copyright "Author - Perky Aint no Porky"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 LightBlue
#property indicator_width1 3
#property indicator_color2 Red
#property indicator_width2 3

//---- input parameters
extern int smoothing=13;
extern int  timeframe=0;
extern int       A_t3_period=18;
extern int       num_bars=350;

extern int CountBars=350;
extern bool UseAlert=True;
extern bool SignalCandle=1;

//---- buffers
double val1[];
double val2[];
double CCI,CCIb4;
double EWO;
 double MA5,MA34;
int Timer;
string UD="";
double PrevPrice;
double PrevHigh  ;
double PrevLow  ;
double P  ;
double Price;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   IndicatorBuffers(2);
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,108);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,108);
   SetIndexBuffer(0,val1);
   SetIndexBuffer(1,val2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| AltrTrend_Signal_v2_2                                            |
//+------------------------------------------------------------------+
int start()
  {
  // if (CountBars>=500) CountBars=500;
  // SetIndexDrawBegin(0,500-CountBars);
  // SetIndexDrawBegin(1,500-CountBars);
  int i,shift,counted_bars=IndicatorCounted();

   //---- check for possible errors
  // if(counted_bars<0) return(-1);

   //---- initial zero
  // if(counted_bars<1)
   //  {
    //  for(i=1;i<=CountBars;i++) val1[CountBars-i]=0.0;
    //  for(i=1;i<=CountBars;i++) val2[CountBars-i]=0.0;
    // }

for ( shift = CountBars; shift>=0; shift--)
{
      PrevPrice = iClose(NULL,PERIOD_D1,SignalCandle);
      PrevHigh  = iHigh(NULL,PERIOD_D1,SignalCandle);
      PrevLow   = iLow(NULL,PERIOD_D1,SignalCandle);
      P = (PrevHigh + PrevLow + PrevPrice)/3;
      Price = iClose(NULL,PERIOD_H1,1); //gets close of last closed candle

    CCI =iCCI(NULL,0,55,PRICE_CLOSE,SignalCandle+shift);
    CCIb4=iCCI(NULL,0,55,PRICE_CLOSE,SignalCandle+shift+1);
    //Elliot Wave
    MA5=iMA(NULL,0,5,0,MODE_SMA,PRICE_MEDIAN,SignalCandle+shift);
    MA34=iMA(NULL,0,34,0,MODE_SMA,PRICE_MEDIAN,SignalCandle+shift);
    EWO=MA5-MA34;  // yes thats it - Elliot Wave
//Comment ( "mtfstochs=",mtfstochs,"mtfstochsb4=",mtfstochsb4,"\nmtfstochs1=",mtfstochs1,"mtfstochs1b4=",mtfstochs1b4);
 	   val1[shift]=0;
		val2[shift]=0;

if(ObjectFind("P label") != 0)
      {
      ObjectCreate("P label", OBJ_TEXT, 0, Time[20], P);
      ObjectSetText("P label", "Pivot", 8, "Arial", Orange);
      }
       if(ObjectFind("P line") != 0)
      {
      ObjectCreate("P line", OBJ_HLINE, 0, Time[40], P);
      ObjectSet("P line", OBJPROP_STYLE, STYLE_DOT);
      ObjectSet("P line", OBJPROP_COLOR, Orange);
      }
//if ( TTb4>TT1b4 && TT<TT1 )

 if ( CCI>=0 && CCIb4<0 &&   EWO>0)

{
		val1[shift]=Low[shift]-8*Point;

	if (shift < 2 )

	{
	   UD=" UP.";
		DoAlert(UD);
	}

}
// if ( TTb4<TT1b4 && TT>TT1)
 if ( CCI<=0 && CCIb4> 0 &&  EWO<0)
{
	val2[shift]=High[shift]+8*Point;

	 if (shift < 2 )
  {
  UD=" DOWN.";
  DoAlert(UD);
  }
}

}
   //return(0);
  }

void DoAlert(string UD)
{
   if (!NewBar() || !UseAlert)
      return;
     Alert (Symbol()," ",Period()," EWOCCI cross ",UD);

}

  bool NewBar()
{
   static datetime dt  = 0;
   if (dt != Time[0])
   {
      dt = Time[0];
      return(true);
   }

}

//+------------------------------------------------------------------+

[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 

ew1.mq4

#include <stdlib.mqh>
//+------------------------------------------------------------------+
//|                                                             .mq4 |
//|                                                                  |
//|                                                                  |
//|                                        Converted by Mql2Mq4 v0.7 |
//|                                            http://yousky.free.fr |
//|                                    Copyright ? 2006, Yousky Soft |
//+------------------------------------------------------------------+

//#property copyright " CONVERT BY "ENG.AED AL NAIRAB" ."
#property link      " http://www.nairab.com/"

#property indicator_separate_window
#property indicator_color1 Blue
#property indicator_buffers 1

//+------------------------------------------------------------------+
//| Common External variables                                        |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| External variables                                               |
//+------------------------------------------------------------------+
extern double triger = 0.70;
extern double back_test = 20;

//+------------------------------------------------------------------+
//| Special Convertion Functions                                     |
//+------------------------------------------------------------------+

int LastTradeTime;
double ExtHistoBuffer[];

void SetLoopCount(int loops)
{
}

void SetIndexValue(int shift, double value)
{
  ExtHistoBuffer[shift] = value;
}

//+------------------------------------------------------------------+
//| End                                                              |
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| Initialization                                                   |
//+------------------------------------------------------------------+

int init()
{
   SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
   SetIndexBuffer(0, ExtHistoBuffer);
   SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
   return(0);
}
int start()
{
//+------------------------------------------------------------------+
//| Local variables                                                  |
//+------------------------------------------------------------------+
int shift = 0;
int i = 0;
double llv = 0;
double hhv = 0;
double taiv = 0;
double trend = 0;

/*[[
	Name := ew1
	Author := CONVERT BY "ENG.AED AL NAIRAB" .
	Link := http://www.nairab.com/
	Separate Window := yes
	First Color := Blue
	First Draw Type := Line
	First Symbol := 217
	Use Second Data := no
	Second Color := Red
	Second Draw Type := Line
	Second Symbol := 218
]]*/

SetLoopCount(0);
// loop from first bar to current bar (with shift=0)
for(shift=900;shift>=0 ;shift--){
llv=iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift);
hhv=iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift);
for(i=shift;i<=shift+back_test ;i++){
llv=MathMin(iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, i)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, i),llv);
hhv=MathMax(iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, i)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, i),hhv);
}
if( ( hhv == (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))&& trend == 0)) trend=1;
if( ( llv == (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))&& trend == 0)) trend=-1;
if( ( llv<0 && trend == -1 && (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))>-1*triger*llv)) trend=1;
if( ( hhv>0 && trend == 1 && (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))<-1*triger*hhv)) trend=-1;
	SetIndexValue(shift, trend);

}

  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 

EVWMA.mq4

//+------------------------------------------------------------------+
//|                                                            EVWMA |
//|                               Copyright ? 2004, Poul_Trade_Forum |
//|                                                         Aborigen |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Poul Trade Forum"
#property link      "http://forex.kbpauk.ru/"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 DeepPink

extern int VolumeDivisor=1;
extern int N=100;

double  ScaledVol=0, VolDiff=0;
double X[100], Y[100];
bool Violation=false;

//---- buffers
double EVWMA[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- indicator line
   SetIndexStyle(0,DRAW_LINE,EMPTY,2,DeepPink);
   SetIndexBuffer(0,EVWMA);
   SetIndexEmptyValue(0,0);
//---- name for DataWindow and indicator subwindow label
   short_name="EVWMA";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {    return(0);   }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted(),i,shift,count;

if (counted_bars==0) {EVWMA[Bars] = Close[Bars]; counted_bars=1;}

i=(Bars-counted_bars);

for (shift=i; shift>=0;shift--)
{
ScaledVol = Volume[shift]/VolumeDivisor;
 VolDiff = N - ScaledVol;
 if ( VolDiff<0 && Violation==false)  Violation = true;
 if (Violation==true)  EVWMA[shift]=EVWMA[shift+1];
 else EVWMA[shift] = (VolDiff * EVWMA[shift+1] + ScaledVol * Close[shift]) / N ;
Violation=false;

//----

}

   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 

Ergodic.mq4

//+------------------------------------------------------------------+
//| Danny Feng                                           Ergodic.mq4 |
//+------------------------------------------------------------------+

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
#property indicator_color2 Red
//---- input parameters
extern int r=2;
extern int s=5;
extern int u=8;
extern int smooth=2;

//---- buffers
double ErgBuffer[];
double ema_ErgBuffer[];
double Price_Delta1_Buffer[];
double Price_Delta2_Buffer[];
double s_ema1_Buffer[];
double s_ema2_Buffer[];
double u_ema1_Buffer[];
double u_ema2_Buffer[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
//---- additional buffers are used for counting.
   IndicatorBuffers(8);
   SetIndexBuffer(0,ema_ErgBuffer);
   SetIndexBuffer(1,ErgBuffer);
   SetIndexBuffer(2,Price_Delta1_Buffer);
   SetIndexBuffer(3,Price_Delta2_Buffer);
   SetIndexBuffer(4,s_ema1_Buffer);
   SetIndexBuffer(5,s_ema2_Buffer);
   SetIndexBuffer(6,u_ema1_Buffer);
   SetIndexBuffer(7,u_ema2_Buffer);

//---- indicator lines
   SetIndexStyle(0,DRAW_HISTOGRAM);
   SetIndexStyle(1,DRAW_HISTOGRAM);
//---- name for DataWindow and indicator subwindow label
   short_name="Ergodic";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,r+s+u+smooth);
   SetIndexDrawBegin(1,r+s+u+smooth);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| True Strength Index                                          |
//+------------------------------------------------------------------+
int start() {
   int i,limit;
   double mean1, mean2;

   int counted_bars=IndicatorCounted();
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;

   for(i=0; i<limit; i++) {
      //Price_Delta1_Buffer[i] = Close[i] - Close[i+r];
      //Price_Delta2_Buffer[i] = MathAbs(Close[i] - Close[i+r]);
      mean1 = (Close[i] + High[i] + Low[i]) /3;
      mean2 = (Close[i+r] + High[i+r] + Low[i+r]) /3;
      Price_Delta1_Buffer[i] = mean1 - mean2;
      Price_Delta2_Buffer[i] = MathAbs(mean1 - mean2);
   }

   for(i=0; i<limit; i++) {
      s_ema1_Buffer[i]=iMAOnArray(Price_Delta1_Buffer,Bars,s,0,MODE_EMA,i);
      s_ema2_Buffer[i]=iMAOnArray(Price_Delta2_Buffer,Bars,s,0,MODE_EMA,i);
   }

   for(i=0; i<limit; i++) {
      u_ema1_Buffer[i]=iMAOnArray(s_ema1_Buffer,Bars,u,0,MODE_EMA,i);
      u_ema2_Buffer[i]=iMAOnArray(s_ema2_Buffer,Bars,u,0,MODE_EMA,i);
   }

   for(i=0; i<limit; i++) {
      ErgBuffer[i] = 100 * u_ema1_Buffer[i] / u_ema2_Buffer[i] ;
   }

   for(i=0; i<limit; i++) {
      ema_ErgBuffer[i] = iMAOnArray(ErgBuffer,Bars,smooth,0,MODE_EMA,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 

Ergodic Signals.mq4

//+------------------------------------------------------------------+
//|                                                  TSI Signals.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
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 MediumBlue
//---- input parameters
extern int       First_R=8;
extern int       Second_S=5;
extern int       SignalPeriod=5;
extern int       Mode_Smooth=1;
extern int       ArrowShift=5;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,217);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexLabel(0,"UpArrow");
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,218);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexLabel(1,"DownArrow");
   SetIndexEmptyValue(1,0.0);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit,i;
   double curErgodic=0.0,prevErgodic=0.0,curSignal=0.0,prevSignal=0.0;
   limit=Bars-counted_bars-First_R-Second_S-SignalPeriod;
   for (i=limit;i>=0;i--)
      {
      curErgodic=iCustom(NULL,0,"Ergodic Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,0,i);
      prevErgodic=iCustom(NULL,0,"Ergodic Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,0,i+1);
      curSignal=iCustom(NULL,0,"Ergodic Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,1,i);
      prevSignal=iCustom(NULL,0,"Ergodic Oscillator",First_R,Second_S,SignalPeriod,Mode_Smooth,1,i+1);
      if ((curErgodic>curSignal)&&(prevErgodic<prevSignal)) ExtMapBuffer1[i]=Close[i]+3*ArrowShift*Point;
      if ((curErgodic<curSignal)&&(prevErgodic>prevSignal)) ExtMapBuffer2[i]=Close[i]-ArrowShift*Point;
      }
//---- TODO: add your code here

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

Ergodic Oscillator.mq4

  //+------------------------------------------------------------------+
//|                                                          TSI.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_separate_window
#property indicator_buffers 2
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_level1 0
#property indicator_level2 20
#property indicator_level3 -20
//---- input parameters
extern int       First_R=8;
extern int       Second_S=5;
extern int       SignalPeriod=5;
extern int       Mode_Smooth=1;
//---- buffers
double ErgodicBuffer[];
double Signal_Buffer[];
double TSI_Siganl_Buffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorBuffers(3);

   SetIndexBuffer(2, TSI_Siganl_Buffer);

   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ErgodicBuffer);
   SetIndexLabel(0,"Ergodic");
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,Signal_Buffer);
   SetIndexLabel(1,"Signal");
   IndicatorShortName("Ergodic Osc"+"("+First_R+","+Second_S+","+SignalPeriod+")");

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

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int limit,i;
   limit=Bars-counted_bars-1;
   for (i=limit;i>=0;i--)
      {
      TSI_Siganl_Buffer[i]=iCustom(NULL,0,"TSI-Osc",First_R,Second_S,SignalPeriod,Mode_Smooth,1,i);
      }

   for (i=limit;i>=0;i--)
      {
      ErgodicBuffer[i]=iMAOnArray(TSI_Siganl_Buffer,0,5,0,MODE_EMA,i);
      }

   for (i=limit;i>=0;i--)
      {
      Signal_Buffer[i]=iMAOnArray(ErgodicBuffer,0,5,0,MODE_EMA,i);
      }

//---- TODO: add your code here

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

EMAPredictive2.mq4

//+------------------------------------------------------------------+
//|                                               EMAPredictive3.mq4 |
//|                                      Matthew ("Dr Chaos") Kennel |
//|                            ftp://lyapunov.ucsd.edu/pub/nonlinear |
//+------------------------------------------------------------------+
//
// Goal of this indicator:
//
//    Given three EMA's of varying lengths, use their values
//    for a estimator of "where we are now" or will be in the near future.
//    This is a very simplistic method, better ones are probably found
//    in the signal processing and target tracking literature.
//    A Kalman filter has been known since the 1950's 1960's and there
//    is better still.   Nevertheless this is easily programmable in the
//    typical environments of a retail trading application like Metatrader4.
//
// Method:
//
//     An an exponential moving average (EMA) or a simple moving average (SMA), for that
//     matter, have a bandwidth parameter 'L', the effective length of the window.  This
//     is in units of time or, really, inverse of frequency.  Higher L means a lower
//     frequency effect.
//
//     With a parameter L, the weighted time index of the EMA and SMA is (L-1)/2.  Example:
//     take an SMA of the previous 5 values:  -5 -4 -3 -2 -1 now.   The average "amount of time"
//     back in the past of the data which go in to the SMA is hence -3, or (L-1)/2.  Same applies
//     for an EMA.  The standard parameterization makes this correspondence between EMA
//     and SMA.
//
//     Therefore the idea here is to take two different EMA's, a longer, and
//     a shorter of lengths L1 and L2  (L2 <L1).     Now take the pairs:
//           [ -(L1-1)/2, EMA(L1) ]  [ -(L2-1)/2, EMA(L2) ]  which defines a line.
//
//
//     Extrapolate to [ExtraTimeForward, y], solve for y and that is the predictive EMA estimate.
//
// Application:
//     Traditional moving averages, as simple-minded linear filters, have significant group delay.
//     In engineering that isn't so important as nobody cares if your sound from your iPod is delayed
//     a few milliseconds after it is first processed.  But in markets, you can't
//     trade on the smoothed price, only the actual noisy, market price now.   Hence you
//     ought to estimate better.
//
//     This statistic (what math/science people call what technical analysts call an 'indicator')
//     may be useful as the "fast" moving average in a moving average crossover trading system.
//     It could also be useful for the slow moving average as well.
//
//     For instance, on a 5 minute chart:
//
//       try for the fast: (will be very wiggly, note)
//
//                           LongPeriod 25.0
//                           ShortPeriod 8.0
//                           ExtraTimeForward 1.0
//
//       and for the slow:
//
//                           LongPeriod 500.0
//                           ShortPeriod 50.0 to 200.0
//                           ExtraTimeForward 0.0
//
//  But often a regular MA for the slow can work as well or better, it appears from visual inspection.
//
//  Enjoy.
//
//  In chaos there is order, and in that order there is chaos and order inside again.
//
//  Then, surrounding everything, pointy haired bosses.
//
#property copyright "Matthew (Dr Chaos) Kennel"
#property link      "ftp://lyapunov.ucsd.edu/pub/nonlinear" // my academic software site.  No finance.

#property indicator_chart_window
#property indicator_buffers 1

#property indicator_color1 Red
//---- input parameters
extern double       LongPeriod=25.0;  // note that for an EMA you can have floating point numbers.
extern double       ShortPeriod=8.0;
extern double       ExtraTimeForward=1.0; // how much to further extrapolate location.

//---- buffers
//---- indicator buffers
double ExtBuffer[];

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

   SetIndexBuffer(0,ExtBuffer);
 //---- drawing settings
   SetIndexStyle(0,DRAW_LINE);
//---- initialization done
   return(0);
  }

int start()
  {
   int limit;
   int counted_bars=IndicatorCounted();
   double ma1,ma3;
   double p1,p3;
   double t1,t3,t;

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

//---- main loop
   p1 = 2.0/(LongPeriod+1.0);
   p3 = 2.0/(ShortPeriod+1.0);

   t1 = (LongPeriod-1.0)/2.0;
   t3 = (ShortPeriod-1.0)/2.0;
   t = ShortPeriod + ExtraTimeForward;

   ma1 = Close[limit-1];
   ma3 = ma1;
   for(int i=limit-1; i>= 0; i--) {
      //---- ma_shift set to 0 because SetIndexShift called abowe
      double val = Close[i];
      double slope1, predict;

      ma1 = p1*val + (1.0-p1)*ma1;
      ma3 = p3*val + (1.0-p3)*ma3;

      slope1 = (ma3-ma1)/(t1-t3);

      predict = ma3 + slope1*t;

      ExtBuffer[i]=predict;
  }
//---- 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 

 Page 1 of 3  1  2  3 »

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