Swing_Point_v3

Download script
Author: Poul Trade Forum
Swing_Point_v3

This script functions as a visual market analysis tool designed to identify significant trend shifts and "reversal points" on a trading chart. Its primary purpose is to simplify the reading of price action by filtering out minor fluctuations and highlighting specific moments where the market's momentum fundamentally changes direction.

Core Logic Overview

The indicator works by continuously monitoring the high and low prices of historical candles to establish the boundaries of the current market movement. It tracks whether the market is currently in an upward or downward trajectory based on these price extremes.

How it Identifies Trends

Instead of reacting to every tiny price tick, the logic follows a structured process:

  • Boundary Tracking: The script constantly remembers the highest and lowest points reached during the current move.
  • Trend Confirmation: It distinguishes between a continuing trend and a potential reversal by looking for price action that exceeds these established boundaries.
  • The Reversal Filter: A key feature of this tool is the "ReversPoint" setting. This acts as a buffer or a "safety zone." The script will only recognize a trend change if the price moves significantly enough against the current direction—specifically, it must move past the opposite boundary by a user-defined number of points. This prevents the indicator from flickering or giving false signals during minor market consolidation.

Visual Output and Behavior

When the script detects that the price has penetrated this buffer zone, it triggers a reversal signal:

  • Trend Switching: The tool flips its internal logic from "Up" to "Down" (or vice versa).
  • Point Marking: It places a specific visual marker on the chart at the exact moment the trend reversal was confirmed.
  • Dynamic Updates: As new candles form, the script recalculates these boundaries in real-time, ensuring that the markers stay relevant to the most recent price action.

Summary for the Trader

In plain terms, this tool helps you see the "big picture." It ignores the market's "noise" and only highlights clear, substantial shifts in direction. By using a predefined point distance to confirm a reversal, it provides a cleaner visual map of support and resistance shifts, helping traders identify where a move might be ending and a new trend might be beginning.

Miscellaneous
Implements a curve of type %1
12 Views
1 Downloads
0 Favorites
Swing_Point_v3
//+------------------------------------------------------------------+
//|                                                        RPoint.mq4 |
//|                               Copyright © 2004, Poul_Trade_Forum |
//|                                                         Aborigen |
//|                                          http://forex.kbpauk.ru/ |
//+------------------------------------------------------------------+
#property copyright "Poul Trade Forum"
#property link      "http://forex.kbpauk.ru/"
//----
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Blue
//---- input parameters
extern int ReversPoint=50;
//---- buffers
double RBuffer[];
int Trend=1,InTrend,ttime;
double Points,Last_High, Last_Low;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   string short_name;
   Points=MarketInfo (Symbol(), MODE_POINT);
//---- indicator line
   SetIndexStyle(0,DRAW_SECTION,EMPTY,2,Blue);
   SetIndexBuffer(0,RBuffer);
   SetIndexEmptyValue(0,0);
//---- name for DataWindow and indicator subwindow label
   short_name="RPoint";
   IndicatorShortName(short_name);
   SetIndexLabel(0,short_name);
//----
   SetIndexDrawBegin(0,100);
   ArrayInitialize(RBuffer,0);
//----
   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;
//---- TODO: add your code here
   i=(Bars-counted_bars)-1;
   for(shift=i; shift>=0;shift--)
     {
      if (Time[shift]!=ttime) InTrend=InTrend+1;
      ttime=Time[shift];
      RBuffer[shift]=0;
      if (High[shift+1]>Last_High && Trend==1)  InTrend=1;
      if (Low[shift+1]<Last_Low   && Trend==0)   InTrend=1;
      if (High[shift+1]>Last_High) Last_High=High[shift+1];
      if (Low[shift+1]<Last_Low)   Last_Low=Low[shift+1];
      if (Trend==1 && Low[shift+1]<Last_High-ReversPoint*Points && InTrend>1)
        {
         Trend=0;
         RBuffer[shift+InTrend]=High[shift+InTrend];
         Last_High=Low[shift+1];
         Last_Low=Low[shift+1];
         InTrend=1;
        }
      if (Trend==0 && High[shift+1]>Last_Low+ReversPoint*Points && InTrend>1)
        {
         Trend=1;
         RBuffer[shift+InTrend]=Low[shift+InTrend];
         Last_Low=High[shift+1];
         Last_High=High[shift+1];
         InTrend=1;
        }
      //----
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments