linie_wsparcia_oporu_v2

Download script
Author: Copyright � 2011, mailto: polska.waluty@gmail.com
linie_wsparcia_oporu_v2

This script is designed for the MetaTrader platform to automatically identify and visualize key price levels on a trading chart—specifically "Support" (the floor) and "Resistance" (the ceiling). Instead of simply drawing static horizontal lines, the logic focuses on finding significant price extremes over a user-defined period of historical data.

Core Functionality

The script analyzes a specific range of previous candles (determined by the user) to find the absolute lowest and highest points reached during that timeframe. It then uses these points to construct visual trend markers on the chart.

1. Support Identification (The Floor)

  • Scanning: The script looks through the historical "low" prices of the candles within your chosen range.
  • Finding the Bottom: It identifies the single lowest price point reached during that period.
  • Trend Drawing: It then draws a trend line connecting these low points. The logic includes a "validation" step: as it draws the line backward, if any historical price falls below the current line, the script adjusts the line to ensure it accurately reflects the boundary of the price action.

2. Resistance Identification (The Ceiling)

  • Scanning: Similarly, the script examines the "high" prices of the candles in your chosen range.
  • Finding the Top: It locates the highest peak reached during that period.
  • Trend Drawing: It creates a trend line based on these peaks. Like the support logic, it continuously checks the data to ensure the line stays above all relevant price action, providing a clear visual of the "ceiling" where prices have struggled to break through.

Visual and Operational Features

  • Customizable Range: You can define exactly how many candles back the script should look (the start and end points of the analysis).
  • Visual Distinction: The script automatically applies different colors to differentiate between the two types of levels—typically Green for Support and Red for Resistance.
  • Real-Time Updates: The script includes a logic gate that ensures calculations are refreshed every time a new candle begins, keeping the lines current with the latest market movements.
  • Automatic Cleanup: When you remove the script from your chart, it is programmed to clean up and delete the visual objects it created, leaving your chart tidy.

Summary for the User

Essentially, this tool automates the tedious process of manually identifying where the price "bottomed out" or "peaked" over a specific period. By highlighting these levels with trend lines, it provides a clear visual map of the current market boundaries, helping traders see where price might face significant hurdles or find solid footing.

Price Data Components
Series array that contains the lowest prices of each barSeries array that contains the highest prices of each bar
Miscellaneous
It issuies visual alerts to the screenImplements a curve of type %1
3 Views
0 Downloads
0 Favorites
linie_wsparcia_oporu_v2
#property copyright "Copyright © 2011, mailto: polska.waluty@gmail.com"
#property link      "http://www.info-trade.za.pl"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Green
double    127059777421474836305133 [];
double    162869401421474836313991 [];
extern string info_="- - - Tutaj podaj ile ma byc badanych swiec ---";
extern int linia_dolna_od = 1, linia_dolna_do = 366;
extern int linia_gorna_od = 1, linia_gorna_do = 366;
extern string nazwa_dolnej_linii = "Support/Wsparcie", nazwa_gornej_linii = "Resistance/Opor";
extern color kolor_dolnej_linii = Green, kolor_gornej_linii = Red;
double  158651616521474836452710 ,  34356336321474836371433 ,  16740031492147483636239 ,  3650920921474836448123 ;
datetime  418123549214748364333873 ,  1620587271214748363534285 ,  1953697357214748364226647 ,  1471260852214748363448298 ;
bool  1216626379214748363913795 =false;
int  406173678214748364124811 =333, 1970013357214748362911122 =2011;
int init()
  {
   if ( TimeDayOfYear(TimeCurrent()) >  406173678214748364124811  && TimeYear(TimeCurrent()) !=  1970013357214748362911122  ) {Alert("mailto:polska.waluty@gmail.com");return;}
   SetIndexStyle(0,DRAW_LINE,0,0,kolor_gornej_linii);
   SetIndexBuffer(0, 127059777421474836305133 );
   SetIndexEmptyValue(0,0.0);
   SetIndexLabel(0,"Resistance/Opor");
   SetIndexStyle(1,DRAW_LINE,0,0,kolor_dolnej_linii);
   SetIndexBuffer(1, 162869401421474836313991 );
   SetIndexEmptyValue(1,0.0);
   SetIndexLabel(1,"Support/Wsparcie");
   return(0);
  }
int deinit()
  {
   ObjectsDeleteAll();
   return(0);
  }
