Moving Window

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Moving Window

Postby rmoralesaramburu » Fri Nov 22, 2013 6:48 am

Hello,

I have the following problem.

I need to calculate the following for a number of FX quotation series:

(Current Close - Lowest Low) / (Highest High - Lowest Low) * 100

This is done in a moving average window of 14 weeks. Then, this is smoothed by 4 week moving average.

How do I program this? In an easy way, using FOR NEXT function for example...

Thanks!

PD. I am attaching FX series. Thanks
Attachments
fx_series.xlsx
(1013.63 KiB) Downloaded 480 times

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Moving Window

Postby rmoralesaramburu » Fri Nov 22, 2013 8:20 am

So I got the following and it worked

Code: Select all

for %y arg au bz ca ch cl co cz gb hr hu id in is jn mal mx no nz pd pe ph ru sa sk sw ta te th tu us genr it_{%y}=100*(fx_{%y}-@movmin(fx_{%y},14*5))/(@movmax(fx_{%y},14*5)-@movmin(fx_{%y},14*5)) next
With a little variations, without the final smoothing.

rmoralesaramburu
Posts: 52
Joined: Mon Nov 18, 2013 9:09 am

Re: Moving Window

Postby rmoralesaramburu » Fri Nov 22, 2013 8:25 am

What I would like to do next (and this time I have no idea how...please help!!) is a backtesting with that indicator.

I would like it to calculate profits when the indicator (it_{%y}) is above 80, and below 20 !!, for example

it_pe, and fx_pe. Sell fx_pe when indicator >80 and buy fx_pe when the indicator is <20...
If you have several sells before the buy, just catch the first one.
If you have several buys before the sell, just catch the first one.

Thanks!!

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Moving Window

Postby EViews Gareth » Sat Nov 23, 2013 11:46 am

I can't follow what you're asking there, sorry.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests