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:
- 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.
- A method to create a Price Series Provider (PSP) for a specified symbol.
- 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.
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.”
Inputs
This tutorial program does not have any inputs.
- 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.