Bug?: ObjectSetText() creates text on all time frames

Bug reports and errors in the program
Message
Author
Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

Bug?: ObjectSetText() creates text on all time frames

#1 Postby Wessel » Wed Feb 16, 2011 7:46 am

Hi,

Using the following code ( C++ API 1.10 ):

Code: Select all

   if( !ObjectExists(objName) )
   {
      ObjectCreate(objName, obj_Text, 0, Time(0), value );
      std::stringstream t;
      t << "  "  << text << " " << setiosflags(ios::fixed) << setprecision( precision ) << value;
      ObjectSetText(objName, t.str(), fontSize, "Tahoma", color);
      ObjectSet(objName, OBJPROP_VALIGNMENT, tlCenter);
      ObjectSet(objName, OBJPROP_HALIGNMENT, taLeftJustify);
   } else {

      std::stringstream tt;
      tt << "  " << text << " " << setiosflags(ios::fixed) << setprecision( precision ) << value;
      ObjectSetText(objName, tt.str(), fontSize, "Tahoma", color);
      ObjectSet(objName,OBJPROP_TIME1, Time(0) );
      ObjectSet(objName,OBJPROP_PRICE1, value );   
   }

Creates text on the chart, however this text appears on all time frames and not just on the time frame where the object was created for.
This looks inconsistent with how all the indicators work on a single time frame.

How to avoid this behavior? Or is this a bug that text objects appear on all time frames


Wessel[/i]

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#2 Postby FT Support » Wed Feb 16, 2011 8:59 am

Hello Wessel,

This is not a bug. Objects are displayed on all timeframes.

We cannot display indicators on all timeframes because we have to re-count them every time but the objects do not need any re-calculations so they can be displayed everywhere.
Check our other product here:
http://www.forexcopier.com

Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

#3 Postby Wessel » Wed Feb 16, 2011 5:39 pm

Thanks for the reply, I've still a problem, please assist

How can I avoid the following problem.

I have an indicator that create text objects (Pivot point names + value) and it is running in time frame H1. Now if I go to the daily time frame and I run the indicator there as well with different settings all the text object will mix up giving a mess.

How can I prevent text objects from being printed on other time frames ?
1. Can I detect a "switch away from this time frame" so i can delete all text objects ?
2. Do I need to create a garbage collector indicator that will clean up my charts as soon as objects from other time frames are still floating around?
3. Other solutions I could do to keep my other time frames clean from textobjects ?

Please Help me out on this :-)

Attached is an example
Attachments
2-16-2011 11-34-40 PM.png
Ghosting of text objects
2-16-2011 11-34-40 PM.png (98.65 KiB) Viewed 10150 times

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#4 Postby FT Support » Fri Feb 18, 2011 3:58 am

Hello Wessel, sorry but objects cannot be timeframe-specific.
Anyway there is one solution, you can use canvas to draw your own objects or whatever you want on the chart.
I do not know how to do this in C++ but please see Delphi example attached.
Attachments
WorkTimeExample.zip
(1.04 KiB) Downloaded 262 times
Check our other product here:
http://www.forexcopier.com

Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

#5 Postby Wessel » Mon Feb 21, 2011 6:11 pm

Thanks!

That sure helps!, I understand both Delphi and C++ so I will find my inspiration on your example :D


Wessel

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#6 Postby FT Support » Tue Feb 22, 2011 7:37 am

Great!

Can you please add Canvas support into your C++ API if it is possible?
Check our other product here:
http://www.forexcopier.com

Wessel
Posts: 63
Joined: Tue Oct 12, 2010 6:45 pm

#7 Postby Wessel » Tue Feb 22, 2011 2:48 pm

Sure NP,
I have updated some other parts from it as well recently. Beside strings all the fucntions which use text can also use now stringstreams which makes it all so much easyer to use.

About the canvas, I do need a hook for it to be able to use it. I'll drop you an email when I dive into it.

Wessel

FT Support
Posts: 905
Joined: Sat Jul 11, 2009 10:54 am

#8 Postby FT Support » Tue Feb 22, 2011 6:14 pm

Thank you Wessel!
Check our other product here:
http://www.forexcopier.com


Return to “Bug reports”

Who is online

Users browsing this forum: No registered users and 1 guest