Blurred text using Text_Float  [SOLVED]

Questions about MultiCharts and user contributed studies.
arjfca
Posts: 1282
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Blurred text using Text_Float

Postby arjfca » 07 Nov 2013

Hello

This is a continuation from my latest post about how to put text at a fix location on the screen
viewtopic.php?f=1&t=45607&p=99623#p99588

Problem has been partially resolve. Now, neatly every time I select a chart from a workspace, the Teext line is blurred ( not sure if it is the apprpiate word) all mess up. The String will be replace OK after I select another scale

Also, If I play with the price scale, the Text_Float create a 2' indicator link on the chart.
It look like MC can't follow and leave actual link while creating a new one.

The code is the first lines inside a bigger indicator.

I did try to remove Text_Style, Text_Size, Text_Color but the problem remained.

My PC fast enough so the problem is not material.

Any idea

Code: Select all

If lastbaronchart then begin
   Spread = (insideask -insidebid) ;
   If jpy_pair = true then spread = spread *100 else spread = spread *10000;
   SpreadText ="Spread: " + NumtoStr(Spread ,2);

        SpreadtextLine = Text_New_s (0,0,0, Spreadtext);
  //   Text_setStyle(SpreadtextLine,1,2);
   Text_SetSize(SpreadtextLine, 10);
   Text_setcolor(SpreadtextLine, blue);
   value2 =Text_float (SpreadTextLine,15,100);   
 end;
Attachments
Spread_3.png
Spread_3.png (48.76 KiB) Viewed 573 times
spread_2.png
spread_2.png (39.06 KiB) Viewed 569 times

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1527 times
Been thanked: 1502 times
Contact:

Re: Blurred text using Text_Float

Postby JoshM » 07 Nov 2013

I think this is because you use Text_New_s, which will make multiple text objects on the specified bar. If you only use Text_New_s once (for example when CurrentBar == 1), then you can use Text_SetLocation to move your initial text object when the chart updates.
These users thanked the author JoshM for the post:
arjfca

arjfca
Posts: 1282
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: Blurred text using Text_Float

Postby arjfca » 07 Nov 2013

JoshM wrote:I think this is because you use Text_New_s, which will make multiple text objects on the specified bar. If you only use Text_New_s once (for example when CurrentBar == 1), then you can use Text_SetLocation to move your initial text object when the chart updates.


Understand your point, but Text_Float doesn't seem to work if not using Text_New on every pass

Code: Select all

Once begin
   SpreadtextLine = Text_New_s (0,0,0, Spreadtext);
   Text_setStyle(SpreadtextLine,1,2);
   Text_SetSize(SpreadtextLine, 10);
   Text_setcolor(SpreadtextLine, blue);
   print ("TextL: ",spreadtextline:0:0);
end;

If lastbaronchart then begin
   //SpreadtextLine = Text_New_s (0,0,0, Spreadtext);
         Spread = (insideask -insidebid) ;
   If jpy_pair = true then spread = spread *100 else spread = spread *10000;
   SpreadText ="Spread: " + NumtoStr(Spread ,2);      
   print ("TextL_2: ", spreadtextline:0:0);
   Text_SetLocation(SpreadTextLine,0,0,1);
   value2 =Text_float (SpreadTextLine,15,100);   
 end;


Martin

User avatar
JoshM
Posts: 2099
Joined: 20 May 2011
Location: The Netherlands
Has thanked: 1527 times
Been thanked: 1502 times
Contact:

Re: Blurred text using Text_Float

Postby JoshM » 07 Nov 2013

arjfca wrote:Understand your point, but Text_Float doesn't seem to work if not using Text_New on every pass

Ah okay. I've never used Text_Float - I always used aiHighestDispValue and aiLowestDispValue and then used these values to update the existing text box. Perhaps others can explain what the Text_Float function does.

arjfca
Posts: 1282
Joined: 23 Nov 2010
Has thanked: 724 times
Been thanked: 222 times

Re: Blurred text using Text_Float

Postby arjfca » 07 Nov 2013

Ah okay. I've never used Text_Float - I always used aiHighestDispValue and aiLowestDispValue and then used these values to update the existing text box. Perhaps others can explain what the Text_Float function does.

Redo the code

Code: Select all

Once begin
   SpreadtextLine = Text_New_s (0,0,0, Spreadtext);
      Text_setStyle(SpreadtextLine,1,2);
   Text_SetSize(SpreadtextLine, 10);
   Text_setcolor(SpreadtextLine, blue);
   print ("TextL: ",spreadtextline:0:0);
end;

 If lastbaronchart then begin
   Spread = (insideask -insidebid) ;
   If jpy_pair = true then spread = spread *100 else spread = spread *10000;
   SpreadText ="Spread: " + NumtoStr(Spread ,2);
   HighLocation = GetAppInfo( aiHighestDispValue ) ;
   text_setstring(SpreadtextLine,Spreadtext);
   text_setlocation_s(spreadTextLine,date,time_s,highLocation);
 end;


Much nicer.. Thanks Josh
Martin

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

Re: Blurred text using Text_Float  [SOLVED]

Postby SP » 07 Nov 2013

Martin,

to reduce calculations you can use barstatus (1) = 2, you dont need to calculate the aiHighestDispValue location every tick.

Code: Select all

if barstatus (1) = 2 then
begin
HighLocation = GetAppInfo( aiHighestDispValue ) ;
text_setlocation_s(spreadTextLine,date,time_s,highLocation);
end;
These users thanked the author SP for the post (total 3):
TJarjfcasptrader


Return to “MultiCharts”