ObjectSetText problem - page 2

 
zaffrono:
I appreciate if you or anyone else could change my code and show me what I did wrong. Thank you.

Already done . . . look a few posts back.

By the way . . . . I haven't tested or even compiled it.

 
zaffrono:
Please note that the quotation "looks like it wont support" is by jpbiznes not me. I have provided the code on top of the page and Raptor said "Draw a second label underneath the first." which I did but it is not working. I have shown my code on top, so I appreciate if you or anyone else could change my code and show me what I did wrong. Thank you.

Hi Zaffrono,

I now see the quote is from jpbiznes. I just missed the name. No worries mate.

In any case, Raptor gave you the biggest clue about needing to use the ObjectCreate for each label.

And I just gave you the 2nd clue - make each text label in it's own section...

Try it out yourself and it should work. We are here to help others learn, not do the work for them.

However, if you like, you can always find someone and pay them to do it for you.

Hope this helps,

Robert

PS - Raptor is quick in his replies...he just provided you a great example of how to do two text labels. Hope it solves your questions.

 
cosmicbeing:

Hi Zaffrono,

I now see the quote is from jpbiznes. I just missed the name. No worries mate.

In any case, Raptor gave you the biggest clue about needing to use the ObjectCreate for each label.

And I just gave you the 2nd clue - make each text label in it's own section...

Try it out yourself and it should work. We are here to help others learn, not do the work for them.

However, if you like, you can always find someone and pay them to do it for you.

Hope this helps,

Robert

PS - Raptor is quick in his replies...he just provided you a great example of how to do two text labels. Hope it solves your questions.


Thank you giving me clue. However, I am new to MQL4 programming and clues are very difficult to understand as far as I am concerned. I would appreciate it if anyone here who has the idea how to solve my problem show me what was wrong with my code. Please do not post clues. After all this is Forum for People to learn actual programming not clues., otherwise, they should call this forum MQL4 clues. I do apologize for my frustration, but, I hope some guy with big heart to show me and many other small traders the solution.




 
zaffrono:

Thank you giving me clue. However, I am new to MQL4 programming and clues are very difficult to understand as far as I am concerned. I would appreciate it if anyone here who has the idea how to solve my problem show me what was wrong with my code. Please do not post clues. After all this is Forum for People to learn actual programming not clues., otherwise, they should call this forum MQL4 clues. I do apologize for my frustration, but, I hope some guy with big heart to show me and many other small traders the solution.

I already gave you the code . . . read a few posts backwards . . .

 

This is Raptor's code, tweaked a bit as an indicator ...

#property indicator_chart_window

extern int word_size = 14;
extern color word_color = Yellow;
   
int init(){

   int right_left = 0;
   string disp_price;
   int x_distance = 450;
   int y_distance = 5;

   ObjectDelete("word");
   ObjectDelete("word1");

   ObjectCreate("word", OBJ_LABEL, 0, 0, 0);
   ObjectSet("word", OBJPROP_CORNER, right_left);
   ObjectSet("word", OBJPROP_XDISTANCE, x_distance);
   ObjectSet("word", OBJPROP_YDISTANCE, y_distance);

   ObjectCreate("word1", OBJ_LABEL, 0, 0, 0);
   ObjectSet("word1", OBJPROP_CORNER, right_left);
   ObjectSet("word1", OBJPROP_XDISTANCE, x_distance);
   ObjectSet("word1", OBJPROP_YDISTANCE, y_distance + word_size +3);

   return(0);
  }
//--------------------------------------------------------------------------------
int deinit(){
   ObjectDelete("word");
   ObjectDelete("word1");
   return(0);
}
//--------------------------------------------------------------------------------
int start(){
   string comment=StringConcatenate("You have ",OrdersTotal()," open trades.");
   ObjectSetText("word", comment, word_size, "Times New Roman", word_color);

   string comment1=StringConcatenate("ASK= ",DoubleToStr(Ask, Digits),"   BID= ",DoubleToStr(Bid, Digits));                 //  <--- Ask & Bid
   ObjectSetText("word1", comment1, word_size, "Times New Roman", word_color);

   return(0);
}

Notice formatting of precision of Ask and Bid,

spacing second label using word_size

clean up when finished

use extern variables to allow user adjustment with recompile


The above code has been compiled and tested.

 
Thank you. Thank you and thank you very much for your help and helping us small and new traders to the world of MQL4.