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

Re: [amibroker] peak - trough with variable



PureBytes Links

Trading Reference Links


I understand the danger of unconfirmed 
peaks and troughs. I wouldn't use the indicator to generate signals. I likeit 
for pattern detection. Understanding how it works helps me use it more 
effectively for this purpose.

<<as new closing 
data is introduced into the chart the value of minretracement will change. when 
it <<does the the zig sensitivity will be recalculated but it will bethe 
same on the whole chart. If <<tonight's calculation returns 5 then the 
zigzag (and Peaks) will be drawn based on 5%. If <<tomorrows data returns 
a 10 then the zigzag will be redrawn using a setting of 
10. 
<FONT face="MS Sans Serif" 
size=2>
Now I see the value of use the 
LastValue function from a real time perspective. For historical studies, 
I've made do with dividing my data into ranges and calculating the range 
separately.
 
PeakValue = iif(C > 1500, peak(C, 3.6, 
1), iif(C > 1000, peak(C,2.4,1), peak(C,1.2,1))) ;
 
What is the practical limit for nested 
iifs?
 
Thanks for your help.
 
Esteban
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=jcasavant@xxxx 
href="">Jayson 
To: <A title=amibroker@xxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 
Sent: Thursday, October 31, 2002 7:05 
PM
Subject: RE: [amibroker] peak - trough 
with variable

<SPAN 
class=287554623-31102002>Estaban,
<SPAN 
class=287554623-31102002> no, until such time as your counter movehas 
exceeded 1.2% the turn is open change. Zig may show the turn to have occurred 
but until the turn exceeds the setting it is capable of reversing its self and 
simply erasing any trace of its error. this is why zig can be so dangerous to 
rely on. when you system test zig is always correct. All of the turns have 
been confirmed. In real life the system will not trade the way zig says it 
does.
<SPAN 
class=287554623-31102002> 

<FONT face="MS Sans Serif" color=#000000 
size=2>peak(ARRAY, change, n=1) 
 
<SPAN 
class=287554623-31102002>Peak= a peak means simply the price today islower 
than the price yesterday and the price yesterday was higher than the price 2 
days ago. Picture a  roof line.  Peak is the peak of the 
roof
<SPAN 
class=287554623-31102002> 
<SPAN 
class=287554623-31102002>Array= high, Low, Close value from which the 
calculations are made
<SPAN 
class=287554623-31102002> 
<SPAN 
class=287554623-31102002>Change= the sensitivity of the confirmation.in this 
case a stock who's move exceeds 1.2% cannot result in a vanishing signal.any 
counter move after the 1.2% will result in a new leg being 
drawn.  If the new move does not exceed 1.2 percent and instead resumes 
the prior move than the turn is erased and appears to have never been there to 
begin with.
<SPAN 
class=287554623-31102002> 
<SPAN 
class=287554623-31102002>n=1  = which of the turns in the zigzag are you 
referring to? 1= the last turn. 2= the turn prior to that, etc, 
etc
<SPAN 
class=287554623-31102002> 
<SPAN 
class=287554623-31102002>if you are still lost contact me off list and I will 
send some pictures, 
<SPAN 
class=287554623-31102002> 
<SPAN 
class=287554623-31102002> 
 
Jayson 

<FONT face=Tahoma 
size=2>-----Original Message-----From: Esteban 
[mailto:ygroups@xxxx]Sent: Thursday, October 31, 2002 6:20 
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
peak - trough with variable
I think I've got it. Let me restate it, 
correctly, I hope.
 
If the current bar reaches a 
retracement of 1.2% from the last highest bar that is uncorrected, 
then  it identifies that last high as the peak. Right?
 
<<The code I posted uses the 
high value to determine the turning points. If you used the close  then 
zig <<would use those values. 
 
Here's where I get confused, but I 
think I've got it now:
<FONT face="MS Sans Serif" 
color=#000000>peak(ARRAY, change, n=1) 
<FONT face="MS Sans Serif" 
color=#000000>The point from which the peak function measuresthe % 
change backwards to the high 
is the ARRAY in the formula. Right? So peak(L, 1.2 , 1) would measure back to 
the high point from the current low, evaluating whether or not it was >= 
1.2%. 
<FONT face="MS Sans Serif" 
color=#000000> 
<FONT face="MS Sans Serif" 
color=#000000>If so then using the High value (as opposed to Low or Close) 
 to measure from a peak seems odd, as the retracement may have taken 
place from the other price points of the bar. Part of why I've been confused 
about this whole topic, since the examples I've seen use the 
high.
 
Sorry to beat this to death. I've read 
lots of posts concerning zig-zag and searched the manual, but I've never 
gotten the concept clear in my mind. 
 
Esteban
 
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=jcasavant@xxxx 
href="">Jayson 
To: <A title=amibroker@xxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, October 31, 20023:59 
PM
Subject: RE: [amibroker] peak - trough 
with variable

<SPAN 
class=728374720-31102002>Esteban,
<SPAN 
class=728374720-31102002>no, peak looks BACK not forward. it uses zigzag to 
determine turns in the market based on your setting, in your case 1.2%.The 
code I posted uses the high value to determine the turning points. If you 
used the close  then zig would use those values. Zig is not time based 
but uses a percentage retracement to define a turn. from the "help" 
file.....
 <SPAN 
class=728374720-31102002>
PEAK 
(AFL 1.1)



SYNTAX 

peak(ARRAY, 
change, n = 1)

RETURNS
ARRAY

