logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Damuzzdu  
#1 Posted : Saturday, December 20, 2008 7:05:22 PM(UTC)
Damuzzdu

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/31/2007(UTC)
Posts: 2

Hi,

Looking for some help in writing a % change formula.

What i am wanting to do write a formula which will calculate the % change from last trading date to a specific date in the past. Now I can use REF but as each new trading day is done I have to edit the REF formula by adding 1 to it.

As example if col B is close for last trading day and col C is close for say may 1 2008 then in col D the formula will calculate the % change between the two dates. Col C must remain fixed ie this date is not to change.

TIA

John

oztrader  
#2 Posted : Saturday, December 20, 2008 10:19:17 PM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Hi John,

The formula below was taken from another forum and posted by Preston Umrysh (also a member of this forum posting under the name of pumrysh) however I don't know if he was the original author of the code.[:)]

{Name: ROC since a date}

Day1 := Input("Day", 1,31,4);
Month1 := Input("Month" ,1,12,1);
Year1 := Input("Year" ,1900,2400, 2008); {default date changed from 1999 to 2008}

100 * (CLOSE - ValueWhen(1, DayOfMonth( ) = Day1 AND
Month()=Month1 AND Year() = Year1, CLOSE))/ ValueWhen(1, DayOfMonth( )=
Day1 AND Month()=Month1 AND Year()=Year1,CLOSE)

Cheers,

oz

Damuzzdu  
#3 Posted : Sunday, December 21, 2008 4:29:39 AM(UTC)
Damuzzdu

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 7/31/2007(UTC)
Posts: 2

Hi Oz,

Tks for yr post :)

Brilliant...:) works like a charm.

I guess I can reference this formula in an exploration using "fml"?

Cheers

John

oztrader  
#4 Posted : Sunday, December 21, 2008 6:24:19 AM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Hi John,

I think that if you are going to use the above formula in an exploration you should copy and paste the code into an exploration and hard code the three variables.

For example, if in an exploration you wanted to know the ROC of securities since 30th November 2007 the first three lines of code would be:-

Day1 :=30;
Month1 :=11;
Year1 :=2007;

Good exploring!

oz

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.