how to get expirationdate on history?

Questions about MultiCharts and user contributed studies.
valentin2811
Posts: 11
Joined: 05 Jan 2015

how to get expirationdate on history?

Postby valentin2811 » 22 Mar 2017

Hello.
I want to close position before 2 days of expiratiration Futures and I need backtesting it.
I use Custom Futures for backtesting.

how to get expirationdate (for 8 futures) on history in backtesting?

functions expirationdate or expirationdatefromvendor always show current futures expriration date. I need previos futures expiration dates.

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: how to get expirationdate on history?

Postby Angelina MultiСharts » 24 Mar 2017

Hello Sir,

It is not possible to get previous futures expiration dates with expirationdate keyword, it has to be calculated

valentin2811
Posts: 11
Joined: 05 Jan 2015

Re: how to get expirationdate on history?

Postby valentin2811 » 24 Mar 2017

how to do it?

User avatar
Angelina MultiСharts
Posts: 260
Joined: 28 Dec 2016
Has thanked: 28 times
Been thanked: 66 times

Re: how to get expirationdate on history?

Postby Angelina MultiСharts » 14 Apr 2017

Sorry for the delay in responding.
I'd suggest creating a function that compares the date to specified expiration dates and returns the correct one. But such function has to be adjusted for contracts with different expiration rules.


Return to “MultiCharts”