Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Please can someone help me to solve the below issue?????????????please????
I have attached a file in which I have a table with the last column called as 'net',this expression consists of many variables in it.
I want to put this expression in the main script/load script and rename it as a field A''so that my future calculations involving this field A would be much easier.Can we do this???????
please can someone help??
the variables are updated in a macro .if you check in the edit module the function is 'Black 76'
I think we need to call macro and then put this exp below renaming it as required.Is this the process??else please guide me.
Hi,
Thanks for the response,
Yes,but call_put =if(xoptiontype_='PUT','p','c') because the first parameter to be passed to the function is a string which should be either 'c ' or 'p' according to PUT/CALL value in xoptiontype_ so I gave that condition and renamed this as a new field called call_put and trying to pass the same.
Is this wrong else any other way to do this??? can you please guide me??
The calculated field can't be refered in the same load statement like that. Rather try preceding load like:
black_76:
Load
*,
Black76(call_put,strike_price1,strike_price,time_to_expiry,'0.105',Volatility_Amended) as new_option_fuction
;
load
*,
(Expiry_-Today())/365 as time_to_expiry,
(if(xoptiontype_='PUT','p','c')) as call_put
Resident data_;
Hi Tresesco,
Thanks for reminding ,had forgotten that part of script ,but I have corrected the same.Now the reload took place successfully but the field renamed which is the outcome of the function Black76 ie new_option_function doesn't show any result.You can have a look at the table box in sheet 6 of the file attached.
Am I still going wrong somewhere?? please request help.
In your function definition one msgbox is there, just comment it out.
function Black76(CallPutFlag,F,X,T,r,v)
Dim d1,d2,op
d1 = (Log(F / X) + (v ^ 2 / 2) * T) / (v * Sqr(T))
'msgbox d1
d2 = d1 - v * Sqr(T)
....
Hi Tresesco,
Thanks a lot,the values are coming now for new_option_function. ,I am getting to know little more about macros now, but had a doubt,cant we use this field obtained from the function black76 for other calculations in the script??
something like :
if(buy_sell='BUY',new_option_function-premium1,premium1-new_option_function) | as asoff_payoff |
and then I try to pull this asoff_payoff next to the new_option_function in the table???? I am presently not getting values for this
.Is this not possible???
You can refer the file attached if required.
Hi Sahana,
You can, and it is being calculated as well. Take the field asoff_payoff in a list box, you would find the values. In your straight table use expression:= Sum(asoff_payoff), values would get populated.
, hope this helps you close the issue.
Hi hi I myself want to close this very fast Tresesco,and I am able to proceed almost till the end with your generous help which you have provided all the way.
The asoff_payoff value actually doesn't match.I calculated it in script as well as in table also.The one calculated in table comes up but that calculated in script doesn't. If I put sum(Sum(asoff_payoff) in the table very huge value comes which is wrong .
As soon as this is resolved will close this asap .
Hi
Your asoff_payoff field is not associated to any other tables. Rewrite the last part of your code as :
black_76:
load
*,
if(buy_sell='BUY',new_option_fuction-premium1,premium1-new_option_fuction) as asoff_payoff
;
load *,
[Trade ID] as trade,
Position_ID as pos,
strike_price as markt,
strike_price1 as strik,
Volatility_Amended as vol_amd,
xoptiontype_ as cp,
call_put as call_put1,
premium as premium1,
Expiry_ as exp,
time_to_expiry as time_to_expiry1,
Black76(call_put,strike_price1,strike_price,time_to_expiry,0.105,Volatility_Amended) as new_option_fuction
Resident data_;
// **********Following section should be commented out like
//as_off:
//load
//if(buy_sell='BUY',new_option_fuction-premium1,premium1-new_option_fuction) as asoff_payoff
//Resident black_76;
Hi thanks a lot Tresesco.
finally I reached the end
as your wish will close it off.
Thanks again.
You are welcome ! And happy that I could help you reach the end.