Rank: Newbie
Groups: Registered, Registered Users Joined: 1/16/2007(UTC) Posts: 3
|
I’m relatively new to Metastock programming, I need to be able to assign a value to a variable and have that variable remain constant until it is reassigned. It seems metastock can only assign code blocks to variables, which is fine except when I need the variable to maintain its value in a function such as value when. I need to code an exploration that will return a value (Such as L, O, C…) of the second most recent occurrence of a high equal to today’s high. The following code won’t work because of how metastock handles variables:
PeriodHigh := H;
ValueWhen(2,H = PeriodHigh, L)
Is there a way to get this code working?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers, Unverified Users Joined: 10/28/2004(UTC) Posts: 3,111 Location: Perth, Western Australia
Was thanked: 16 time(s) in 16 post(s)
|
Hi Matt, If you are looking for the instances involving TODAY's high, then look at using the LASTVALUE() function. Just remember the dynamic nature of this function - read the users manual for more information. something like this might help: ValueWhen(2,H =LastValue(H), L)
wabbit [:D]
|
|
|
|
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.