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,788 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: 405

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?
Iran Forward Curve: June 30 at 56% vs June 15 at 28% -- …
Prediction Markets & Event Contracts
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
Hormuz Normalization Collapses to 19.5% -- Iran Regime F …
Prediction Markets & Event Contracts
CME Raises Energy Futures Margins After Iran-War Volatil …
Commodities
The June 15 Resolution Trap: Irans Agreed Text Still Pri …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
13 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 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,427


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