int start()
  {
   if (TimeDayOfYear(TimeCurrent())>333&&TimeYear(TimeCurrent())!=2011){return;}
    168987184214748364045461 ();
   if ( 1216626379214748363913795 ==true)
   {
   RefreshRates();
   WindowRedraw();
    1620587271214748363534285  = iTime(NULL,0,linia_dolna_od);
    1471260852214748363448298  = iTime(NULL,0,linia_dolna_od);
   if (TimeDayOfYear(TimeCurrent())>333&&TimeYear(TimeCurrent())!=2011){return;}
    34356336321474836371433  = iLow(NULL,0,linia_dolna_od);
    16740031492147483636239  = iLow(NULL,0,linia_dolna_od);
   int  2114319876214748364748749 ,  111886897921474836337640  = linia_dolna_od;
   for ( 2114319876214748364748749  = linia_dolna_od;  2114319876214748364748749  <= linia_dolna_do;  2114319876214748364748749 ++)
   {
    if (iLow(NULL,0, 2114319876214748364748749 ) <  34356336321474836371433 )
      {
       111886897921474836337640  =  2114319876214748364748749 ;  34356336321474836371433  = iLow(NULL,0, 111886897921474836337640 );
       1620587271214748363534285  = iTime(NULL,0, 111886897921474836337640 );
      }
   }
   for ( 2114319876214748364748749  = linia_dolna_od;  2114319876214748364748749  <  111886897921474836337640 ;  2114319876214748364748749 ++)
   {
    if (iLow(NULL,0, 2114319876214748364748749 ) <  16740031492147483636239 )
      {
       16740031492147483636239  = iLow(NULL,0, 2114319876214748364748749 );
       1471260852214748363448298  = iTime(NULL,0, 2114319876214748364748749 );
      }
   }
   if ( TimeDayOfYear(TimeCurrent()) >  406173678214748364124811  && TimeYear(TimeCurrent()) !=  1970013357214748362911122  ) {Alert("mailto:polska.waluty@gmail.com");return;}
   ObjectCreate(nazwa_dolnej_linii,OBJ_TREND,0, 1620587271214748363534285 , 34356336321474836371433 , 1471260852214748363448298 , 16740031492147483636239 );
   for ( 2114319876214748364748749  =  111886897921474836337640 ;  2114319876214748364748749 >=linia_dolna_od; 2114319876214748364748749 --)
   {
      if ( ObjectGetValueByShift(nazwa_dolnej_linii,  2114319876214748364748749 ) > iLow(NULL,0, 2114319876214748364748749 ) )
      {
      ObjectDelete(nazwa_dolnej_linii);
      if (TimeDayOfYear(TimeCurrent())>333&&TimeYear(TimeCurrent())!=2011){return;}
      }
       1471260852214748363448298  = iTime(NULL,0, 2114319876214748364748749 );
       16740031492147483636239  = iLow(NULL,0, 2114319876214748364748749 );
      ObjectCreate(nazwa_dolnej_linii,OBJ_TREND,0, 1620587271214748363534285 , 34356336321474836371433 , 1471260852214748363448298 , 16740031492147483636239 );
   }
   ObjectSet(nazwa_dolnej_linii,OBJPROP_COLOR,kolor_dolnej_linii);
   ObjectSet(nazwa_dolnej_linii,OBJPROP_WIDTH,1);
   ObjectSet(nazwa_dolnej_linii,OBJPROP_STYLE,STYLE_SOLID);
   for ( 2114319876214748364748749  =  111886897921474836337640 ;  2114319876214748364748749 >=linia_dolna_od; 2114319876214748364748749 --)
   {
    162869401421474836313991 [ 2114319876214748364748749 ] = ObjectGetValueByShift(nazwa_dolnej_linii,  2114319876214748364748749 );
   }
    418123549214748364333873  = iTime(NULL,0,linia_gorna_od);
    1953697357214748364226647  = iTime(NULL,0,linia_gorna_od);
    158651616521474836452710  = iLow(NULL,0,linia_gorna_od);
    3650920921474836448123  = iLow(NULL,0,linia_gorna_od);
   int  1596751872214748364643597 ,  1279871946214748363245779  = linia_gorna_od;
   for ( 1596751872214748364643597  = linia_gorna_od;  1596751872214748364643597  <= linia_gorna_do;  1596751872214748364643597 ++)
   {
    if (iHigh(NULL,0, 1596751872214748364643597 ) >  158651616521474836452710 )
      {
       1279871946214748363245779  =  1596751872214748364643597 ;  158651616521474836452710  = iHigh(NULL,0, 1279871946214748363245779 );
       418123549214748364333873  = iTime(NULL,0, 1279871946214748363245779 );
      }
   }
   for ( 1596751872214748364643597  = linia_dolna_od;  1596751872214748364643597  <  1279871946214748363245779 ;  1596751872214748364643597 ++)
   {
    if (iHigh(NULL,0, 1596751872214748364643597 ) >  3650920921474836448123 )
      {
       3650920921474836448123  = iHigh(NULL,0, 1596751872214748364643597 );
       1953697357214748364226647  = iTime(NULL,0, 1596751872214748364643597 );
      }
   }
   ObjectCreate(nazwa_gornej_linii,OBJ_TREND,0, 418123549214748364333873 , 158651616521474836452710 , 1953697357214748364226647 , 3650920921474836448123 );
   for ( 1596751872214748364643597  =  1279871946214748363245779 ;  1596751872214748364643597 >=linia_gorna_od; 1596751872214748364643597 --)
   {
      if ( ObjectGetValueByShift(nazwa_gornej_linii,  1596751872214748364643597 ) < iHigh(NULL,0, 1596751872214748364643597 ) )
      {
      ObjectDelete(nazwa_gornej_linii);
      }
       1953697357214748364226647  = iTime(NULL,0, 1596751872214748364643597 );
       3650920921474836448123  = iHigh(NULL,0, 1596751872214748364643597 );
      ObjectCreate(nazwa_gornej_linii,OBJ_TREND,0, 418123549214748364333873 , 158651616521474836452710 , 1953697357214748364226647 , 3650920921474836448123 );
   }
   ObjectSet(nazwa_gornej_linii,OBJPROP_COLOR,kolor_gornej_linii);
   ObjectSet(nazwa_gornej_linii,OBJPROP_WIDTH,1);
   ObjectSet(nazwa_gornej_linii,OBJPROP_STYLE,STYLE_SOLID);
   for ( 1596751872214748364643597  =  1279871946214748363245779 ;  1596751872214748364643597 >=linia_gorna_od; 1596751872214748364643597 --)
   {
    127059777421474836305133 [ 1596751872214748364643597 ] = ObjectGetValueByShift(nazwa_gornej_linii,  1596751872214748364643597 );
   }
  }
   return(0);
  }
void  168987184214748364045461 ()
  {
   static datetime  14686054214748363850515 =0;
    1216626379214748363913795 =false;
   if( 14686054214748363850515  != Time[0])
     {
       14686054214748363850515 =Time[0];
       1216626379214748363913795 =true;
     }
  }

Comments