wajdyss_RSI_O_L_H_C_Indicator_V2

Download script
Author: Copyright 2008 Wajdyss
wajdyss_RSI_O_L_H_C_Indicator_V2

Overview of the Indicator Logic

This script is a custom technical analysis tool designed for use on MetaTrader platforms. Its primary purpose is to provide a visual representation of specific price actions by overlaying numerical data directly onto the trading chart. Instead of using traditional sub-windows, it creates text labels that represent various components of a "Relative Strength Index" (RSI) calculation across different price points (Open, Low, High, and Close).

Key Functional Components

1. Security and Validity Check The script includes a built-in expiration mechanism. It checks the current system date against a predefined limit. If the current date exceeds this threshold, the indicator will display an expiration notice on the chart and cease to function. This is commonly used by developers to manage license periods or trial access.

2. Data Processing Logic The core of the script operates by analyzing a specific number of past candles (defined by the user in the settings). For every candle within this range, the tool calculates four distinct RSI values based on:

  • The Open price
  • The Low price
  • The High price
  • The Close price

By calculating an RSI for each of these specific points rather than just the standard "Close" price, the tool provides a more granular look at how momentum is distributed across the entire range of a single candle's price action.

3. Dynamic Visual Mapping Once the values are calculated, the script translates these numbers into visual text labels on your chart. To ensure clarity and prevent the labels from overlapping with actual price candles, the logic performs the following:

  • Vertical Positioning: It calculates a specific "offset" or distance (based on user settings) to place the text either above or below the candle's high/low points.
  • Color Coding: Each data point is assigned a unique color (e.g., Green for Open, Blue for Low, Red for High, and Black for Close). This allows traders to quickly distinguish between different types of price momentum at a glance.
  • Dynamic Updates: The script constantly refreshes these labels as new price data arrives, ensuring that the visual information remains synchronized with the live market.

Summary for the User

Essentially, this tool acts as a visual "map" of RSI momentum. Instead of you having to look back and forth between the main chart and a separate RSI window, this script pulls those calculations onto your candles. It highlights where the strength lies within each candle's range using color-coded text, helping you visualize the relationship between price movement and momentum more intuitively.

Indicators Used
Relative strength index
16 Views
0 Downloads
0 Favorites
wajdyss_RSI_O_L_H_C_Indicator_V2
//+------------------------------------------------------------------+
//|                                             wajdyss_MA_indicator |
//|                                           Copyright 2007 Wajdyss |
//|                                                wajdyss@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2008 Wajdyss"
#property link      "wajdyss@yahoo.com"

#property indicator_chart_window
extern int RSI_Period =14;
extern int Result_Size=10;
extern int Result_Candles=20;
extern color Open_Color=Green;
extern color Low_Color=Blue;
extern color High_Color=Red;
extern color Close_Color=Black;
extern int Result_Point=100;
extern string Note="-------------------";
extern int TextSize=14;
 extern color TextColor1=Black;
 extern  color TextColor2=Red;
 extern color TextColor3=Blue;
 extern color TextColor4=White;
 color TextColor5=Chartreuse;
int eyear=9999;
int emonth=9;
int eday=9;
string Name="wajdyss RSI O L H C Indicator";
string hname;
double Result;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
//----

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
  Comment("");
 ObjectDelete("a label");
 ObjectDelete("b label");
 ObjectDelete("c label");
 ObjectDelete("d label");
  ObjectsDeleteAll(0,OBJ_TEXT);

   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  Comment("");
 ObjectDelete("a label");
 ObjectDelete("b label");
 ObjectDelete("c label");
 ObjectDelete("d label");
  ObjectsDeleteAll(0,OBJ_TEXT);
 //   ArrayResize(Result33,Days);

  //a
          if(ObjectFind("a label") != 0)
   {
      ObjectCreate("a label", OBJ_LABEL, 0,0,0);
      ObjectSetText("a label","ÈÓã Çááå ÇáÑÍãä ÇáÑÍíã" , TextSize, "Arial", TextColor1);
      ObjectSet("a label", OBJPROP_XDISTANCE,350);
     ObjectSet("a label", OBJPROP_YDISTANCE,0);
   }
   
   //b
      if(ObjectFind("b label") != 0)
   {
      ObjectCreate("b label", OBJ_LABEL, 0,0,0);
      ObjectSetText("b label",Name  , TextSize, "Arial", TextColor2);
      ObjectSet("b label", OBJPROP_XDISTANCE,300);
     ObjectSet("b label", OBJPROP_YDISTANCE,25);
   }
   
   // c

   
      if(ObjectFind("c label") != 0)
   {
      ObjectCreate("c label", OBJ_LABEL, 0,0,0);
      ObjectSetText("c label","wajdyss@yahoo.com"  , TextSize, "Arial", TextColor3);
      ObjectSet("c label", OBJPROP_XDISTANCE,335);
     ObjectSet("c label", OBJPROP_YDISTANCE,50);
   }

