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 wftrrdt, Today, 05:01 AM
    0 responses
    2 views
    0 likes
    Last Post wftrrdt
    by wftrrdt
     
    Started by wellbeingcbd, Today, 04:41 AM
    0 responses
    1 view
    0 likes
    Last Post wellbeingcbd  
    Started by piydasuknu, Today, 03:45 AM
    0 responses
    3 views
    0 likes
    Last Post piydasuknu  
    Started by ajdfkgjiojjhfihjg, Today, 03:20 AM
    0 responses
    3 views
    0 likes
    Last Post ajdfkgjiojjhfihjg  
    Started by keravitahere, Today, 01:56 AM
    0 responses
    2 views
    0 likes
    Last Post keravitahere  
    Working...
    X