RPoint-m_v2





//+------------------------------------------------------------------+
//|                                                    RPoint v2.mq4 |
//|                          Copyright © 2004-2008, Poul_Trade_Forum |
//|                                                Aborigen & Kharko |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Aborigen & Kharko"
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int ReversPoint=20;
extern bool Sound=true;
//---- buffers
double RBuffer[];
int Trend=1,InTrend,ttime;
double Points,Last_High, Last_Low=100000;
datetime LastTimeHigh=0,LastTimeLow=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
   if(Digits==5 || Digits==3)
      ReversPoint*=10;
   Points=MarketInfo (Symbol(), MODE_POINT);
//---- indicator line
   SetIndexStyle(0,DRAW_SECTION,EMPTY,1,Tan);
   SetIndexBuffer(0,RBuffer);
   SetIndexEmptyValue(0,0);
//---- name for DataWindow and indicator subwindow label
   short_name="RPoint v2";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,100);
//----
   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(),i,shift,index;
   static int count=0;
//---- TODO: add your code here
   if(counted_bars>0) counted_bars--;
   i=Bars-counted_bars;
//----
   for(shift=i; shift>=0;shift--)
   {
      if (Trend==1) 
      {
         if (High[shift]>Last_High) 
         {
            if(LastTimeHigh!=0)
            {
               index=iBarShift(NULL,0,LastTimeHigh);
               RBuffer[index]=0;
            }
            Last_High=High[shift];
            RBuffer[shift]=Last_High;
            LastTimeHigh=Time[shift];
         }
         if (Low[shift]<Last_High-ReversPoint*Points && LastTimeHigh<Time[shift])
         {
            Trend=0;
            LastTimeHigh=0;
            Last_High=0;
            LastTimeLow=Time[shift];
            RBuffer[shift]=Low[shift];
            if(Sound && shift==0 && Last_Low==0)
               PlaySound("alert2.wav");
            Last_Low=RBuffer[shift];
         }
      }
      if (Trend==0)   
      {
         if (Low[shift]<Last_Low)
         {
            if(LastTimeLow!=0)
            {
               index=iBarShift(NULL,0,LastTimeLow);
               RBuffer[index]=0;
            }
            Last_Low=Low[shift];
            RBuffer[shift]=Last_Low;
            LastTimeLow=Time[shift];
         }
         if (High[shift]>Last_Low+ReversPoint*Points && LastTimeLow<Time[shift])
         {
            Trend=1;
            LastTimeLow=0;
            Last_Low=100000;
            LastTimeHigh=Time[shift];
            RBuffer[shift]=High[shift];
            if(Sound && shift==0 && Last_High==0)
               PlaySound("alert2.wav");
            Last_High=RBuffer[shift];
         }
      }
      //----
     }
   return(0);
  }
//+------------------------------------------------------------------+





Sample





Analysis



Market Information Used:

Series array that contains the highest prices of each bar
Series array that contains open time of each bar
Series array that contains the lowest prices of each bar


Indicator Curves created:

Implements a curve of type DRAW_SECTION


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features:

It plays sound alerts