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 futtrader, 04-21-2024, 01:50 AM
    4 responses
    41 views
    0 likes
    Last Post futtrader  
    Started by Option Whisperer, Today, 09:55 AM
    1 response
    11 views
    0 likes
    Last Post bltdavid  
    Started by port119, Today, 02:43 PM
    0 responses
    3 views
    0 likes
    Last Post port119
    by port119
     
    Started by Philippe56140, Today, 02:35 PM
    0 responses
    4 views
    0 likes
    Last Post Philippe56140  
    Started by 00nevest, Today, 02:27 PM
    0 responses
    2 views
    0 likes
    Last Post 00nevest  
    Working...
    X