mt4_PF_RSL_30m

Download script
mt4_PF_RSL_30m

This tool is designed to provide traders with a specialized visual aid for analyzing market trends, specifically by focusing on the relationship between current prices and historical averages. It functions as a custom indicator that generates a line graph to help identify whether a market is currently overextended or potentially due for a reversal.

Core Functionality

The primary logic of the script relies on calculating a specific ratio based on the 30-minute time frame. Regardless of which chart you are currently viewing, the tool "looks ahead" into the 30-minute data to perform its calculations. This ensures that the data remains consistent and is not skewed by the specific timeframe of your active trading screen.

How it Works

To create the resulting line on your chart, the script follows a three-step process:

  1. Data Gathering: It looks back at a specific number of previous price points (set by the "Aver_Bars" parameter, which defaults to 26).
  2. Average Calculation: It calculates the average closing price of those historical periods. This creates a "baseline" or a moving average of where the price has been recently.
  3. Comparison Ratio: Finally, it takes the most recent closing price and divides it by that calculated average.

What this means for the Trader

Instead of just showing you the price (which fluctuates constantly), this script transforms the price into a relative value.

  • When the resulting line is higher, it indicates that the current price is significantly above its recent average, potentially suggesting an "overbought" condition or strong upward momentum.
  • When the line is lower, it suggests that the price is trading below its recent average, which may indicate an "oversold" condition or downward pressure.

By visualizing this ratio as a smooth line, the tool helps traders cut through the "noise" of standard price movements to better understand the underlying strength and exhaustion of a trend based on 30-minute market cycles.

Price Data Components
Series array that contains close prices for each bar
1 Views
0 Downloads
0 Favorites
mt4_PF_RSL_30m
//--------------------------------------------------------------------
// RSL 30M
// Multi Timeframe RSL Tests
//--------------------------------------------------------------------
#property indicator_separate_window    // Indicator is drawn in the main window
#property indicator_buffers 1         // Number of buffers
#property indicator_color1 Orange      // Buf_1 RSL Indikator


extern int Aver_Bars=26;               // number of bars for calculation

 
double Buf_0[];             // Declaring indicator arrays

//--------------------------------------------------------------------
int init()                          // Special function init()
  {
//--------------------------------------------------------------------
   SetIndexBuffer(0,Buf_0);         // Assigning an array to a buffer
   SetIndexStyle (0,DRAW_LINE,STYLE_SOLID,1);// Line style
//--------------------------------------------------------------------

  }

int start()
  {
   int i,counted_bars=IndicatorCounted(),n=0;
   double RSL_GD=0;

//----
   if(Bars<=Aver_Bars) return(0);
//---- initial zero
   if(counted_bars<1)
      for(i=1;i<=Aver_Bars;i++) Buf_0[Bars-i]=0.0;
//----
   i=Bars-Aver_Bars-1;
   if(counted_bars>=Aver_Bars) i=Bars-counted_bars-1;
   while(i>=0)
     {
      RSL_GD=0;
      
      
      for(n=0;n<Aver_Bars;n++)
         {
         RSL_GD=(RSL_GD+(iClose(Symbol(),PERIOD_M30,(i+n))));
         }
         

 
 //RSL zeichnen-START-------------------------------------------------------------   
      Buf_0[i]=(iClose(Symbol(),PERIOD_M30,i)/((RSL_GD)/Aver_Bars));
 //-------------------------------------------------------------------------------  


          i--;
     }
   return(0);
  }
//+------------------------------------------------------------------+

Comments