NexusFi: Find Your Edge


Home Menu

 





Null check indicator ideas for NT8


Discussion in NinjaTrader

Updated
    1. trending_up 1,571 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?
Pakistan Mediator in Tehran as Hormuz Normalization Coll …
Prediction Markets & Event Contracts
UMA Votes Tonight: Polymarkets $80M Strategy Bitcoin Bat …
Prediction Markets & Event Contracts
Penalties in Budapest, Peace Deadline in Tehran: Arsenal …
Prediction Markets & Event Contracts
April FOMC Minutes: Most Divided Fed Since 1992 -- Many …
Traders Hideout
Saylors 41-Month HODL Breaks: Strategy Sells 32 BTC as $ …
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
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Trying to learn Volume and price action correlation
5 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