52 week New High-New Low Index

#1
Is it possible to code a 52 week New High - New Low Index in Metastock. I want to create a New High - New Low Index based on 135 stocks I have in a Metastock directory. Any suggestions are appreciated.
 

chintan786

Well-Known Member
#3
here is ur Exploration...

ColA: {Close}C;
ColB: {52-week High} HighestSince(1, (DayOfMonth()=08 AND Month()=05
AND Year()=1998), H);
ColC: {52-week Low} LowestSince(1, (DayOfMonth()=08 AND Month()=05 AND
Year()=1998), L);

{Choose one of these filters}
{Filter 1:} ColA >= (0.9*(ColB))
{Filter 2:} ColB >= 2*ColC

{If you want both the conditions to be satisfied in the same query, just
join the two filters by the AND operator:}

Filter: (ColA >= (0.9*(ColB)) AND ColB >= ColC)

{One problem with the 52-wk High and 52-wk Low formula--every day you've got
to change the values for dayofmonth(), Month() and Year() functions. The
formula given above assumes that you would be running the query on May 07,
1998. Change the values of the above functions accordingly.}
 
#4
I want to identify the stocks (in my 135 stocks shortlist) that have hit new highs and new lows. I am going to use this info to create a new high - new low index.

I tried to create a new explorer with the provided formula but it fails with 'Filer reference to N/A value in column B'. There is probably something wrong with the highestsince/lowestsince functions. I have tried to modify the exploration but I am not able to get it to run. Any suggestions are welcome.
 
#5
I found this old post from Trderji, it seems to solve my problem with calculating new high new low:


You can use this formula as an exploration:

New 52 Wk HIGH
if(h>ref(hhv(h,250),-1),h,0)

New 52 Wk LOW
if(l<ref(llv(l,250),-1),l,0)
__________________
Best Wishes!

Traderji
 
#6
The formula posted by Mortenso is woeks. I am using this since long. Here it is posted again.

Column A : Close
Column B : If(H > Ref(HHV(H,250),-1),H,0) (For high)
Column C : If(L < Ref(LLV(L,250),-1),L,0) ( For Low)

save in explorer and use it.
Regards,
Shura.
 
#7
The formula for calculation the new high - new low index is as follows:

Col A: colA If(H > Ref(HHV(H,250),-1),H,0)
Col B: colB If(L < Ref(LLV(L,250),-1),L,0)
Filter colB>0 OR colA>0

I also like to calculate the index automatically by adding a new column Col C:
if(ColA>0 and ColB=0) then 1
if(ColA=0 and ColB>0) then -1

The syntax for ColC is not correct but describes the logic. Can someone familiar with the syntax please help me out.

It should also be possible to make a sum for ColC on the Result page after running the exploration. This would automatically calculate the NH-NL index value. Any suggestions?
 
Last edited:
#8
I have figured out how to display 1 for new high and -1 for new low:
Col A: colA If(H > Ref(HHV(H,250),-1),1,0)
Col B: colB If(L < Ref(LLV(L,250),-1),-1,0)
Filter colB<0 OR colA>0

To construct the complete index you need to edit the exploration and choose options and explore specific date. You then need to run the exploration for one day at a time to get one year history for the new high - new low index. This is very cumbersome. Anyone know if it is possible to automate this process?
 

Similar threads