//if (Period() != 1440) return(0);
   
    if ((Year()>eyear) || (Year()==eyear && Month()>emonth) || (Year()==eyear && Month()==emonth && Day()>eday))
    {
       //d
   if(ObjectFind("d label") != 0)
   {
      ObjectCreate("d label", OBJ_LABEL, 0,0,0);
      ObjectSetText("d label","the indicator has expired , contact us by E-mail" ,TextSize, "Arial", TextColor4);
      ObjectSet("d label", OBJPROP_XDISTANCE,250);
     ObjectSet("d label", OBJPROP_YDISTANCE,75);
   }
      return(0);
    } 
   int  same , notsame, samef, notsamef, samer, notsamer, samecandle, notsamecandle ;
   
   double samep,notsamep,all,GSignals,GSignalsP, GSignalUPP,GSignalDOWNP,fastMAnow,fastMAprevious,slowMAnow,slowMAprevious;
   double FMA1,FMA2,SMA1,SMA2,rsiOpen,rsiLow,rsiHigh,rsiClose;
   string status,O_Name,L_Name,H_Name,C_Name,O_Name2,L_Name2,H_Name2,C_Name2 ;



   for (int i=Result_Candles;i>=0;i--) 
   { 
  
  rsiOpen= iRSI(Symbol(),0,RSI_Period,PRICE_OPEN,i);
  O_Name="O"+i;
  O_Name2=DoubleToStr(rsiOpen,1);
  
  rsiLow=  iRSI(Symbol(),0,RSI_Period,PRICE_LOW,i);
  L_Name="L"+i;
  L_Name2=DoubleToStr(rsiLow,1);

  rsiHigh= iRSI(Symbol(),0,RSI_Period,PRICE_HIGH,i);
  H_Name="H"+i;
  H_Name2=DoubleToStr(rsiHigh,1);

  rsiClose=iRSI(Symbol(),0,RSI_Period,PRICE_CLOSE,i);
  C_Name="C"+i;
  C_Name2=DoubleToStr(rsiClose,1);
  
  if (rsiOpen<rsiClose) 

  {
  SetText(L_Name,L_Name2,Time[i],(High[i]+(Result_Point*Point*2)),"Arial",Result_Size,Low_Color);
  SetText(H_Name,H_Name2,Time[i],(High[i]+Result_Point*Point),"Arial",Result_Size,High_Color);
  }

  else
  {
  SetText(H_Name,H_Name2,Time[i],(High[i]+(Result_Point*Point*2)),"Arial",Result_Size,High_Color);
  SetText(L_Name,L_Name2,Time[i],(High[i]+Result_Point*Point),"Arial",Result_Size,Low_Color);
  }
  
  SetText(O_Name,O_Name2,Time[i],(Low[i]-Result_Point*Point),"Arial",Result_Size,Open_Color);
  SetText(C_Name,C_Name2,Time[i],(Low[i]-(Result_Point*Point*2)),"Arial",Result_Size,Close_Color);
  

 //Comment(rsiOpen,"      ",rsiLow,"      ",rsiHigh,"      ",rsiClose);
   }
   
   
   return(0);
  }

void SetText(string name,string txt,datetime x,double y,string font,int size,color clr)
{
  int idx=0;
  if(ObjectFind(name) == -1)
  {
    ObjectCreate(name, OBJ_TEXT, idx, 0, 0);
    ObjectSetText(name, txt, size, font, clr);
    ObjectSet(name, OBJPROP_TIME1, x);
    ObjectSet(name, OBJPROP_PRICE1, y);
  }
  else
  {
    ObjectSet(name, OBJPROP_TIME1, x);
    ObjectSet(name, OBJPROP_PRICE1, y);
    ObjectSetText(name, txt, size, font, clr);
  } 
}

Comments