FUNCTION 

Givesthe value 
of ARRAY n-th peak(s) ago. This uses the Zig Zag function 
(see Zig Zag) to determine the peaks. n =1 would return the 
value of the most recent peak. n =2 would return the value of 
the 2nd most recent peak. Caveat: this function is based on 
Zig-Zag indicator and may look into the future.

EXAMPLE
<FONT face=Arial color=#0000ff 
size=2>peak(close,5,1)
 
 
<SPAN 
class=728374720-31102002>As DT correctly pointed out, the last turn in the 
series is always open to change. tonight's peak may show a turn yesterday. 
if the market corrects prior to your threshold being met (1.2%) then 
that peak will simply disappear. For this reason testing with 
zig/peak/trough is very dangerous.   to see how peak works drop zigzag 
on your price plot
 
Jayson 

<FONT face=Tahoma 
size=2>-----Original Message-----From: Esteban 
[mailto:ygroups@xxxx]Sent: Thursday, October 31, 2002 
3:26 PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
[amibroker] peak - trough with variable
Jayson,
 
LastValue function works great!  
My formula now works. 
 
I'm still unclear, however, on how 
the peak function works.
 
Please correct my following 
understanding:
<FONT 
color=#0000ff>Peak(H,1.2,1)  
At each bar, this formula looks ahead to find a retracement of a least 1.2% 
from that current bar's high and verifies that there are no higher highs 
within the retracement period. If it doesn't find this condition, it uses 
the last peak value. 
 
What would the formula do ifit used 
Close in place of High? If the forward retracement was in place at 1.2%from 
the current bar close, would it the peak be the high of the current bar, or 
the close? Or do I have it completely wrong?
 
<<Jayson said:
<<you want 
the peak of peakvalue. since peakvalue is a high you should ask for 
peak(peakvalue...... 

 <FONT 
face="MS Sans Serif"><<Peak(<FONT 
color=#282828>peakvalue,<FONT 
color=#0000ff>LastValue(<FONT 
color=#282828>MinRetracement),<FONT 
color=#ff00ff>1) 
;
<FONT face="MS Sans Serif" 
color=#282828> 
I don't 
understand this concept of peak of peak value. I 
used:
<FONT 
face=Arial>MinRetracement = <FONT 
color=#ff00ff>6/<FONT 
color=#000000>C * <FONT 
color=#ff00ff>100<FONT face=Arial 
size=2> ;


PeakValue 
=Peak(H<FONT 
color=#282828>,LastValue<FONT 
color=#282828>(MinRetracement<FONT 
color=#282828>),1<FONT 
color=#282828>) 
;
 
<BLOCKQUOTE 
>
----- Original Message ----- 
<DIV 
>From: 
<A title=jcasavant@xxxx 
href="">Jayson 
To: <A 
title=amibroker@xxxxxxxxxxxxxxx 
href="">amibroker@xxxxxxxxxxxxxxx 

Sent: Thursday, October 31, 2002 
12:45 AM
Subject: RE: [amibroker] peak - 
trough with variable

 
<SPAN 
class=266273605-31102002>Esteban,
<SPAN 
class=266273605-31102002> 
 
I'm wanting to find the last 
peak based on a fixed number of points, rather than percentage. So I 
set a variable to the fixed points value I want divided by the high * 
100 to give me a percentage to use in the peak formula. But I get an 
error. Maybe the function needs a  value not subject to 
fluctuation for  its underlying calculations. Is there a way I 
can use this function with a fixed number of points?
 
MinRetracement = <FONT 
color=#ff00ff>6/C * 100 ; This 
gives a value of 1.2 percent when C =500.


PeakValue = <FONT 
color=#0000ff>Peak(H,1.2,1) ; 
This finds the peaks like I want, when price is in the range of 
500.
PeakValue 
Peak(H,MinRetracement,1) ; Gives an error.<FONT face=Arial 
color=#0000ff><SPAN 
class=266273605-31102002> <FONT 
face="MS Sans Serif">
<SPAN 
class=266273605-31102002>you want the peak of peakvalue. since peakvalue 
is a high you should ask for peak(peakvalue...... your change  
setting must be constant so ask for the lastvalue of 
minretracement....
<SPAN 
class=266273605-31102002> 
<SPAN 
class=266273605-31102002>try......
<SPAN 
class=266273605-31102002> 
<FONT 
face=Arial>
MinRetracement = 6<FONT 
color=#282828>/C<FONT 
color=#282828> * 100<FONT 
color=#282828> ;<FONT 
size=2>
PeakValue = Peak<FONT 
color=#282828>(<FONT 
color=#000000>H<FONT 
size=2>,1.2<FONT 
color=#282828>,1) 
;<FONT 
face=Arial>
Peak(<FONT 
color=#282828>peakvalue,<FONT 
color=#0000ff>LastValue(<FONT 
color=#282828>MinRetracement),<FONT 
color=#ff00ff>1) 
;<FONT 
face=Arial>
 jayson
<SPAN 
class=266273605-31102002> 



Yahoo! Groups 
Sponsor





<FONT face=arial 
size=-2>ADVERTISEMENT<A 
href="" 
target=_blank><IMG height=250 alt="" 
src="" 
width=300 border=0 NOSEND="1">

<IMG height=1 alt="" 
src="" 
width=1 NOSEND="1">Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: 
<A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 
Post 
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
href="">http://groups.yahoo.com/group/amiquote/messages/)Check 
group FAQ at: <A 
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service.