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,692 views
    2. thumb_up 1 thanks given
    3. group 0 followers
    1. forum 2 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 tulanch 
Salt Lake City, UT
 
Experience: Intermediate
Platform: SC, NT, MT
Broker: AMP
Trading: NQ ES YM Bonds
Posts: 285 since Mar 2010
Thanks Given: 51
Thanks Received: 404

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?
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
After $87M Settles NO: Irans Nuclear Redline Sets Up the …
Prediction Markets & Event Contracts
Coinbase Launches Regulated Crypto Futures Across 26 Eur …
Cryptocurrency
BofA Projects $1.1 Trillion in Sports Event Contracts -- …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Lady Vols Primer: Trading Volatility Journal
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,550 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,430


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


© 2026 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 - Downloads - Top
no new posts