Alert: RSI_Window_Name is Wrong

 

Hallo all together,

I'm a mql4-beginner and I have a problem to place an indicator in the RSI(3) window.

After MT4-Reboot comes always this message:

Alert: RSI_Window_Name is Wrong


I'm playing with 2 free Indicators: Lawgirl's Trend Display v1.02.mq4 and RSI with period = 3.

Lawgirl's-indi shows a table with many currencies pairs and arrows for PA-Direction from RSI(3) in different Time frames.

The user can place Lawgirl's-Indicator as full table or as only a row for active currency pair in main windows or in RSI windows .

User can choose this in the properties of Lawgirl's-indicator:


For main windows:    IndicatorInRSIWindow  = false
For RSI(3) windows:  IndicatorInRSIWindow  = thrue


It works perfectly at the beginning, but does not work after MT4-Rebooting.
MT4 does not know this RSI(3) name more.
This name RSI(3) is wrote always in the properties of indicator.
Lawgirl's Trend Display has this code:

extern bool        IndicatorInRSIWindow  = false;    // Dispaly the indicator in the RSI Window
extern string    RSI_WindowName = "RSI(3)";            // RSI Window ShortName

.....................................

.......................................

if(IndicatorInRSIWindow)
    {
        WindowNo = WindowFind(RSI_WindowName);
        if(WindowNo < 0)
        {
            Alert("RSI_WindowName is Wrong");
            return(0);
        }

How can I check this RSI-name in MT4?

May be I need another RSI-Indicator,

I have 2 demo accounts be IG and by GKFX,

both RSI does not work with Lawgirl's-indi.

Could anybody help me?

Thanks & sorry for my bad English

vvm-55

 
vvm-55:

Hallo all together,

I'm a mql4-beginner and I have a problem to place an indicator in the RSI(3) window.

After MT4-Reboot comes always this message:

Alert: RSI_Window_Name is Wrong


I'm playing with 2 free Indicators: Lawgirl's Trend Display v1.02.mq4 and RSI with period = 3.

Lawgirl's-indi shows a table with many currencies pairs and arrows for PA-Direction from RSI(3) in different Time frames.

The user can place Lawgirl's-Indicator as full table or as only a row for active currency pair in main windows or in RSI windows .

User can choose this in the properties of Lawgirl's-indicator:


For main windows:    IndicatorInRSIWindow  = false
For RSI(3) windows:  IndicatorInRSIWindow  = thrue


It works perfectly at the beginning, but does not work after MT4-Rebooting.
MT4 does not know this RSI(3) name more.
This name RSI(3) is wrote always in the properties of indicator.
Lawgirl's Trend Display has this code:

How can I check this RSI-name in MT4?

May be I need another RSI-Indicator,

I have 2 demo accounts be IG and by GKFX,

both RSI does not work with Lawgirl's-indi.

Could anybody help me?

Thanks & sorry for my bad English

vvm-55

Exactly the same way as in the code :
if(WindowNo < 0)
 

Thanks for replay,

you are right and your answer is correct.

This code does its job well:

if(WindowNo < 0)

and make an ALLERT after as this function returns -1.

But it does not solve my problem....

After new start MT4 does not know the name of RSI_WondowName

and can't find my RSI-Indicator.

This is the problem.

WindowNo = WindowFind(RSI_WindowName)

it's =-1 after reboot of MT4.


Perhaps I need to install another RSI-indicator, from any other platform

not from GKFX or IG.

Cann anybody check this indi with RSI together on your MT4-System?

Download link for indi (post number 2.399):

https://www.forexfactory.com/showthread.php?p=4127792#post4127792


Many Thanks

vvm-55

 
vvm-55:

Thanks for replay,

you are right and your answer is correct.

This code does its job well:

and make an ALLERT after as this function returns -1.

But it does not solve my problem....

After new start MT4 does not know the name of RSI_WondowName

and can't find my RSI-Indicator.

This is the problem.

it's =-1 after reboot of MT4.


Perhaps I need to install another RSI-indicator, from any other platform

not from GKFX or IG.

Cann anybody check this indi with RSI together on your MT4-System?

Download link for indi (post number 2.399):

https://www.forexfactory.com/showthread.php?p=4127792#post4127792


Many Thanks

vvm-55

If you want help you can at least provide a click-able link.

Or even better, upload the code here yourself.

 

Sorry!!

Here yuo are:

https://www.forexfactory.com/showthread.php?p=4127792#post4127792


vvm-55

 
https://www.forexfactory.com/showthread.php?p=4127792#post4127792
 

provide a click-able link.

It seems does not work by me.


But it is possible too

to copy the link and insert in the browser 

 

Inicator Code:

//+------------------------------------------------------------------+
//|                                Lawgirl's Trend Display v1.02.mq4 |
//|                                           Copyright © 2010, gspe |
//|                                                                  |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+

#property copyright "Copyright © 2010, gspe"
#property link      ""

#property indicator_chart_window

extern bool             ShowCurrentPairOnly  = false; //        Dispaly only chart Pair
extern string   PairsToTrade = "AUDCAD,AUDCHF,AUDNZD,AUDJPY,AUDUSD,CADCHF,CADJPY,CHFJPY,EURAUD,EURCAD,EURCHF,EURGBP,EURNZD,EURJPY,EURUSD,GBPCHF,GBPJPY,GBPUSD,NZDUSD,NZDJPY,USDCAD,USDCHF,USDJPY";
extern string   PeriodsToTrade = "H1,H4,D1,W1,MN"; // Time Frames to display are user defined
//extern string  lb="----Look back inputs----";
//extern double  MinimumValueChange=1;
//extern bool    TrendRequiresAllThree=true;
//extern bool    TrendRequiresOnlyHtf=false;
//extern bool    AlertByEmail=false;
extern string   pdi="----Pair display inputs----";
extern int              FontSize=10;
extern color    FontColour=Yellow;
extern string   Font_Font = "Lucida Sans Unicode";
extern double   DisplayStarts_X=5;      //we positioning the object from the top right corner of window
extern double   DisplayStarts_Y=15;
extern bool             IndicatorInRSIWindow  = false;  // Dispaly the indicator in the RSI Window
extern string   RSI_WindowName = "RSI(3)";                      // RSI Window ShortName

double  ValueChange_1=2.5,
                ValueChange_2=4.75;

int     symbolCodeSUP=233,
                symbolCodeSDN=234,
                symbolCodeWUP=236,
                symbolCodeWDN=238,
                symbolCodeNoSignal=232;
color   colorCodeSUP=MediumAquamarine,
                colorCodeSDN=Coral,
                colorCodeWUP=MediumAquamarine,
                colorCodeWDN=Coral,
                colorCodeNoSignal=Gold;

//Pair extraction
int             NoOfPairs;                              // Holds the number of pairs passed by the user via the inputs screen
int             NoOfPeriods;                    // Holds the number of periods passed by the user via the inputs screen
string  TradePair[];                    //Array to hold the pairs traded by the user
string  TradePeriod[];                  //Array to hold the periods traded by the user
int             TradePeriodTF[];                //Array to hold the periods traded by the user
int             TradeTrendSymbol[][5];  //Array to hold the pairs trend symbol
color   TradeTrendColor[][5];   //Array to hold the pairs trend color
bool    AlertSent[];

string  trend;
int             OldBars;
int WindowNo = 0;
//+------------------------------------------------------------------+
string objPrefix ;      // all objects drawn by this indicator will be prefixed with this
string buff_str ;       // all objects drawn by this indicator will be prefixed with this
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
{
//+------------------------------------------------------------------+ 
//----
        int i, j;
        objPrefix = WindowExpertName();
        
        if(IndicatorInRSIWindow)
        {
                WindowNo = WindowFind(RSI_WindowName);
                if(WindowNo < 0)
                {
                        Alert("RSI_WindowName is Wrong");
                        return(0);
                }
                DisplayStarts_X = 5;
                DisplayStarts_Y = 5;
        }

        if(!ShowCurrentPairOnly)
        {
                //Extract the pairs traded by the user
                NoOfPairs = StringFindCount(PairsToTrade,",")+1;
                ArrayResize(TradePair, NoOfPairs);
                string AddChar = StringSubstr(Symbol(),6,4);
                StrPairToStringArray(PairsToTrade, TradePair, AddChar);
        }
        else
        {
                //Fill the array with only chart pair
                NoOfPairs = 1;
                ArrayResize(TradePair, NoOfPairs);
                TradePair[0] = Symbol();
        }
        
        NoOfPeriods = StringFindCount(PeriodsToTrade, ",")+1;
        ArrayResize(TradePeriod, NoOfPeriods);
        ArrayResize(TradePeriodTF, NoOfPeriods);
        StrToStringArray(PeriodsToTrade, TradePeriod);
        
        for(j=0; j<NoOfPeriods; j++)
        {
                TradePeriodTF[j] = StrToTF(TradePeriod[j]);     //this is for display Periods from topleft corner
                //TradePeriodTF[NoOfPeriods-j] = StrToTF(TradePeriod[j]);       //this is for display Periods from topright corner
        }
//----  
        ArrayResize(TradeTrendSymbol, NoOfPairs);
        ArrayInitialize(TradeTrendSymbol, symbolCodeNoSignal);          // Inizialize the array with symbolCodeNoSignal
        ArrayResize(TradeTrendColor, NoOfPairs);
        ArrayInitialize(TradeTrendColor, colorCodeNoSignal);            // Inizialize the array with colorCodeNoSignal
//----
        return(0);
}// End init()

//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
{
//----
        Comment("");   
//+------------------------------------------------------------------+ 
        RemoveObjects(objPrefix);
//----
        return(0);
}// End deinit()

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
   GetPairTrends(TradeTrendSymbol, TradeTrendColor);
   PrintPairTrends();

}//End start()
//+------------------------------------------------------------------+

//-------------------------------------------------------------------+
// RemoveObjects                                                     |
//-------------------------------------------------------------------+
void RemoveObjects(string Pref)
{   
        int i;
        string objname = "";

        for (i = ObjectsTotal(); i >= 0; i--)
        {
                objname = ObjectName(i);
                if (StringFind(objname, Pref, 0) > -1) ObjectDelete(objname);
        }
        return(0);
} // End void RemoveObjects(string Pref)

//+------------------------------------------------------------------+
// StringFindCount                                                   |
//+------------------------------------------------------------------+
int StringFindCount(string str, string str2)
// Returns the number of occurrences of STR2 in STR
// Usage:   int x = StringFindCount("ABCDEFGHIJKABACABB","AB")   returns x = 3
{
  int c = 0;
  for (int i=0; i<StringLen(str); i++)
    if (StringSubstr(str,i,StringLen(str2)) == str2)  c++;
  return(c);
} // End int StringFindCount(string str, string str2)

//+------------------------------------------------------------------+
// StrPairToStringArray                                                  |
//+------------------------------------------------------------------+
void StrPairToStringArray(string str, string &a[], string p_suffix, string delim=",")
{
        int z1=-1, z2=0;
        for (int i=0; i<ArraySize(a); i++)
        {
                z2 = StringFind(str,delim,z1+1);
                a[i] = StringSubstr(str,z1+1,z2-z1-1) + p_suffix;
                if (z2 >= StringLen(str)-1)   break;
                z1 = z2;
        }
        return(0);
} // End void StrPairToStringArray(string str, string &a[], string p_suffix, string delim=",") 

//+------------------------------------------------------------------+
// StrToStringArray                                                  |
//+------------------------------------------------------------------+
void StrToStringArray(string str, string &a[], string delim=",")
{
        int z1=-1, z2=0;
        for (int i=0; i<ArraySize(a); i++)
        {
                z2 = StringFind(str,delim,z1+1);
                a[i] = StringSubstr(str,z1+1,z2-z1-1);
                if (z2 >= StringLen(str)-1)   break;
                z1 = z2;
        }
        return(0);
} // End void StrToStringArray(string str, string &a[], string delim=",") 

//+------------------------------------------------------------------+
// StrToTF(string str)                                               |
//+------------------------------------------------------------------+
// Converts a timeframe string to its MT4-numeric value
// Usage:   int x=StrToTF("M15")   returns x=15
int StrToTF(string str)
{
  str = StringUpper(str);
  str = StringTrimLeft(str);
  str = StringTrimRight(str);
  
  if (str == "M1")   return(1);
  if (str == "M5")   return(5);
  if (str == "M15")  return(15);
  if (str == "M30")  return(30);
  if (str == "H1")   return(60);
  if (str == "H4")   return(240);
  if (str == "D1")   return(1440);
  if (str == "W1")   return(10080);
  if (str == "MN")   return(43200);
  return(0);
}  

//+------------------------------------------------------------------+
// StringUpper(string str)                                           |
//+------------------------------------------------------------------+
// Converts any lowercase characters in a string to uppercase
// Usage:    string x=StringUpper("The Quick Brown Fox")  returns x = "THE QUICK BROWN FOX"
string StringUpper(string str)
{
  string outstr = "";
  string lower  = "abcdefghijklmnopqrstuvwxyz";
  string upper  = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i=0; i<StringLen(str); i++)  {
    int t1 = StringFind(lower,StringSubstr(str,i,1),0);
    if (t1 >=0)  
      outstr = outstr + StringSubstr(upper,t1,1);
    else
      outstr = outstr + StringSubstr(str,i,1);
  }
  return(outstr);
}  
//+------------------------------------------------------------------+
//| GetPairTrends                                                    |
//+------------------------------------------------------------------+
void GetPairTrends(int &trend_symbol[][], color &trend_color[][])
{
        int i, j;
        double c_val, p_val, delta_val;
        
        for(i=0; i<NoOfPairs; i++)
        {
                for(j=0; j<NoOfPeriods; j++)
                {
                        trend_symbol[i][j] = symbolCodeNoSignal;
                        trend_color[i][j] = colorCodeNoSignal;
                        
                        c_val = iRSI(TradePair[i], TradePeriodTF[j], 3, PRICE_CLOSE, 0);
                        p_val = iRSI(TradePair[i], TradePeriodTF[j], 3, PRICE_CLOSE, 1);
                        delta_val = MathAbs(c_val - p_val);
                        
                        if(c_val - p_val > 0)
                        {
                                if(delta_val > ValueChange_2)
                                {
                                        trend_symbol[i][j] = symbolCodeSUP;
                                        trend_color[i][j] = colorCodeSUP;
                                } // End if(delta_val > ValueChange_2)
                                if(delta_val > ValueChange_1 && delta_val < ValueChange_2)
                                {
                                        trend_symbol[i][j] = symbolCodeWUP;
                                        trend_color[i][j] = colorCodeWUP;
                                } // End if(delta_val > ValueChange_1 && delta_val < ValueChange_2)
                        } // End if(c_val - p_val > 0)
                        if(c_val - p_val < 0)
                        {
                                if(delta_val > ValueChange_2)
                                {
                                        trend_symbol[i][j] = symbolCodeSDN;
                                        trend_color[i][j] = colorCodeSDN;
                                } // End if(delta_val > ValueChange_2)
                                if(delta_val > ValueChange_1 && delta_val < ValueChange_2)
                                {
                                        trend_symbol[i][j] = symbolCodeWDN;
                                        trend_color[i][j] = colorCodeWDN;
                                } // End if(delta_val > ValueChange_1 && delta_val < ValueChange_2)
                        } // End if(c_val - p_val > 0)
                } //End for(j=0; j<NoOfPeriods; j++)
        } //End for(i=0; i<NoOfPairs; i++)
        return(0);

}//End GetPairTrends(int &trend_symbol[][], color &trend_color[][])

