deleting created objects ??

How to create strategies and indicators
Message
Author
fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

deleting created objects ??

#1 Postby fx_pete » Fri Feb 03, 2012 5:50 pm

Don't I need to delete all objects that I create??

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#2 Postby dackjaniels » Fri Feb 03, 2012 5:53 pm

You should yes.

fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

hmm....

#3 Postby fx_pete » Fri Feb 03, 2012 8:46 pm

the API examples don't do that and I was wondering why? Is there some clean-up going on behind the scenes? I figure that this is something that should be done in the Reset routine along with other memory cleanup.

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#4 Postby dackjaniels » Fri Feb 03, 2012 9:09 pm

I think my answer was a little knee-jerk. I believe there are certain instances when you should delete the objects you create, such as when an indicator draws lots of objects on screen it should really clean up after itself and delete the objects when it is removed from the chart.

There are times when it's not needed. For instance, I just created a strategy that draws some objects. Whenever the strategy is re-started using the toolbar stop/start button all of the objects are automatically deleted so in this case I see no need to do it in code.

As far as memory allocation is concerned I would expect that in those instances where FT clears the objects from the screen it also clears them from memory.

fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

thanks for the replies ...

#5 Postby fx_pete » Sat Feb 04, 2012 3:38 am

is there some documentation about how the API/FX Tester handles this? I mean I would like to know under what instances I have delete the objects I create and under which I dont. I don't want to be springing leaks all over the place :?

dackjaniels
Posts: 151
Joined: Tue Feb 24, 2009 1:03 pm

#6 Postby dackjaniels » Sat Feb 04, 2012 5:49 am

None that I remember seeing but FT Support should be able to answer the question.

fx_pete
Posts: 17
Joined: Mon Jan 30, 2012 2:31 pm

hmmm

#7 Postby fx_pete » Sun Feb 05, 2012 2:20 pm

I guess FT support is on hollidays :roll:

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

#8 Postby FT Support » Mon Feb 06, 2012 12:25 pm

When you create some object on charts it becomes a separate instance which is not associated with your indicator. So the object lives its own life and if you want the chart to stay clean after you remove the indicator then you have to delete your objects in "Done" procedure.

You can use some prefixes/suffixes in object names to distinguish your objects from other ones.
Check our other product here:
http://www.forexcopier.com


Return to “FT API”

Who is online

Users browsing this forum: No registered users and 12 guests