NexusFi: Find Your Edge


Home Menu

 





Null check indicator ideas for NT8


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 
Sim22's Avatar
 Sim22 
Australia
 
Experience: Intermediate
Platform: NinjaTrader, MarketDelta
Trading: 6J, CL, GC
Posts: 43 since May 2010
Thanks Given: 53
Thanks Received: 123

One day I just had the sh*ts with NT8 having brush freezing/disposal issues when left idle for a while ie. possible multi-threading issues.
I decided to write some extension methods that might help with this. (Warning: these are not thoroughly tested!)

eg.

 
Code
                            
// normal code for freezing a brush
Brush myBrush Brushes.Red;
myBrush.Freeze(); 
I've written an extension that checks it for null before freezing it:

 
Code
                            
// extension code instead
Brush myBrush Brushes.Red;
myBrush.NotNullFreeze(); 
Also disposal of SharpDx objects:

 
Code
                            
SharpDx.Direct2D.Brush myBrushDx;

// Dispose by
if(myBrushDx != null)
      
myBrushDx.Dispose();

//Extension instead
myBrushDx.NotNullDispose(); 
I've also created an opacity extension:

 
Code
                            

Brush myBrush 
Brushes.Red;

myBrush myBrush.ChangeOpacity(int Opacity); // or double Opacity
myBrush.NotNullFreeze(); 
You can also use the 'NotNull' extension to check for null values within Linq statements. Please peruse the actual indicator for some ideas. You will find the extensions within the Addons folder called Sim22BrushExtensions and Sim22NotNullExtensions. The actual indicator does nothing, it's just for the code: Sim22_NullSample.

You need to make sure in the declarations you set: using Sim22BrushExtensions; using Sim22NotNullExtensions;

I'd appreciate anyone having a play and suggesting ideas. I won't be able to answer for a few days so I hope I wake to find some interesting comments


Attached Files
Elite Membership required to download: Sim22_NullSampleNT8.0.2Jan2017.zip
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
$500M Riding on World Cup 2026: France/Spain Co-Favored …
Prediction Markets & Event Contracts
Six Days to Kickoff: World Cup Prediction Markets Hit $1 …
Prediction Markets & Event Contracts
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
Four New E-mini Futures Launch June 29 -- Russell 3000, …
Emini and Emicro Index
Hormuz Surges From 14% to 26.5% Intraday as Irans Answer …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks




Last Updated on January 1, 2017


© 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