[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [EquisMetaStock Group] Problem with LowestSince function



PureBytes Links

Trading Reference Links





Hi 
Harry,
<FONT face=Arial color=#0000ff 
size=2> 
Glad 
you like the way I structured the Columns, you will appreciate it is always a 
challenge with only 6 Columns to play with in the Explorer.
<FONT face=Arial color=#0000ff 
size=2> 
I have 
been through the code again and have done a scan of my database (Australasian 
EOD) and scanned ca 160 stocks and the Explorer came up with 36 stocks that met 
the rules. I have checked each and every one of these 36 stocks and 
in every case they met the criteria in the scan. Now we all know that 
strange things can happen when coding stuff like this so if you can post a 
report where the "Days2High" is less than the "Days2Low" Column then I would be 
grateful. As I said previously, I will be using this code as part of a TA 
Society presentation in a months time so I don't need egg on my face or more 
importantly dish-out bad code!
<FONT face=Arial color=#0000ff 
size=2> 
For 
the record and those that are interested, I post below the Rules and the Output 
from my Exploration. You will see that in each case the Lowest Low occured after 
the Highest High within the last 30 days. I also eye-balled the results on the 
charts to make double sure!
 
<FONT face=Arial color=#0000ff 
size=2>INPUTS:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>Exploration notes:        Finds those 
tickers that have a Lowest Low within 
the                                  
last 30 periods where the Highest High in the last 
30                                  
periods occured before the Lowest Low. It 
then                                  
computes the % range from High to Low and 
indicates                                  
where the Current Close is as a % of this range. 
This                                  
could be used as a scan for potential buy opportunities.
 
Col A: 
LLV30$             
LLV(LOW, 30)Col B: 
HHV30$            
HHV(HIGH,30)
 
Col C: 
Days2Low         LLVBars(LOW, 
30)
 
Col D: 
Days2Hi            
HHVBars(HIGH,30)
 
Col E: 
Range %           
PREC((((HHV(HIGH, 30) - LLV(LOW, 30))/ LLV(LOW, <SPAN 
class=084451500-13052003>30))) * 
100,1)
 
Col F: 
C%Range          PREC(((CLOSE 
- LLV(LOW,30)) / (HHV(HIGH,30) - <SPAN 
class=084451500-13052003>LLV(LOW,30))) * 
100,1)
 
<FONT face=Arial color=#0000ff 
size=2>Filter                           
LLVBars(LOW, 30) < 
HHVBars(HIGH,30)                                  
{Only finds tickers where LLV has 
occurred                                  after 
the HHV in the last 30 days - Buy  Opportunities}
 
<FONT face=Arial color=#0000ff 
size=2>Filter 
enabled              
YesPeriodicity                  
DailyRecords required         
39
 
OUTPUT 
REPORT:
<FONT face=Arial color=#0000ff 
size=2> 
  
Sec...   LLV30$     
HHV30$      Days2Low      
Days2Hi     Range %     
C%Range
<FONT face=Arial color=#0000ff 
size=2>CUE         
0.0430      0.0500       
0.0000     25.0000      
16.2000       
0.0000ANM         
0.2300      0.4350       
3.0000     19.0000      
89.1000       
2.4000CTL         
1.4700      2.2200       
0.0000     25.0000      
51.0000       
3.9000CSR         
1.5500      6.5200      
27.0000     28.0000     
320.6000       
5.0000FBU         
2.8600      3.1800       
6.0000     28.0000      
11.1000       
6.2000ERG         
0.0920      0.1200       
0.0000     14.0000      
30.4000       
7.1000CLT         
0.6300      0.8400       
6.0000     17.0000      
33.3000       
9.5000CSL        
14.1300     16.5000       
1.0000     29.0000      
16.7000      
11.3000BRZ         
0.6400      1.1700      
17.0000     27.0000      
82.8000      
11.3000AMP         
4.9400      8.8900       
1.0000      8.0000      
79.9000      
12.6000DVN         
0.4000      0.4750      
23.0000     24.0000      
18.7000      
13.3000CCL         
5.2800      5.8700       
4.0000     15.0000      
11.1000      
18.6000BHP         
8.4500      9.6700       
2.0000     21.0000      
14.4000      
19.6000ARQ         
0.5600      0.6600       
9.0000     28.0000      
17.8000      
19.9000AQP         
5.0000      6.2000       
7.0000     14.0000      
23.9000      
20.8000EQI         
0.8400      0.9300       
1.0000     11.0000      
10.7000      
22.2000CHY         
1.4000      1.6200       
1.0000     28.0000      
15.7000      
22.7000ADX         
0.3000      0.5000      
14.0000     29.0000      
66.6000      
24.9000AUO         
0.4500      0.5500       
5.0000     17.0000      
22.2000      
29.9000CRS         
0.5100      0.7300       
2.0000     26.0000      
43.1000      
31.8000DJS         
1.0400      1.1000       
2.0000     16.0000       
5.7000      
33.3000AAT         
0.1500      0.1800       
6.0000     19.0000      
20.0000      
33.3000GRD         
0.9900      1.0700       
1.0000      9.0000       
8.0000      
37.4000DOT         
1.0800      1.1700      
19.0000     27.0000       
8.3000      
44.4000BEN         
7.4000      7.8500      
14.0000     22.0000       
6.0000      
48.8000AIZ         
0.3200      0.4750      
10.0000     29.0000      
48.4000      
51.6000ALL         
1.5300      1.8400      
14.0000     22.0000      
20.2000      
54.8000AOF         
1.1000      1.2200      
23.0000     28.0000      
10.9000      
58.3000GAP         
1.5400      1.9800       
2.0000     24.0000      
28.5000      
59.0000CSM         
0.5600      0.6100       
6.0000     12.0000       
8.9000      
59.9000CLH         
1.2800      2.1500      
20.0000     29.0000      
67.9000      
62.0000FXJ         
2.7900      3.2000      
16.0000     22.0000      
14.6000      
65.8000AGG         
8.9500      9.9300       
7.0000     25.0000      
10.9000      
66.3000AGI         
0.4200      0.5100      
24.0000     26.0000      
21.4000      
66.6000FFL         
1.6100      1.8600      
16.0000     29.0000      
15.5000      
67.9000BIR         
0.6700      0.7800       
5.0000     21.0000      
16.4000      81.8000
<FONT face=Arial color=#0000ff 
size=2> 
Sorry 
about the crooked line-up of the columns above!
<FONT 
face=Arial color=#0000ff size=2> 
<FONT face="Kunstler Script" color=#008000 
size=5>Regards,
<FONT face="Kunstler Script" color=#008000 
size=5> 
Gordon 
Sutherland

  
  <FONT 
  face=Tahoma size=2>-----Original Message-----From: bex1210 
  [mailto:hmw3@xxxxxxxxxxxxxx] Sent: Monday, 12 May 2003 5:26 
  p.m.To: equismetastock@xxxxxxxxxxxxxxxSubject: Re: 
  [EquisMetaStock Group] Problem with LowestSince 
  functionGordon:I like the way you structured 
  your columns. I think I will use this format when I get to the Explorer 
  stage.Unfortunately, you don't get the LLV after the HHV either. If 
  you carefully look at some charts, you will see some instances where LLV() or 
  LowestSince() do NOT give you the correct LLV. The HHV will have changed, but 
  the LLV will NOT have changed to a value that corresponds to a date after the 
  HHV. In those conditions, your filter will not pick up the correct 
  stock.This is a frustrating exercise. With Roy's help, I have gotten 
  very close, but not 100% success.Harry --- In 
  equismetastock@xxxxxxxxxxxxxxx, Gordon Sutherland <gosuth@xxxx> 
  wrote:> Harry,>  > I do not profess to be a whiz at 
  programming but I needed to do> something similar to your request some 
  little while ago and I came up> with the undermentioned method in the 
  Explorer. You may wish to tidy the> code up somewhat to meet your 
  requirements in each column.>  > Column A: Lowest Low in 
  last 30 periods  -  LLVBars(LOW, 30)> Column B: Highest High 
  in last 30 periods - HHVBars(HIGH,30)> Column C: $ Range in Period - 
  PREC((((HHV(HIGH, 30) - LLV(LOW, 30))/> LLV(LOW, 30))) * 100,1)> 
  Column D: Current Close as % Range from LLV - PREC(((CLOSE -> 
  LLV(LOW,30)) / (HHV(HIGH,30) - LLV(LOW,30))) * 100,1)> Filter: 
  LLVBars(LOW, 30) < HHVBars(HIGH,30)>     {Only 
  finds tickers where LLV has occurred after the HHV in the last> 30 
  days} >  > Regards,>  > Gordon 
  Sutherland> > -----Original Message-----> From: bex1210 
  [mailto:hmw3@xxxx] > Sent: Saturday, 10 May 2003 7:52 a.m.> To: 
  equismetastock@xxxxxxxxxxxxxxx> Subject: Re: [EquisMetaStock Group] 
  Problem with LowestSince function> > > Donald:> 
  > I tried your suggestion. Unfortunately, it has many of the same 
  problems> that my original suggestion, and Roy's have: in a market 
  where the stock> price is rising and falling (i.e., not trending), the 
  correct LLV does> not get picked up after a new HHV (per the period) 
  has been established.> > To summarize, this is what I am trying 
  to do:> 1. find the highest high value over a period> 2. then 
  find the lowest low value AFTER the highest high from #1> 3. calculate 
  the price change from the lowest low (#2) to today's> close (then use 
  Explorer to rank the stocks by their price change)> > I can 
  calculate #1 using HHV(). It charts just fine.> I think I can calculate 
  #3 using div().> But it is #2 that causes the problem.> > 
  I modified a suggestion that Roy made, and have come up with this:> 
  H1:=HHV(H,30);> L1:=LowestSince(1,H1=H,L);> 
  L2:=LLV(LowestSince(1,H1<>Ref(H1,-1),L),30);> 
  S3:=Max(L1,L2);> H1;S3; {i.e., not charting L1 or L2}> > 
  This is "almost" correct. I tried it on a few stocks, and some weekly> 
  charts also. There were some mistakes, but none looked too serious.> 
  > If you plot your suggestion, plus the above, for several stocks, 
  you> will see where the problems occur. > > Thanks for 
  your help. I am new to Metastock, and always open to> 
  suggestions!> > Harry> > > --- In 
  equismetastock@xxxxxxxxxxxxxxx, "keara33903" <keara33903@xxxx>> 
  wrote:> >  Hi:Try> > 
  LowestSince(1,cross(H,Ref(HHV(HIGH,40),-1)),LOW) Don't know what your > 
  > doing but <> gives a constant 1 and generally doesn't give what you 
  > > want. Cross(above, below) gives a spike which is needed to start 
  > > lowestsince(jk,KJK,JK) Donald > > > > --- In 
  equismetastock@xxxxxxxxxxxxxxx, "bex1210" <hmw3@xxxx> wrote:> 
  > > Roy:> > > > > > Thanks for the 
  explaination of when true/false is required. I must > > admit I have 
  lots of trouble understanding the nuances of the > > Metastock 
  manual.> > > > > > Unfortunately, your > > 
  > "LowestSince(1,H>Ref(HHV(HIGH,40),-1),LOW)" > > > doesn't 
  work any better than my> > > "H1:=HHV(HIGH,40);> > > 
  LowestSince(1,H1=HIGH,LOW)".> > > > > > Both get in 
  trouble when the high rises and falls, yet does not > > exceed a 
  previous high over the 40 period. Trying charting any stock > > that 
  rises and falls (i.e., is not trending). Then plot an Indicator > > 
  of "HHV(HIGH,40)". Then plot a 2nd indicator of either of the two > 
  > LowestSince() formulas above. You will see that there are spots where 
  > > the HHV indicator drops over time to pick up a newer (and lower) 
  HHV, > > but the LowestSince() doesn't recognize the newer HHV, and 
  therefore > > doesn't change the Low as it should. (It make take 
  looking at several > > stocks before you find one with the correct 
  relations of relative > > highs.)> > > > > 
  > I thought I had a solution by calculating the period back to when 
  > > the HHV occurred, and then substituting that period into llv(); 
  such > > as> > > "H1:=HHVBars(HIGH,40);> > 
  > llv(low,H1)"> > > but Metastock will not allow a variable 
  for the period in llv() > > [although it does allow variables for 
  periods in formulas such as rsi> > ().]> > > > 
  > > So I am stuck. With your vast experience in using these Metastock 
  > > formulas, perhaps you have another suggestion.> > > 
  > > > And yes, when I can get something to chart correctly, my 
  plan is to > > use it in the Explorer, and hopefully also in the 
  System Tester.> > > > > > Harry> > > 
  > > > > > > > > > --- In 
  equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx> > 
  > wrote:> > > > Harry> > > > > > 
  > > I misunderstood/misread your question. I wrongly assumed it was 
  > > concerning> > > > an exploration.> > 
  > > > > > > Looking at your example below, you are using 
  a price "HHV> > (HIGH,40)" as if it> > > > were a 
  binary value (true or false). Any price above $1 will be > > treated 
  as a> > > > binary true. You need to set up a true/false 
  condition inside the> > > > LowestSince() possibly 
  "LowestSince(1,H>Ref(HHV(HIGH,40),-> > 1),LOW)". I'm> > 
  > > assuming the prices you are working with are nearly always > 
  > greater than $1.> > > > > > > > Sorry for 
  the earlier misinformation. Hope this puts you on the > > right 
  track> > > > > > > > Roy> > > 
  > > > > > ----- Original Message ----- > > > 
  > From: "bex1210" <hmw3@xxxx>> > > > To: 
  <equismetastock@xxxxxxxxxxxxxxx>> > > > Sent: Saturday, 
  May 03, 2003 5:10 PM> > > > Subject: Re: [EquisMetaStock 
  Group] Problem with LowestSince > > function> > > > 
  > > > > > > > > > Roy:> > > 
  > >> > > > > Thanks for the rapid response.> 
  > > > >> > > > > I think I understand the 
  "periods" suggestion, and will set > > that up as a> > 
  > > separate Indicator to call by Explorations.> > > > 
  >> > > > > But I don't understand your response on 
  LowestSince(), or my > > question was> > > > not 
  phrased well, or both!> > > > >> > > > > 
  I was first trying to use LowestSince () in a chart. It was my> > 
  > > understanding, from one of your earlier posts, that Indicators in 
  > > charts> > > > scan ALL loaded data; so minimum 
  should not be an issue as it is > > in the> > > > 
  Explorer.> > > > >> > > > > When I try 
  to chart an Indicator using "LowestSince(1,HHV> > 
  (HIGH,40),LOW)",> > > > I get a plot line identical to the Low 
  of each day (i.e., I get > > today's low> > > > 
  today, yesterday's low for yesterday, etc.)> > > > 
  >> > > > > I then thought that perhaps there had to be 
  some form of cross > > for> > > > LowestSince() to 
  function, so I created an Indicator which used:> > > > > 
  H1:=HHV(HIGH,40);> > > > > 
  LowestSince(1,H1=HIGH,LOW)> > > > >> > > > 
  > This at least plots a curve, and works correctly part of the > 
  > time, but> > > > when the stock price (High) rises and 
  subsequently falls over a > > period of> > > > time, 
  AND the resulting High is below my calculated H1, then > > 
  LowestSince()> > > > calculates the wrong Low. I also tried 
  H1<HIGH, and even H1>HIGH, > > and> > > > 
  combinations. None work.> > > > >> > > > 
  > So there is something which I must not understand about how > > 
  LowestSince()> > > > actually functions.> > > 
  > >> > > > > Any wisdom would be greatly 
  appreciated.> > > > >> > > > > 
  Harry> > > > >> > > > > --- In 
  equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" > > 
  <rlarsen@xxxx> wrote:> > > > > > Harry> 
  > > > > >> > > > > > When using 
  LowestSince() in the Explorer you must force it to > > scan 
  at> > > > least> > > > > > the required 
  number of bars, and preferably more. ValueWhen() > > and> 
  > > > > > BarsSince() are other function that will not return 
  expected > > values when> > > > > > used with 
  "minimum" bars.> > > > > >> > > > > 
  > And don't forget the many functions using any form of > > 
  exponential> > > > smoothing> > > > > > 
  require at least 5 times more data than the longest "periods" > > 
  used by> > > > the> > > > > > offending 
  functions.> > > > > >> > > > > > 
  To access a "Periods" value for ALL exploration columns I > > 
  suggest you> > > > create> > > > > > an 
  indicator specifically for this purpose. You can set up > > any 
  number of> > > > > > variable values then use FmlVar() 
  in your exploration columns > > to call> > > > 
  the> > > > > > required value. This could be used for 
  dates as well as > > numbers. Just be> > > > > 
  > aware that there is a performances trade-off when the number > 
  > of formula> > > > > > calls begins to 
  climb.> > > > > >> > > > > > 
  Roy> > > > > >> > > > > >> 
  > > > > > ----- Original Message ----- > > > > 
  > > From: "bex1210" <hmw3@xxxx>> > > > > > 
  To: <equismetastock@xxxxxxxxxxxxxxx>> > > > > > 
  Sent: Saturday, May 03, 2003 5:59 AM> > > > > > Subject: 
  [EquisMetaStock Group] Problem with LowestSince > > function> 
  > > > > >> > > > > >> > > 
  > > > > I have Metastock 8.01, EOD version. I am trying to 
  > > calculate the> > > > lowest> > > 
  > > > low since the highest high for use in an Explorer. But I am 
  > > having real> > > > > > problems.> 
  > > > > > >> > > > > > > To 
  visualize what is happening, I have created indicators > > to plot 
  on> > > > > > charts. If I create an indicator for the 
  HighestHigh [hhv()] > > for a> > > > 
  specific> > > > > > period, it plots correctly. So does 
  Lowest Low [llv()].> > > > > > >> > > 
  > > > > But when I try to plot the lowest low since the highest 
  > > high for a> > > > period> > > > 
  > > using [LowestSince(1,HHV(HIGH,40),LOW)],  all I get is > 
  > today's low. If I> > > > > > change the Nth figure 
  to 2, I get yesterday's low. Neither > > are the real> > 
  > > low> > > > > > since the last high; not 
  anywhere close.> > > > > > >> > > > 
  > > > Clearly I am doing something wrong. Can someone provide a 
  > > little> > > > guidance?> > > > 
  > > >> > > > > > > Thanks in 
  advance,> > > > > > >> > > > > 
  > > Harry> > > > > > >> > > > 
  > > >> > > > > > >> > > > 
  > > >> > > > > > >> > > > 
  > > > To unsubscribe from this group, send an email to:> > 
  > > > > > equismetastock-unsubscribe@xxxxxxxxxxxxxxx> 
  > > > > > >> > > > > > >> 
  > > > > > >> > > > > > > Your use 
  of Yahoo! Groups is subject to> > > > <A 
  href="">http://docs.yahoo.com/info/terms/> 
  > > > > > >> > > > > > >> 
  > > > > > >> > > > > > >> 
  > > > >> > > > >> > > > 
  >> > > > > To unsubscribe from this group, send an email 
  to:> > > > > 
  equismetastock-unsubscribe@xxxxxxxxxxxxxxx> > > > >> 
  > > > >> > > > >> > > > > 
  Your use of Yahoo! Groups is subject to > > <A 
  href="">http://docs.yahoo.com/info/terms/> 
  > > > >> > > > >> > > > 
  >> > > > >> > > > Yahoo! 
  Groups Sponsor      > > >  
  > <<A 
  href="">http://rd.yahoo.com/M=247865.3269369.4566997.1261774/D=egroupweb/S=1705> 
  375617:HM/A=1482387/R=0/*<A 
  href="">http://ads.x10.com/?bHlhaG9vaG0xLmRhd=105250996> 
  2%3eM=247865.3269369.4566997.1261774/D=egroupweb/S=1705375617:HM/A=14823> 
  87/R=1=1052509962%3eM=247865.3269369.4566997.1261774/D=egroupweb/S=17053> 
  75617:HM/A=1482387/R=2>       >  
  > <<A 
  href="">http://us.adserver.yahoo.com/l?M=247865.3269369.4566997.1261774/D=egrou> 
  pmail/S=:HM/A=1482387/rand=750104624>       
  > > To unsubscribe from this group, send an email to:> 
  equismetastock-unsubscribe@xxxxxxxxxxxxxxx> > > > 
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service> 
  <<A 
  href="">http://docs.yahoo.com/info/terms/> 
  .To 
                          unsubscribe from this group, send an email 
                          to:equismetastock-unsubscribe@xxxxxxxxxxxxxxxYour 
                          use of Yahoo! Groups is subject to the <A 
                          href="">Yahoo! Terms 
                          of Service. 
          






Yahoo! Groups Sponsor












To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx





Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.