Can I set up default argument in subroutine?

For questions regarding programming in the EViews programming language.

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

Liu
Posts: 90
Joined: Tue Jun 08, 2010 6:22 am

Can I set up default argument in subroutine?

Postby Liu » Tue Aug 06, 2013 8:14 am

Hi,

I am wondering if eViews 8 allows default option for subroutine argument, so that when user chooses not to specify one
parameter, it will use a default vale.

for example, I am creating a bollinger band subroutine.
subroutine bollinger( series x1, scalar N, scalar K)

Can I use command below or other means to set up default value of the argument, in the way that if users don't specify then the subroutine takes 20 and 2 as default?
subroutine bollinger (series x1, scalar N=20, scalar K=2)


when users use it, ideally they can just write
call bollinger(x1)
if they don't want to use other values.

I tried to write subroutine in the above way, but eViews tell me that more arguments are needed. Is there a way to set up default value so as to reduce
number of arguments in some cases?

Thank you.

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

Re: Can I set up default argument in subroutine?

Postby EViews Gareth » Tue Aug 06, 2013 8:25 am

Unfortunately not.


As an aside, you might want to take a look at the Bollinger bands subroutine inside the TechAsis add-in.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests