Universal_Ranger

Download script
Author: Copyright � 2010, Thomas Stutz.
Universal_Ranger

The Universal Ranger is a specialized visual tool designed for traders to identify key price levels on their trading charts. Its primary function is to automatically detect and display significant "Support" and "Resistance" zones, which are essential areas where price often reacts, reverses, or consolidates.

How the Logic Works

The script operates by analyzing historical price data based on a specific timeframe that you select. Here is a breakdown of its core logic:

  • Timeframe Synchronization: The tool allows you to choose a specific time horizon (ranging from 1-minute charts up to monthly charts). It translates your choice into the correct numerical units so that it can look back at the "Highs" and "Lows" accurately across different types of trading sessions.
  • Dynamic Price Tracking: The script scans the historical data for two specific values:
    • Resistance: It identifies the highest price points reached during your chosen timeframe.
    • Support: It identifies the lowest price points reached during your chosen timeframe.
  • Visual Mapping: Once these points are identified, the script draws horizontal lines directly onto your chart.
    • The Resistance Line (typically highlighted in a distinct color like OrangeRed) marks the ceiling where the price has previously struggled to break through.
    • The Support Line (typically highlighted in a distinct color like Lime) marks the floor where the price has historically found buying interest.
  • Real-Time Updating: As new market data arrives, the script continuously monitors the current price action. If a new high or low is established within your selected timeframe, the horizontal lines automatically shift to reflect these new boundaries.

Key User Benefits

By automating this process, the tool removes the manual guesswork of "eyeballing" the chart to find key levels. It provides a clear, persistent visual guide that helps traders:

  1. Identify potential areas for entry or exit.
  2. Visualize where the market might experience a reversal.
  3. Maintain a consistent perspective on market structure regardless of which specific bar they are currently viewing.
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
3 Views
0 Downloads
0 Favorites
Universal_Ranger

//=================================================================================================
//===Universal=Ranger============================================================================
//=============================================================================================

#property copyright "Copyright © 2010, Thomas Stutz."
#property link      "t.s@my-sc.eu"

//=============================================================================================

#property indicator_chart_window

//===Extern=Variables==========================================================================

extern      int         LineStyle   =        0,
                        LineWidth   =        0,
                        BackBar     =        0;

extern      string      TimeFrame   =        "M15";

extern      color       ResLine     =        Lime,
                        SupLine     =        OrangeRed;

//===Variables=================================================================================

            int         i           =        0,
                        limit       =        0,
                        tframe      =        0,
                        counter     =        0;

            double      supi        =        0,
                        resi        =        0;

//===Init======================================================================================

int init()

   {

      if(TimeFrame == "M1")      {tframe = 1;}
      if(TimeFrame == "M5")      {tframe = 5;}
      if(TimeFrame == "M15")     {tframe = 15;}
      if(TimeFrame == "M30")     {tframe = 30;}
      if(TimeFrame == "H1")      {tframe = 60;}
      if(TimeFrame == "H4")      {tframe = 240;}
      if(TimeFrame == "D1")      {tframe = 1440;}
      if(TimeFrame == "W1")      {tframe = 10080;}
      if(TimeFrame == "MN1")     {tframe = 43200;}

      return(0);

   }

//===Deinit====================================================================================

int deinit()

   {

      ObjectDelete("15_Ranger_Support");
      ObjectDelete("15_Ranger_Resistance");

      return(0);

   }

//===Start=====================================================================================

int start()

   {

      if(TimeFrame == "M1")      {tframe = 1;}
      if(TimeFrame == "M5")      {tframe = 5;}
      if(TimeFrame == "M15")     {tframe = 15;}
      if(TimeFrame == "M30")     {tframe = 30;}
      if(TimeFrame == "H1")      {tframe = 60;}
      if(TimeFrame == "H4")      {tframe = 240;}
      if(TimeFrame == "D1")      {tframe = 1440;}
      if(TimeFrame == "W1")      {tframe = 10080;}
      if(TimeFrame == "MN1")     {tframe = 43200;}

      counter = IndicatorCounted();
      if    (counter < 0) return(-1);
      if    (counter > 0) counter--;
      limit = Bars - counter;

      for(i = BackBar; i < limit; i++)

         {

            resi = iHigh(Symbol(), tframe, i);
            supi = iLow(Symbol(), tframe, i);

            if (ObjectFind("15_Ranger_Resistance")!=0)

               {

                  ObjectCreate("15_Ranger_Resistance",OBJ_HLINE,0,0,resi);
                  ObjectSet("15_Ranger_Resistance",OBJPROP_COLOR,ResLine);
                  ObjectSet("15_Ranger_Resistance",OBJPROP_STYLE,LineStyle);
                  ObjectSet("15_Ranger_Resistance",OBJPROP_WIDTH,LineWidth);

               }

            else {ObjectMove("Da15_Ranger_ResistanceyR3",0,Time[0],resi);}

            if (ObjectFind("15_Ranger_Support")!=0)

               {

                  ObjectCreate("15_Ranger_Support",OBJ_HLINE,0,0,supi);
                  ObjectSet("15_Ranger_Support",OBJPROP_COLOR,SupLine);
                  ObjectSet("15_Ranger_Support",OBJPROP_STYLE,LineStyle);
                  ObjectSet("15_Ranger_Support",OBJPROP_WIDTH,LineWidth);

               }

            else {ObjectMove("15_Ranger_Support",0,Time[0],supi);}

         }

      return(0);

   }

//===End=======================================================================================

Comments