//+------------------------------------------------------------------+
//| PrintPairTrends                                                    |
//+------------------------------------------------------------------+
void PrintPairTrends()
{
        RemoveObjects(objPrefix);
        
        int i, j;
        
        //Set Trade Pair
        for(i=0; i<NoOfPairs; i++)
        {
                buff_str = StringConcatenate(objPrefix, TradePair[i]);
                ObjectDelete(buff_str);
                ObjectCreate(buff_str,OBJ_LABEL,WindowNo,0,0,0,0);
                ObjectSet(buff_str,OBJPROP_CORNER,1);
                ObjectSet(buff_str,OBJPROP_XDISTANCE,DisplayStarts_X + FontSize*(NoOfPeriods*2));
                ObjectSet(buff_str,OBJPROP_YDISTANCE,DisplayStarts_Y + (i+1)*(FontSize+FontSize/2));
                ObjectSetText(buff_str,TradePair[i],FontSize-2,Font_Font,FontColour);
        }
        //Set Trade Period
        for(j=0; j<NoOfPeriods; j++)
        {
                buff_str = StringConcatenate(objPrefix, TradePeriod[j]);
                ObjectDelete(buff_str);
                ObjectCreate(buff_str,OBJ_LABEL,WindowNo,0,0,0,0);
                ObjectSet(buff_str,OBJPROP_CORNER,1);
                ObjectSet(buff_str,OBJPROP_XDISTANCE,DisplayStarts_X + (NoOfPeriods-1-j)*(FontSize*2));
                ObjectSet(buff_str,OBJPROP_YDISTANCE,DisplayStarts_Y);
                ObjectSetText(buff_str,TradePeriod[j],FontSize-2,Font_Font,FontColour);      
        }
        //Set Trade Trend
        for(i=0; i<NoOfPairs; i++)
        {
                for(j=0; j<NoOfPeriods; j++)
                {
                        buff_str = StringConcatenate(objPrefix, TradePair[i], TradePeriod[j]);
                        ObjectDelete(buff_str);
                        ObjectCreate(buff_str,OBJ_LABEL,WindowNo,0,0,0,0);
                        ObjectSet(buff_str,OBJPROP_CORNER,1);
                        ObjectSet(buff_str,OBJPROP_XDISTANCE,DisplayStarts_X + (NoOfPeriods-1-j)*(FontSize*2));
                        ObjectSet(buff_str,OBJPROP_YDISTANCE,DisplayStarts_Y + (i+1)*(FontSize+FontSize/2));
                        ObjectSetText(buff_str,CharToStr(TradeTrendSymbol[i][j]),FontSize,"Wingdings",TradeTrendColor[i][j]);
                }
        }
//----
        return(0);

}//End PrintPairTrends()




 
vvm-55:

provide a click-able link.

It seems does not work by me.

Let me try https://www.forexfactory.com/showthread.php?p=4127792#post4127792


But it is possible too

to copy the link and insert in the browser 

Of course but not everyone will do that.
 
vvm-55:

Thanks for replay,

you are right and your answer is correct.

This code does its job well:

and make an ALLERT after as this function returns -1.

But it does not solve my problem....

After new start MT4 does not know the name of RSI_WondowName

and can't find my RSI-Indicator.

This is the problem.

it's =-1 after reboot of MT4.


Because the indicator window is not yet created. You need to check and place your code to be executed when you are sure the window is created.

Also I suggest you to use ChartWindowFind() instead of WindowFind().

 

is it correect?

      window=ChartWindowFind(0,RSI_WindowName);
      if(window==-1) Print(__FUNCTION__+"(): Error = ",GetLastError());
     }
//---
   return(window);
Reason: