NexusFi: Find Your Edge


Home Menu

 





Any way to instantly render Graphics.DrawRectangle and retain previous rectangles?


Discussion in NinjaTrader

Updated
    1. trending_up 1,174 views
    2. thumb_up 1 thanks given
    3. group 0 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread

Any way to instantly render Graphics.DrawRectangle and retain previous rectangles?

  #1 (permalink)
 tulanch 
Salt Lake City, UT
 
Experience: Intermediate
Platform: SC, NT, MT
Broker: AMP
Trading: NQ ES YM Bonds
Posts: 265 since Mar 2010
Thanks Given: 50
Thanks Received: 387

I am creating an indicator that is DOM like which displays on the right side of a chart

I am using graphics.DrawRectangle and graphics.DrawString to accomplish the display

But as time goes on the number of items to draw will increase

I am concerned it will start to consume far too much CPU

Is there a way to use these draw methods to instantly draw on the screen, not just on a refresh? This way only the newest graphics is rendered, instead of the needing to run through the my entire display graphics entity list again.

For example at price Y draw a box with the price in it at x = xlocation

when price changes to Y + 1 tick, draw another box above the previous box (at new price level )but still at x = xlocation

As my code is today, I need to draw 2 boxes when price changes.

I want to draw just 1 to reduce CPU impact

I would only draw 2 if a full refresh occurs (such as when F5 is pressed)

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Increase in trading performance by 75%
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
GFIs1 1 DAX trade per day journal
16 thanks
My NQ Trading Journal
14 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #3 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


The impact is minimal for the low level direct draw routines, you can draw hundreds with little impact, and also remember that the Plot routine is typically called at user speed (e.g. 0.4/0.5s) so it's not a big deal.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on November 1, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts