please correct this formula

#1
from few days i have been trying to correct this very simple formula which helps me find stocks which are making new weekly higher highs and higher lows, however the formula is not working properly. if someone can help me with this, the exploration formula that i have is
=============================================
TimeFrameSet(inWeekly);
HH = High > Ref(High,-1) AND Ref(High,-1) > Ref(High,-2);
HL = Low > Ref(Low,-1) AND Ref(Low,-1) > Ref(Low,-2);

Filter = HH AND HL;

AddColumn(High,"high");
AddColumn(Ref(High,-1) ,"Last Week High");
AddColumn(Ref(High,-2) ,"Previous Week High");
TimeFrameRestore();
=============================================
 

rkkarnani

Well-Known Member
#2
This is my Copy paste effort. I am myself not very proficient in coding Metastock.
See if what follows would be of any use to you :

Exploration for highest percentage rise in share prices, stocks traded for any length of time :


Column A: +% incrs

TtlDays:=LastValue(Cum(1));
FirstDay:=If(TtlDays>252,TtlDays-252,1);
FirstCl:=ValueWhen(1,Cum(1)=FirstDay,C);
Int((C/FirstCl-1)*10000)/100

Column B: today

Close

Column C: 52w back

TtlDays:=LastValue(Cum(1));
FirstDay:=If(TtlDays>252,TtlDays-252,1);
ValueWhen(1,Cum(1)=FirstDay,C)

Column D: $ t/over

Int(WC()*V)

Column E: months

Int(LastValue(Cum(1)/21))

Column F: weeks

Int((LastValue(Cum(1))
-Int(LastValue(Cum(1)/21))*21)/5)

Filter:

colA > 0
AND colD > 10000
 
#3
thanks for your efforts rkkarnani, however i am using amibroker, so the code that was posted was from amibroker. i am trying to find stocks which are making higher highs and higher lows on weekly charts from past three weeks. anyways thanks once again for trying. so i request once again to senior members if they can help me correct this AFL
 

KelvinHand

Well-Known Member
#4
from few days i have been trying to correct this very simple formula which helps me find stocks which are making new weekly higher highs and higher lows, however the formula is not working properly. if someone can help me with this, the exploration formula that i have is
=============================================
TimeFrameSet(inWeekly);
HH = High > Ref(High,-1) AND Ref(High,-1) > Ref(High,-2);
HL = Low > Ref(Low,-1) AND Ref(Low,-1) > Ref(Low,-2);

Filter = HH AND HL;

AddColumn(High,"high");
AddColumn(Ref(High,-1) ,"Last Week High");
AddColumn(Ref(High,-2) ,"Previous Week High");
TimeFrameRestore();
=============================================
Don't see any problem, did capture one stocks 3 consecutive weeks of HH and HL. logic is OK. Dont' understand what you means "is not working properly".

Suspect that you pressing Scan instead of Explore, do this:
Filter =Buy = HH AND HL;
:confused::confused::confused:
 

Similar threads