Rank: Newbie
Groups: Registered, Registered Users, Unverified Users Joined: 12/22/2013(UTC) Posts: 8
|
Hi, I am trying to combine all the OptionGreeks and plot all together in a single indicator for a particular strike price. Here is my formula: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ temp:=Input("CALL:1, PUT:2, FUTURECALL:3, FUTUREPUT:4",1,4,1); strikeprice:=Input("Strike Price",0000000,111111,0); expirydate:=Input("Expiry Date in YYMMDD format",000001,991231,991231); interestrate:=Input("Interest Rate",0,24,12); dividendrate:=Input("Dividend Rate",0,100,25);
IF(temp=1, type:=EC, IF(temp=2, type:=EP, IF(temp=3, type:=FC, IF(temp=4, type:=FP, type:=EC))));
OptionDelta:=DELTA(type,expirydate,strikeprice,interestrate,dividendrate); OptionGamma:=GAMMA(type,expirydate,strikeprice,interestrate,dividendrate); OptionVega:=VEGA(type,expirydate,strikeprice,interestrate,dividendrate); OptionTheta:=THETA(type,expirydate,strikeprice,interestrate,dividendrate); OptionPrice:=Option(type,expirydate,strikeprice,interestrate,dividendrate); +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The above formula does not work because Metastock Formula Language does not allow data assignment in the IF condition. Alternatively, any thoughts on how to pass on EC, EP, FC, FP to the option greek functions in the above formula?
Regards, sdg
|