RPoint-m_v2_v1

Download script
Author: Aborigen & Kharko

The RPoint v2 tool is a technical analysis indicator designed to identify and visualize significant price reversals on a trading chart. Its primary objective is to filter out minor market noise and highlight the major "peaks" and "valleys" where the market trend might be shifting.

Core Logic and Behavior

The script operates by tracking the price action to determine whether the current market movement is in an upward or downward trend. It does this using a dynamic "Reversal Point" system:

  • Trend Tracking: The indicator continuously monitors the highest highs (during uptrends) and the lowest lows (during downtrends). As long as the price continues to move in the established direction, it marks these new extremes.
  • The Reversal Trigger: Instead of reacting to every small fluctuation, the script uses a specific buffer—defined by the "ReversPoint" setting. A trend is only considered reversed when the price moves against the current direction by a significant margin.
    • For example, in an uptrend, if the price drops significantly below a previous high (exceeding the designated point threshold), the script recognizes a shift to a downtrend.
    • Conversely, in a downtrend, if the price climbs sufficiently above a previous low, it signals a shift back to an uptrend.
  • Visual Cleanup: To ensure the chart remains readable, the logic includes a "cleanup" mechanism. When a new peak or valley is identified that replaces a previous one within the same trend cycle, the script removes the old, outdated marker. This keeps the visual display clean and focused only on the most recent significant structural points.

Key Features for Traders

  • Automated Alerts: The tool can be configured to provide an audible notification whenever a new reversal point is detected in real-time. This allows traders to stay informed of trend changes without constantly staring at the screen.
  • Dynamic Scaling: The script automatically adjusts its sensitivity based on the number of digits in the currency pair being traded (e.g., adjusting for 3-digit or 5-digit pricing), ensuring consistent performance across different financial instruments.
  • Visual Representation: It draws a distinct line (in red) that connects these reversal points, providing a clear visual "skeleton" of the market's structure, making it easier to identify support and resistance levels at a glance.
Miscellaneous
Implements a curve of type %1It plays sound alerts
10 Views
0 Downloads
0 Favorites
RPoint-m_v2_v1
//+------------------------------------------------------------------+
//|                                                    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;
//---- array out of range fix   
   if(counted_bars==0) i--;
//----
   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);
  }
//+------------------------------------------------------------------+

Comments