Text separate window - Doesn't show text when started only after changing once timeframe

 

Hello, I wrote an indicator text based, no lines, no graph, a separate window like iExposure.mq4 using 

#property indicator_separate_window


, in fact I started from that indicator to build mine and I noticed that iExposure does the same thing, nothing appear until i change time frame.

My problem is that once I launch the indicator, nothing happen but once i change time frame, it start working like the iExposure indicator that come with all MT4.

What I do is Create Object, set x,y distance and variable to show , some thing like this very similar to iExposure:

for(col=0; col<11; col++)
        {
         name="cap_"+string(col);
         ObjectCreate(name,OBJ_LABEL,windex,0,0);
         ObjectSet(name,OBJPROP_XDISTANCE,ExtShifts[col]);
         ObjectSet(name,OBJPROP_YDISTANCE,ExtVertShift2);
         ObjectSetText(name,ExtCols[col],9,"Arial",InpColor);          
        }


and the program is inside OnCalculate

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
 
{

I hope you understand what is happening to me and

Thank You.

 
Simo Dodero:

Hello, I wrote an indicator text based, no lines, no graph, a separate window like iExposure.mq4 using 


, in fact I started from that indicator to build mine and I noticed that iExposure does the same thing, nothing appear until i change time frame.

My problem is that once I launch the indicator, nothing happen but once i change time frame, it start working like the iExposure indicator that come with all MT4.

What I do is Create Object, set x,y distance and variable to show , some thing like this very similar to iExposure:


and the program is inside OnCalculate

I hope you understand what is happening to me and

Thank You.

Hello,

https://www.mql5.com/en/docs/objects

MQL5 has ChartRedraw()  MQL4 has WindowRedraw() as well

Documentation on MQL5: Object Functions
Documentation on MQL5: Object Functions
  • www.mql5.com
The functions defining the properties of graphical objects, as well as ObjectCreate() and ObjectMove() operations for creating and moving objects along the chart are actually used for sending commands to the chart. If these functions are executed successfully, the command is included in the common queue of the chart events. Visual changes in...
 
Simo Dodero:
No idea ??

Post your code if you want coding help. All the relevant code, not useless snippets.

My problem is that once I launch the indicator, nothing happen but once i change time frame, it start working like the iExposure indicator that come with all MT4.

For your information, iExposure is "working" as soon as you attach it to a chart, not need to change timeframe or whatever (in normal conditions, online chart, market open).

 
Put ChartRedraw() or WindowRedraw() after all Object Functions. After all Object functions means also off for loop
 
Demos Stogios:

Hello,

https://www.mql5.com/en/docs/objects

MQL5 has ChartRedraw()  MQL4 has WindowRedraw() as well

Thank You !!


When I wrote "no idea?" I didn't see your reply !! ( few minutes ago I was relaxing and I thought about this option !!


No need to post all my code because it's private Indicator I would like to sell and I wrote above it happen the same that iExposure indicator and that I started programming mine observing iExposure so if you want a code check iExposure.mq4

 
Alain Verleyen:

Post your code if you want coding help. All the relevant code, not useless snippets.

For your information, iExposure is "working" as soon as you attach it to a chart, not need to change timeframe or whatever (in normal conditions, online chart, market open).

Not for me and other person I asked, he told me it happen the same: once launched nothing appears...


Anyway I will try with CharRedraw() or WindowRedraw() as commented by Demos Stogios

 
Simo Dodero:

Not for me and other person I asked, he told me it happen the same: once launched nothing appears...


Anyway I will try with CharRedraw() or WindowRedraw() as commented by Demos Stogios


Well, I tried to put ChartRedraw() and/or WindowRedraw() in any places of my indicator and nothing changed, but as I found the function  WindowIsVisible() and i put the following code in 

int OnInit() { 

  int maywin=WindowFind("MyMACD");
  if(maywin>-1 && WindowIsVisible(maywin)==true)
    Print("window of MyMACD is visible");
  else
    Print("window of MyMACD not found or is not visible");


          }

it immediately start showing the objets (label type) of the indicator. (I changed the variables with mine, like the name of variable and string. (I removed all the ChartRedraw() and WindowRedraw() too )

Another change that I did and I will check if it could be the reason of this issue is changing the name of the IndicatorShortName from "Money Manager 2.0" in "MoneyManager" the equivalent of "MyMACD" in the code above because I thought spaces or dot could create problem as string.


I'm really happy because the indicator works great and at the moment this was my only problem ! (this is my first indicator, usually I program EA)


Thank You again !!

 
Simo Dodero:


Another change that I did and I will check if it could be the reason of this issue is changing the name of the IndicatorShortName from "Money Manager 2.0" in "MoneyManager" the equivalent of "MyMACD" in the code above because I thought spaces or dot could create problem as string.

No, the name, the string for IndicatorShortName is not a problem if it contains spaces or dot .

Reason: