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 benmarkal, Yesterday, 12:52 PM
    3 responses
    22 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by helpwanted, Today, 03:06 AM
    1 response
    18 views
    0 likes
    Last Post sarafuenonly123  
    Started by Brevo, Today, 01:45 AM
    0 responses
    11 views
    0 likes
    Last Post Brevo
    by Brevo
     
    Started by aussugardefender, Today, 01:07 AM
    0 responses
    6 views
    0 likes
    Last Post aussugardefender  
    Started by pvincent, 06-23-2022, 12:53 PM
    14 responses
    244 views
    0 likes
    Last Post Nyman
    by Nyman
     
    Working...
    X