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

Days Between Peak and Trough



PureBytes Links

Trading Reference Links

x =Cum(1);per=3;s1=L;s11=H;pS=TroughBars(s1,per,1)==0;
endt=LastValue(ValueWhen(pS,x));/*trough time*/
pR=PeakBars(s11,per,1)==0; 
endt1=LastValue(ValueWhen(pR,x));/*peak time*/
interval=endt-endt1;

For the rest, if it means something to you, you may look at
http://www.amibroker.com/library/detail.php?id=105
at the second comment, where you may calculate the time interval
between the 3rd peak and the 5th trough or any other rank.
D. T.

----- Original Message ----- 
From: Anthony Faragasso 
To: DIMITRIS TSOKAKIS 
Sent: Sunday, October 07, 2001 12:29 PM
Subject: Days Between Peak and Trough


Hi Dimitri; 
If Possible, could you Help, Thank you in Advance. 
I am writing a detection formula which requires starting points ( x ) and (a ), with ( x ) always being the 
starting point , whether it be a trough or peak. I would like to have codecheck if trough is before peak 
or after peak, 
Thank you. 
Anthony 

------=_NextPart_001_000E_01C14F6A.A89EED80
Content-Type: text/html;
charset="iso-8859-7"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-7" http-equiv=Content-Type>
<META content="MSHTML 5.00.3013.2600" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Anthony,</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">If we have PEAK, 
TROUGH, PEAK, TROUGH, etc it would be easy.</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">Unfortunately, as you 
see in gif, we may have two or more successive peaks</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">between two troughs 
and vice versa.</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">the only sure thing 
is the time interval between the LAST peak and the LAST trough</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">which is</FONT><FONT 
size=2></FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman" 
size=2></FONT>&nbsp;</DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman" size=2>x 
=Cum(1);per=3;s1=L;s11=H;pS=TroughBars(s1,per,1)==0;</FONT></DIV>
<DIV><FONT size=2>endt=LastValue(ValueWhen(pS,x));/*trough time*/</FONT></DIV>
<DIV><FONT size=2>pR=PeakBars(s11,per,1)==0; </FONT></DIV>
<DIV><FONT size=2>endt1=LastValue(ValueWhen(pR,x));/*peak time*/</FONT></DIV>
<DIV><FONT size=2>interval=endt-endt1;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=2>For the rest, if it means something to you, you may look 
at</FONT></DIV>
<DIV><A href="http://www.amibroker.com/library/detail.php?id=105";><FONT 
size=2>http://www.amibroker.com/library/detail.php?id=105</FONT></A></DIV>
<DIV><FONT size=2>at the second comment, where you may calculate the time 
interval</FONT></DIV>
<DIV><FONT size=2>between the 3rd peak and the 5th trough or any other 
rank.</FONT></DIV>
<DIV><FONT size=2>D. T.</FONT></DIV>
<DIV style="FONT: 10pt arial">&nbsp;</DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">----- Original 
Message ----- </FONT></DIV>
<DIV style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><FONT 
face="Times New Roman">From: </FONT><A href="mailto:ajf1111@xxxx"; 
title=ajf1111@xxxx><FONT color=#000000 face="Times New Roman">Anthony 
Faragasso</FONT></A><FONT face="Times New Roman"> </FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">To: </FONT><A 
href="mailto:TSOKAKIS@xxxx"; title=TSOKAKIS@xxxx><FONT color=#000000 
face="Times New Roman">DIMITRIS TSOKAKIS</FONT></A><FONT face="Times New Roman"> 
</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">Sent: Sunday, October 
07, 2001 12:29 PM</FONT></DIV>
<DIV style="FONT: 10pt arial"><FONT face="Times New Roman">Subject: Days Between 
Peak and Trough</FONT></DIV>
<DIV><BR></DIV>
<DIV><FONT size=2>Hi Dimitri; </FONT></DIV>
<DIV><FONT size=2>If Possible, could you Help, Thank you in Advance. <BR>I am 
writing a detection formula which requires starting points ( x ) and ( a 
),&nbsp; with ( x ) always being the <BR>starting point , whether it be a trough 
or peak.&nbsp; I would like to have code check if trough is before peak <BR>or 
after peak,&nbsp;<BR>Thank you. <BR>Anthony </FONT></DIV></BODY></HTML>

------=_NextPart_001_000E_01C14F6A.A89EED80--

Attachment:
gif00207.gif

Attachment: Description: "Description: GIF image"