Parabolic_best





//+------------------------------------------------------------------+
//|                                               Parabolic best.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                      Copyright © 2008, Ëóêàøóê Â.Ã. aka lukas1.  |
//|îðèãèíàë ëåæèò ...? Íè÷åãî íå ìåíÿë,òîëüêî "îáðåçàíèå" íî ìàëåíüêîå
//+------------------------------------------------------------------+
// âñ¸ ëèøíåå âûêèíóë. aka lukas1.
// âñ¸ ïðàâèëüíî ðàáîòàåò.  aka lukas1.
#property copyright "Copyright © 2008, MetaQuotes + lukas1"
#property link      ""

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Orange
//#property indicator_width3 1
//---- input parameters
extern double    Step=0.002;
extern int Diff=20; //ñäâèã íà÷àëà öåïî÷êè ïî âåðòèêàëè â ïîèíòàõ
extern int ilimit =144; 

//---- buffers
double SarBuffer[];
//----
int    save_lastreverse;
bool   save_dirlong;
double save_start;
double save_last_high;
double save_last_low;
double save_ep;
double save_sar;
double save_delta;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   IndicatorDigits(Digits+1);
//----
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexBuffer(0,SarBuffer);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Ïåðåêëþ÷àòåëü - çàïîìèíàòåëü            
//+------------------------------------------------------------------+
void SaveLastReverse(int last,int dir,double start,double low,double high,double ep,double sar)
  {
   save_lastreverse=last;
   save_dirlong=dir;
   save_start=start;
   save_last_low=low;
   save_last_high=high;
   save_ep=ep;
   save_sar=sar;
  }
//+------------------------------------------------------------------+
//| Parabolic Sell And Reverse system                                |
//+------------------------------------------------------------------+
int start()
  {
   static bool first=false;
   bool   dirlong;
   double start,last_high,last_low;
   double ep,sar,price_low,price_high,price;
   int    i,counted_bars=IndicatorCounted();
      int limit=ilimit;
//      SetIndexDrawBegin(0,Bars-limit); 
//      SetIndexDrawBegin(1,Bars-limit); 
//----
   if(Bars<3) return(0);
   dirlong=true;
   start=Step;
//--------------------------------------------+
   i=Bars-2;
   while(i>=0)
     {
      price_low=Low[i];
      price_high=High[i];
      price=SarBuffer[i+1];//òåêóùàÿ öåíà ðàâíà SarBuffer ïðåäûäóùåãî áàðà
      //sar ðàâåí öåíà ïðåäûäóùåãî áàðà ïëþñ øàã óìíîæèòü íà 
      //(ñòàðàÿ öåíà ìèíóñ çíà÷åíèå SarBuffer ïðåäûäóùåãî áàðà)
      sar=price+start*(ep-price);
//----
      if(dirlong)
        {
         start+=Step;
         if(sar>price_low)
           {
            SaveLastReverse(i,true,start,price_low,last_high,ep,sar);
            start=Step; 
            dirlong=false; 
            ep=price_low;
            last_low=price_low;
            SarBuffer[i]=last_high-Diff*Point;
            if (SarBuffer[i]<High[i]&&SarBuffer[i]>=Low[i]) 
                SarBuffer[i]=High[i]+Point;
            if (SarBuffer[i]<Low[i]) SarBuffer[i]=Low[i]-Point;
            i--;
            continue;
           }
         if(ep<price_high) { last_high=price_high; ep=price_high; }
        }
//----
      else
        {
         start+=Step;
         if(sar<price_high)
           {
            SaveLastReverse(i,false,start,last_low,price_high,ep,sar);
            start=Step; 
            dirlong=true; 
            ep=price_high;
            last_high=price_high;
            SarBuffer[i]=last_low+Diff*Point;
            if (SarBuffer[i]>Low[i]&&SarBuffer[i]<=High[i]) 
                SarBuffer[i]=Low[i]-Point;
            if (SarBuffer[i]>High[i]) SarBuffer[i]=High[i]+Point;
            i--;
            continue;
           }
         if(ep>price_low) { last_low=price_low; ep=price_low; }
        }
      SarBuffer[i]=sar;
      i--;
     }
//----
   return(0);
  }
//+------------------------------------------------------------------+



Sample





Analysis



Market Information Used:

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


Indicator Curves created:

Implements a curve of type DRAW_ARROW


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: