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 Balage0922, Today, 07:38 AM
    0 responses
    5 views
    0 likes
    Last Post Balage0922  
    Started by JoMoon2024, Today, 06:56 AM
    0 responses
    6 views
    0 likes
    Last Post JoMoon2024  
    Started by Haiasi, 04-25-2024, 06:53 PM
    2 responses
    19 views
    0 likes
    Last Post Massinisa  
    Started by Creamers, Today, 05:32 AM
    0 responses
    6 views
    0 likes
    Last Post Creamers  
    Started by Segwin, 05-07-2018, 02:15 PM
    12 responses
    1,786 views
    0 likes
    Last Post Leafcutter  
    Working...
    X