How to Draw label Start at Chart shift

 

I want to draw Drow label Start at Chart shift. haw can i get pixel coordinate ?

Or can i move a group of label with mouse...?

thank for your help

 

putr a label on your chart, place it where you want it

Open the objects list, select the object and edit, then you can read the co-ordinates and so you will know what to put in your code

 
GumRai I mean automatic way in EA
 
Repions:
GumRai I mean automatic way in EA


You asked "how can i get pixel coordinate" ?

If your chart shift is always the same, then that will be a way to get the co-ordinates to enter in the code.

"Or can i move a group of label with mouse...?"

If your code checks the position of a single label using

ObjectGet( string name,OBJPROP_XDISTANCE)

Then if you move the label with your mouse, you can write your code to change the X co-ordinate on all the others

 
GumRai:


You asked "how can i get pixel coordinate" ?

If your chart shift is always the same, then that will be a way to get the co-ordinates to enter in the code.

"Or can i move a group of label with mouse...?"

If your code checks the position of a single label using

ObjectGet( string name,OBJPROP_XDISTANCE)

Then if you move the label with your mouse, you can write your code to change the X co-ordinate on all the others

I want if i maxim chart (F11) label will self align. at close(0) or time(0)

Ok Thanks anyway.....

 
Repions:

I want if i maxim chart (F11) label will self align. at close(0) or time(0)

Ok Thanks anyway.....


Get the width of the chart in pixels (search the forum), get the number of bars across the chart using WindowsBarsPerChart() then get WindowFirstVisibleBar() and subtract one from the other, you now have the number of bars on the chart allowing for chart shift, now using simple ratios (BarsPerChart and bars on the chart allowing for chart shift) and the width of the chart in pixels you can calculate the position of bar 0 in pixels . . . approximately.


or you could simply use a TEXT Object at Time[0]
 
RaptorUK:
Get the width of the chart in pixels (search the forum), get the number of bars across the chart using WindowsBarsPerChart() then get WindowFirstVisibleBar() and subtract one from the other, you now have the number of bars on the chart allowing for chart shift, now using simple ratios (BarsPerChart and bars on the chart allowing for chart shift) and the width of the chart in pixels you can calculate the position of bar 0 in pixels . . . approximately.


or you could simply use a TEXT Object at Time[0]

TEXT Object does not fit with my goals

Ok thanks...i'll try...

 
Repions:
TEXT Object does not fit with my goals

Ok thanks...i'll try...



then show your goals with picture to make it clear what you like to code
 
deVries:

then show your goals with picture to make it clear what you like to code

in full scr i must move manualy.

My goal / hope this info like sit in sparate window clean & clear, sit in right chat shift automatically



 
        
string yourtext = "Example";
//using strRepeat       
strRepeat(" ",StringLen(yourtext)+1)+yourtext   //to the right     
        
//+-------------------------------------------------------------------------------------------+
//| Subroutine: Returns string expression (s) repeated (n) times                              |                                                        
//+-------------------------------------------------------------------------------------------+
string strRepeat(string s, int n)
{
   string result = "";
   for(int i=0; i<n; i++) {result = result + s;}
   
   return(result);
}
 
// --------------------------------------------------------------------------------------------        

if you add the stringlength+1 to the string then you can get the text starting at the left or the right side of the candle in this case

to the left or right of Time[0]

 

deVries I did not catch your point

I use the label, instead of text
I need a pixel instead of char

for now I use GetWindowRect() in user32.dll, its run like I intent to

I would change if there is a way without dll import

Thanks deVries,,,RaptorUK

Now... i need to Beautify and clarify the information by giving different solid backgrounds color than Chart background.

any idea ....? ..please...

Reason: