Epsilon





//+------------------------------------------------------------------+
//|                                                      Epsilon.mq4 |
//|              Copyright © 2008, Commercial Credit & Commerce Inc. |
//|                                        http://www.creditbanc.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Commercial Credit & Commerce Inc."
#property link      "http://www.creditbanc.net"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 White
#property indicator_color2 Red
#property indicator_color3 Red

//---- input parameters
extern string    Start_Time = "00:00";//Time to adjust moving average (1time per day)
extern int       Ema_Period=10;// Length of moving average in days
extern double    Cycle1_Var=1;// percent above and below moving average

//---- internal Global Variables
double ema;
double cycle1_high;
double cycle1_low;

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

int pos, i;

//+------------------------------------------------------------------+
//| 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);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int counted_bars=IndicatorCounted();
   if (Bars <= Ema_Period) return(0);
   if (counted_bars < 0) return (-1);
   if (counted_bars > 0) counted_bars--;
   pos = Bars - counted_bars - Ema_Period;
//----
   for (i=pos; i>=0; i--)
     {       
      if(TimeToStr(iTime(NULL,0,i), TIME_MINUTES) == Start_Time) // only perform ema calculation at 00:01
       {
        Sleep(60000);
        ema = iMA(NULL, 0, Ema_Period, 0, MODE_EMA, PRICE_CLOSE, i); // calculate 10 day ema      
        cycle1_high = (ema + (ema * (Cycle1_Var / 100))); //Add percent to ema
        cycle1_low =(ema - (ema * (Cycle1_Var / 100))); // subtract percent from ema
       }
      ExtMapBuffer1[i] = ema;      // draw ema
      ExtMapBuffer2[i] = cycle1_high; // draw cycle1 high (ema + percent)
      ExtMapBuffer3[i] = cycle1_low; // draw cycle1 low (ema - percent)    
      
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE


Indicators Used:

Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: