Exception Class Messages

Exception and System Exception error messages are generated by EasyLanguage code contained in analysis techniques and strategies.  They are associated with exception classes and may require making changes to the originating EasyLanguage code from the TradeStation Development Environment.  

Namespace: (any)

General Troubleshooting Tips

• Use Print statements.

• Comment out code to isolate the error, then comment code back in.

• Consider logging to a file for difficult-to-replicate run-time errors (see FileAppend).

• Consider using the debugger (see About Debugger).

• Examine the "stack trace" from the exception window's event details section. After the event description, the "call stack" shows the order in which functions were called, and the line number on which the error was triggered (when possible).

For example, in the call stack below, ThrowExceptions is the TradingApp name, the exception is triggered at line 17 in func2, which is called by func1, which is called by the analysistechnique_initialized method, which is called by the "EasyLanguage run-time," abbreviated ELRte. The function listed at the top of the stack was the last function called, and is often the place in the code where the error was triggered. The function listed at the bottom of the stack was the first function called.

Call Stack:

ThrowExceptions.func2() line 17

ThrowExceptions.func1()

ThrowExceptions.analysistechnique_initialized( elsystem.Object sender, elsystem.InitializedEventArgs args )

ELRte

Exception Class Messages

The following Exception messages are used to identify the condition described and the matching class will throw an exception if the condition is true. The Exception base class provide a common set of methods and properties that may be accessed for these exceptions.

Some of the Exception types in the tables below are wrappers for .NET exceptions of the same name. A standard browser search for a type such as “ArgumentException” will yield results from the .NET System.ArgumentException, which may provide additional useful information. Exceptions that are wrappers for corresponding .NET exceptions are indicated with “(.NET)” in the Additional Troubleshooting Notes column.

These classes may be used with Try / Catch / Finally statements to set up handling for user exceptions.

Exceptions may also be used with Throw to cause the exception to occur and/or display the exception error message.

  Name Error Description Additional Troubleshooting Notes
Public property ActivityBarException An empty cell/row or out of range item is referenced in an ActivityBar.

Within an ActivityBar, for example, the following code where no cells have been added yet would cause this exception:

AB_RemoveCell(C, 1, LeftSide).

Public property ArgumentException One of the arguments provided to a method is not valid. (.NET)
Public property ArrayBoundsException An analysis technique attempts to reference the data past the bounds of the array. Array indices are 0-based, so accessing myArray[10] on an array with size 10 could trigger this exception (the 10th element is myArray[9]).
Public property DataDeletedException A reference to an non-existing datastream is made.

For example, the following code works when a 2nd symbol has been inserted into the chart (Data2), but if the 2nd symbol is removed, the DataDeletedException occurs.

 

Value1 = 2;

Value2 = Close Data( Value1 );

Public property DirectoryNotFoundException The specified file location was not found.

(.NET) Attempting to access an invalid directory name. Example:

Directory.GetLastAccessTime(“c:\badname”);

Public property FileNotFoundException The specified file was not found.

(.NET) Attempting to access an invalid file name. Example:

File.GetAttributes(“c:\badfilename.txt);

Public property InvalidCastException Invalid casting or explicit conversion.

(.NET) For example:

Dict = new Dictionary Dict.Add("First", 1);

ord = Dict["First"] astype tsdata.trading.order;

 

Attempting to cast the integer object to order results in an InvalidCastException.

Public property InvalidOperationException A method call is invalid for the object's current state. (.NET)
Public property IOException An I/O (Input/Output) operation is unsuccessful. (.NET) Could be triggered by anything that can prevent a file i/o operation from completing, except the cases of derived classes like DirectoryNotFoundException and FileNotFoundException. It could be an attempt to access a locked file, attempting to write when only read access has been requested, going past the end of a stream, etc.
Public property HistFundamentalDataDoesNotExistException Historical fundamental data does not exist for this reference.  
Public property LogException Attempt to call the mathematical Log function on a non-positive number.  
Public property MaxBarsException The number of bars referenced in a study are greater than the allowed number. Check, and possibly increase, the MaxBarsBack setting in the Properties\General tab for the study in the development environment. Use general troubleshooting techniques (see above) to determine the maximum lookback made by the study.
Public property TooManyTrendlinesException There are too many trendlines on the screen Consider reducing the amount of history shown on the chart.
Public property TooManyTextObjectsException There are too many text drawing objects on the screen. Consider reducing the amount of history shown on the chart.
Public property NoFundamentalDataAvailableException The fundamental data cannot be found for a Symbol.  
Public property NullObjectException A method call is made using a null object.

(.NET) For example, if Dictionary Dict has been declared but not created then the following line of code will cause this exception:

Dict.Add("First", "123");

Public property ObjectNotInitializedException An object instance failed to initialize.  
Public property OpenFileException A file cannot be opened.

This exception is only thrown when attempting to use the EL Print statement to print to a file, and the file cannot be created or written. For example, if the file passed below is locked by another application then this exception will occur:

Print(File("c:\data\mydata.txt"), "Hello");

Public property OpenPositionsException There are too many open positions in a strategy. The maximum number of open positions allowed in a strategy is 50.  
Public property PlotRangeException An analysis technique attempts to change plot information for an non-existing plot.  
Public property PowerErrorException An analysis technique attempts to raise a negative number to a fractional power.  
Public property PrintErrorException Connection to the printer cannot be made to print the output.  
Public property ProbabilityMapException Related to Probability Map.  
Public property ProbBottomReInitException The bottom price for the Probability Map cannot be changed.  
Public property RecalculateException

Throw this exception to force a chart to recalculate and re-plot.
For example:

 

throw elsystem.RecalculateException.Create("");  

 
Public property SqrtErrorException An analysis technique attempts to evaluate a square-root of a negative number.  
Public property StopCalculationException

Throw this exception to turn off an analysis technique. Example:

throw elsystem.StopCalculationException.Create("");

 
Public property SynchronousDataAccessException Error accessing data synchronously from a provider.  
Public property ToolMemoryException There is no memory space for storing strings.  
Public property UnauthorizedAccessException The operating system has denied access due to an I/O error or security error. (.NET) In addition to security imposed by the operating system, this exception may be thrown based on TradeStation user entitlements, such as unauthorized file read access.
Public property WriteFileException The output cannot be written to a file.

This exception is only thrown when attempting to use the EL Print statement to print to a file, and the file cannot be created or written. For example, if Q: is not a valid drive on your system, then this line of code will cause the exception:

Print(File("q:\data\mydata.txt"), "Hello");

Public property XmlException There is a load or parse error in XML. (.NET) Print the contents to the EasyLanguagePrintLog or write to file. Use free online XML validation tools to help find XML syntax errors.

 

System Exception Class Messages

The following SystemException classes are used to identify the condition described and the matching class will throw an exception if the condition is true. The SystemException base class provide a common set of methods and properties that may be accessed for these exceptions

  Name Error Description Additional Troubleshooting Notes
Public property DebuggingException Code debugging execution is interrupted. (.NET)
Public property DivideByZeroException An attempt to divide by zero(0). (.NET)
Public property FltDivideByZeroException Floating-point divide by zero exception.  
Public property FltInvalidOperationException Floating-point invalid operation exception.  
Public property FltOverflowException Floating-point overflow exception.  
Public property FltUnderflowException Floating-point underflow exception.  
Public property FPInvalidException Floating-point invalid exception.  
Public property InfiniteLoopException An Infinite loop is detected in an analysis technique. Check all 'FOR' and/or 'WHILE' loops for correct syntax.  
Public property IntDivideByZeroException Integer divide by zero exception.  
Public property IntOverflowException Integer overflow exception.  
Public property InvalidCallBackMessageException An invalid call back message.  
Public property InvalidDllOperationException An invalid operation occurs in a user dll.  
Public property InvalidHandleException An invalid HANDLE is specified.  
Public property InvalidOperationException A method call is invalid for the object's current state. (.NET)
Public property NonContinuableException The event isn't continuable in the hardware, or if continuation makes no sense.  
Public property OutOfMemoryException There is no more memory space available. (.NET) This could reflect a huge memory allocation or very low system resources, but more often it involves the same looping or recursive call errors that could cause an InfiniteLoopException or StackOverflowException, but the memory condition is reached first.
Public property SessionException An invalid session reference occurred.  
Public property StackOverflowException The execution stack overflows because it contains too many nested method calls. (.NET) This could happen when a function calls itself recursively, or when two functions call each other. One example is if there is user function called Log, which calls a user function called WriteStr to write a string to file. WriteStr catches any exception and calls Log to write the exception information to a specific file. But if there is a problem writing to the log file (perhaps entitlements), the two functions repeatedly call each other.
Public property UnknownException An unknown error generated an exception. (.NET)
Inheritance Hierarchy

Exceptions

elsystem.Object

elsystem.SystemException

elsystem.Exception

(namespace).(exceptioname)


System Exceptions

elsystem.Object

elsystem.SystemException

elsystem.(exceptionname)