Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Draw.Text causes System Access Violation Exception and crashes NT8

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Draw.Text causes System Access Violation Exception and crashes NT8

    I get a the following exception that crashes NT8:

    An unhandled exception of type 'System.AccessViolationException' occurred in SharpDX.Direct2D1.dll

    I am working on an expanded price alert indicator and I think it may be related to the Draw.Text function I am using to update a price label on my horizontal line.

    I have it set to update every 200ms according to a timer elapsed event. It works great and it follows the line when it is moved by the user. But I have been noticing more crashes of this type since I added this feature.

    Every 200ms I do:

    Code:
    private void setPriceLevelLabel()
    {
    	if (ShowPriceMarker)
    	{
    		SimpleFont font =  new SimpleFont("Courier New", 12) { Size = PriceMarkerTextSize, Bold = true };
    		
    		Draw.Text(
    			this, 
    			"PriceMarker",
    			true,
    			Instrument.MasterInstrument.RoundToTickSize(currentPrice).ToString(),
    			PriceMarkerBarsAgo,
    			currentPrice,
    			(PriceMarkerPlacement == AboveOrBelow.Above ? 17 : -7),
    			PriceMarkerTextColor,
    			font,
    			TextAlignment.Left,
    			Brushes.Transparent,
    			Brushes.Transparent,
    			100).ZOrder = PriceMarkerZOrder == BackOrFront.Back ? -1 : ZOrder;
    	}
    }
    Is this bad practice?

    #2
    Hello Iridium237,

    Thank you for writing in.

    Can you please provide your script or a sample script that replicates this behavior so I may test on my end?

    To export a script from NinjaTrader 8, please follow the instructions below:

    1. From the Control Center window select the menu Tools > Export > NinjaScript... to open the "Export NinjaScript" dialog window

    2. Press "add"

    3. Use the "Type" drop down to filter available NinjaScript types

    4. Select all of the files that you want to export and press the "OK" button

    5. A list of all files that will be exported will be shown

    6. Press the "Export" button to export the selected files

    7. A NinjaScript Archive File (.zip) file will be created in My Documents\<NinjaTrader Folder>\bin\Custom\ExportNinjaScript. You can press ".." and change the export directory if you wish
    Zachary G.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    669 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    378 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    111 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    580 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X