Page 1 of 1

calculating returns of trading strategies

Posted: Mon May 04, 2020 4:39 pm
by Laurel
Hello! I have monthly pooled data for spot (s) and forward (f) exchange rates for ten countries and ten years. The forward rate is just the spot rate plus the interest rate differential. I would like to create a series of monthly excess returns = s(1)/f based on:

1. buying the currency with the maximum forward premium, max(f - s) and selling the one with the minimum forward premium, min(f – s), so the net return = rmax – rmin, and

2. buying the currency with the highest excess return in the previous period, max[s/f(-1)] and selling the one with the lowest excess return in the previous period, min [s/f(-1)].

What would be the best way to go about programming this? Thanks for your help!

Re: calculating returns of trading strategies

Posted: Wed May 06, 2020 2:15 pm
by Laurel
Let me rephrase the question. How do I generate a series from pooled data based on the maximum and minimum of some attribute in each time period?

For example, given monthly pooled data of 2 variables for 10 countries: a1, a2,...,a10 and b1, b2,..., b10. How do I command eviews to find for each month the countries with the biggest and smallest difference between a and b (a - b) and from them generate a series = a/b - a/b?

Re: calculating returns of trading strategies

Posted: Wed May 06, 2020 2:35 pm
by EViews Gareth
You lost me on the last bit, a/b-a/b = 0 ?

But, here's a rough idea that should work:

Code: Select all

'create some data and a pool wfcreate m 2000 2020 for !i=1 to 10 series a_{!i} = @nrnd series b_{!i} = @nrnd next pool p 1 2 3 4 5 6 7 8 9 10 'generate difference series p.genr dif_? = a_? - b_? 'group them group mydifs dif_? group as a* group bs b* 'create series containing the index of the minimum difference each month series mins = @rmini(mydifs) 'create a series with the ratio of a/b for the smallest difference each month series myratio = as(mins) / bs(mins)

Re: calculating returns of trading strategies

Posted: Wed May 06, 2020 2:42 pm
by Laurel
I meant a/b of the biggest (a - b) minus a/b of the smallest (a - b): a/b(max) - a/b(min). Thanks for the tip, I'll try it out!

Re: calculating returns of trading strategies

Posted: Sun May 10, 2020 7:53 pm
by Laurel
Thanks for the code, that was very helpful. Follow-up question:

What if given monthly pooled data of 2 variables for 10 countries: a1, a2,...,a10 and b1, b2,..., b10, I want eviews to find for each month the three countries with the three smallest difference between a and b (a - b) and from them generate a series = (ax*ay*az)/(bx*by*bz) where x, y, and z represent countries with the smallest, second smallest, and third smallest (a-b) respectively? How do I program this?