PureBytes Links
Trading Reference Links
|
bobrabcd wrote:
> I would like to create a Fair Value indicator for use in Trade Station
> using the following formula and need some help with a line(s) of code that
> calculates the number of days remaining until expiration. It would be
> handy to have this done as automatically as possible so the user would only
> have to change the inputs when the dividends changed or the futures
> contract changed to the next expiration. Suggestions welcome.
>
> Data1 would be the SPX or cash in the formula,
> Data2 would be the IRX 91 day T-Bill Yield Index or r in the formula,or
> other suggestion.
> Dividends would be a user input, available from Barron's.
> x is the number of days remaining until expiration of the futures
> contract(is there a novel way of determing this with easy language code?)
>
> The following formula is used to calculate fair value for stock index futures:
>
> = cash [1+r (x/365)] - Dividends
>
Bob ,
Below is what I think would work.
Close of Data1(1+Close of Data2(x/365)) - Dividends;
X could be calculated by using a few functions, DaysToExperation(Exmonth,Exyear)
and DeliveryMonth and DeliveryYear. The last two will return the month & year
respectively of the data being tested. These are listed in the TS online help if
you wish to see them more.
X = DaysToExperation(DeliveryMonth,DeliveryYear);
Hope this helps.
John
|