This is a trading item or a component that was created using QuantShare by one of our members.
This item can be downloaded and used by QuantShare Trading Software.
Trading items are of different types. There are data downloaders, trading indicators, trading systems, watchlists, composites/indices...
You can use this item and hundreds of others for free by downloading QuantShare.
Top Reasons Why You Should Use QuantShare:
Works with US and international markets (stock, forex, options, futures, ETF...)
Offers you the tools that will help you become a profitable trader
Allows you to implement any trading ideas
Exchange items and ideas with other QuantShare users
Our support team is very responsive and will answer any of your questions
We will implement any features you suggest
Very low price and much more features than the majority of other trading software
For Free - No Credit Card Required
Derivatives: Number of days until the expiration date
This function calculates the number of days until a contract expires. It works with all symbols that have a date in the 'Expiration Date' field. I am using it with these US options symbols (US Options symbols A-M, US Options symbols N-Z).
The function takes no arguments and it just uses the date it finds in the 'Expiration Date' field and calculates the number of days until the current security contract expires (for example, derivatives like futures or options). The 'Expiration Date' format must be of as follows 'Month/Day/Year', but if you have a different format, you can easily update the code so it can parse that format.
In the 'Custom function' plug-in, select this function and then update the following lines:
string[] temp = cFunctions.SymbolInfo.ExpirationData.Split('/');
int year = Convert.ToInt32(temp[2]);
int month = Convert.ToInt32(temp[0]);
int day = Convert.ToInt32(temp[1]);
The 'Expiration Date' field data is first split and then each part is converted and associated to the year, month or the day variable.
Using this function and the options database, you can for example create a watchlist that displays only options contracts that expire in a period of time between 10 and 30 days:
filter = GetTimeToExpiration() > 10 && GetTimeToExpiration() < 30;
>>>> More trading objects? click here to search for trading sytems, downloaders, screens, custom drawing tools, indicators... by country, market or style.