Skip to content

Tutorial 141 | Option Chain Provider

An example of how to use the Option Chain Provider

The OptionChainsProvider (OCP) class provides access to a collection of options for an underlying asset. The collection that is returned includes options that satisfy the criteria established in the OCP properties.

This tutorial gives a straightforward example of how to use the OCP in the hope that you will be able to program more complex examples.

The tutorial program consists of three main methods:

  1. A method to create a new OptionChainProvider (OCP). The method is called for @ES. The number of expirations is set to 1 and the number of strikes to 2.
  2. A method to create a Price Series Provider (PSP) for a specified symbol.
  3. A method to print some information about the symbols in the OCP and to create a PSP for each symbol (by calling the method described in number 2). The PSPs are stored in a dictionary.

Join the Markplex email list to get updates about new programs and tutorials.
Subscribe to the Markplex YouTube channel.

The program then plots the information for the PSPs in 8 plot statements.

Unfortunately, this program does not work with MultiCharts.
Tutorial 141 applied to a daily @ES chart. The third ….
The tutorial was created using TradeStation version 10. The program will work in 9.5 but the auto-complete and help information is not available. In addition the OCP component is not available in the toolbox.

As of May 2019, the TradeStation 10 Object Reference states that: “These classes and associated documentation are preliminary and may be changed before the OCP is formally releases.”

Help information and autocomplete are available for OCP in TradeStation 10.

Inputs

This tutorial program does not have any inputs.

The tutorial demonstrates various techniques including:
  • Creating and using methods
  • Creating an Option Chain Provider using a method
  • Printing  a snapshot of information about the options identified by the OCP
  • Creating multiple Price Series Providers using a method
  • Storing PSPs in a dictionary
  • Plotting the closing values of PSPs

Download

The tutorial 141 indicator (_Tutorial141) is available for download for $24.95 by clicking the following link. The program works with TradeStation version 9.5 and newer versions. It does not work with MultiCharts.

Video explanation of Tutorial 141 (Updated)

Code snippet used to set the Options Chain Provider to local or exchange

// Determine if the chart is set to local or exchange time using the DataStreams Class
if AnalysisTechnique.DataStreams.Stream[DataNum].TimeZone = tsdata.common.TimeZone.exchange then
OCP.TimeZone = tsdata.common.TimeZone.exchange
else
OCP.TimeZone = tsdata.common.TimeZone.local;

Please email me if there is something in this tutorial that I have not made clear.

THESE INDICATORS, SHOW ME STUDIES, STRATEGIES AND OTHER PROGRAMS HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES.

TO THE BEST OF MARKPLEX CORPORATION’S KNOWLEDGE, ALL OF THE INFORMATION ON THIS PAGE IS CORRECT, AND IT IS PROVIDED IN THE HOPE THAT IT WILL BE USEFUL. HOWEVER, MARKPLEX CORPORATION ASSUMES NO LIABILITY FOR ANY DAMAGES, DIRECT OR OTHERWISE, RESULTING FROM THE USE OF THIS INFORMATION AND/OR PROGRAM(S) DESCRIBED, AND NO WARRANTY IS MADE REGARDING ITS ACCURACY OR COMPLETENESS. USE OF THIS INFORMATION AND/OR PROGRAMS DESCRIBED IS AT YOUR OWN RISK.

ANY EASYLANGUAGE OR POWERLANGUAGE TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (AND PARTS THEREOF) AND ASSOCIATED TECHNIQUES REFERRED TO, INCLUDED IN OR ATTACHED TO THIS TUTORIAL OR PROGRAM DESCRIPTION ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR EDUCATIONAL PURPOSES. MARKPLEX CORPORATION. DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS (OR ANY PARTS THEREOF) OR TECHNIQUES. THE USE OF ANY SUCH TRADING STRATEGIES, SIGNALS, STUDIES, INDICATORS, SHOWME STUDIES, PAINTBAR STUDIES, PROBABILITYMAP STUDIES, ACTIVITYBAR STUDIES, FUNCTIONS AND TECHNIQUES DOES NOT GUARANTEE THAT YOU WILL MAKE PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES.