Accrete-MFBtm_DZRSI





/*+~><>~~~~~~~~~~~~~~~~~~~~~~><>~~~~~~~~~~~~~~~~~~~~~~><>~~~~~~~~~~~~~~~~~~~~~~+
  |                                                                            |
  |                                    Copyright © 2006, Accrete LLC           |
  |                                          http://www.accrete.com            |
  | For further information on the Accrete - MultipleFiboBands Trading Model", |
  | visit the web at www.accrete.com/fx-atm . There you will find various      |
  | links, trade examples, and the latest updates on the model by Accrete      |                                   
  +~><>~~~~~~~~~~~~~~~~~~~~~~><>~~~~~~~~~~~~~~~~~~~~~~><>~~~~~~~~~~~~~~~~~~~~~~+
*/
// property copyright "Original Dynamic Zone RSI Copyright © 2005, Pavel Kulko polk@alba.dp.ua"
#property copyright "Accrete LLC"
#property link      "www.accrete.com"
#property indicator_buffers 7
#property indicator_color1 Green
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Red
#property indicator_color5 Blue
#property indicator_color6 Lime
#property indicator_color7 Yellow


#property indicator_separate_window

extern int RSIPeriod = 8;
extern int SignalMA_Period=8;
extern int SignalMA_Method=0; //0=sma,1=ema,2=smma,3=lwma
extern int BandPeriod = 20;

double RSIBuf[],UpZone[],DnZone[],UpZonei[],DnZonei[],RSIBufdot[],SignalMABuf[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
    int    draw_begin;
   string short_name;
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,RSIBuf);
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,UpZone);
      
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,DnZone);
   
   SetIndexStyle(3,DRAW_LINE,2,1);
   SetIndexBuffer(3,UpZonei);
      
   SetIndexStyle(4,DRAW_LINE,2,1);
   SetIndexBuffer(4,DnZonei);
          
   SetIndexStyle(5,DRAW_ARROW, EMPTY);
   SetIndexArrow(5,115);
   SetIndexBuffer(5,RSIBufdot);
   
   SetIndexStyle(6,DRAW_LINE,2,1);
   SetIndexBuffer(6,SignalMABuf);
//----
   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;
      }
         {
      RSIBufdot[i] = iRSI(NULL,0,RSIPeriod,MODE_CLOSE,i);
      }
      UpZone[i] = MA + (1.382 * StDev(RSI,BandPeriod));
      DnZone[i] = MA - (1.382 * StDev(RSI,BandPeriod));
      UpZonei[i] = MA + (0.382 * StDev(RSI,BandPeriod));
      DnZonei[i] = MA - (0.382 * StDev(RSI,BandPeriod));   
   }
      for(i=limit; i>=0; i--) 
            {
            SignalMABuf[i]=iMAOnArray(RSIBuf,0,SignalMA_Period,0,SignalMA_Method,i);
//      SignalMABuf[i]=iMAOnArray(RSIBuf,0,SignalMA_Period,0,MODE_LWMA,i);
            }
//----
   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)));
}
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:



Indicator Curves created:

Implements a curve of type DRAW_LINE

Implements a curve of type DRAW_ARROW

Indicators Used:

Relative strength index
Moving average indicator


Custom Indicators Used:

Order Management characteristics:

Other Features: