NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 07-12-2007, 09:02 AM   #1
JangoFolly
Member
 
Join Date: Nov 2006
Location: , ,
Posts: 73
Thanks: 0
Thanked 0 times in 0 posts
Default RemoveDrawObject not working in real time

Hi. When I use the RemoveDrawObject function to remove a specific drawing (the tag value is definitely unique -- it's generated using the current bar value plus a static text string), it doesn't work in real time (i.e., if I refresh the indicator the drawings that should have been deleted do disappear).

The indicator updates on every tick. The drawings are placed on the chart if a certain set of conditions are met, and once drawn on the chart a flag is set to true to note that the drawing exists. A separate variable continues to track whether or not the conditions still apply with each incoming tick.

On the first tick of the next bar (before the condition flag and drawing existence flags are reset for the new bar), there is a check of the condition flag and the drawing existence flag. If the conditions were not met on the last tick of the previous bar and the flag for the existence of a drawing is true, then the RemoveDrawObject() function is called for that specific tag ID (e.g., RemoveDrawObject("entryTag")). I added a Print to confirm that I'm reaching the conditional code block which contains the remove function.

Is there something obvious that I might be doing wrong, or are you aware of any bugs with this function? Again, when I refresh the indicator, objects are correctly removed.

Thank you.


Regards,
JangoFolly is offline  
Reply With Quote
Old 07-12-2007, 09:27 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,164
Thanks: 6
Thanked 46 times in 32 posts
Default

This method is behaving as expected. I can't see at first glance what you may be doing wrong but there must be a logic flaw somewhere.

See my test indicator that demonstrates functionality in real-time. Run it on a 10 second chart to see. Import via File > Utilities > Import.
Attached Files
File Type: zip DrawTest.zip (1.5 KB, 26 views)
NinjaTrader_Ray is offline  
Reply With Quote
Old 07-12-2007, 10:13 AM   #3
JangoFolly
Member
 
Join Date: Nov 2006
Location: , ,
Posts: 73
Thanks: 0
Thanked 0 times in 0 posts
Default

Thanks for the example, Ray. I figured out my mistake.


Regards,
JangoFolly is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Real-time Marketh Depth Indicator Reference Sample NinjaTrader_Ray Indicator Development 17 11-29-2011 02:21 AM
TRIN, TICK charts not updating in real time Brightstar Charting 13 09-20-2011 09:20 AM
Trade Angle Strategies Launches Real-time Trading Software on NinjaTrader Platform NinjaTrader_Ray News and Announcements 0 06-20-2007 02:55 PM
Backfilling Forex Real-Time Charts with Historical Data JohnL Connecting 4 05-24-2007 11:42 AM
Real trading with NT cody Miscellaneous Support 1 03-14-2005 12:16 PM


All times are GMT -6. The time now is 08:28 PM.