PureBytes Links
Trading Reference Links
|
X=Cum(1);
condP=Ref(H,-1)>Ref(H,-2) AND Ref(H,-1)>H AND Ref(H,-1)>Ref(C,-2);
P=Ref(CONDP,1)*(X!=LastValue(X));
Plot(C,"",4*P+1,64);
endt= LastValue(ValueWhen( P, x, 1 ));
endS = LastValue(ValueWhen( P, H, 1 ) );
startt=LastValue(ValueWhen( P AND H>ends, x, 1 ));
startS = LastValue( ValueWhen( P AND H>ends, H, 1 ));
dtS =endt-startt;
aS = (endS-startS)/dtS;bS = endS;
tH = aS * ( x -endt ) + bS; tH1=IIf(X>STARTT-3,tH,-1E10);
Plot(tH1,"",4,1);
------=_NextPart_001_0008_01C26733.2E0B9820
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>Eugene,</FONT></DIV>
<DIV><FONT size=2>Here is the code fully aligned to your
instructions.</FONT></DIV>
<DIV><FONT size=2>As you see in AAPL, we skip 6 peaks lower than the lastone to
create the trendline linking </FONT></DIV>
<DIV><FONT size=2>peak0 with peak7, the first peak higher than
peak0.</FONT></DIV>
<DIV><FONT size=2>Dimitris Tsokakis </FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Verdana size=2> </DIV><FONT face="Times New Roman">
<DIV>X=</FONT><FONT size=2>Cum</FONT></FONT><FONT size=2>(</FONT><FONT
size=2>1</FONT><FONT face=Verdana size=2><FONT
face="Times New Roman">);</FONT></DIV><FONT face="Times New Roman">
<DIV>condP=</FONT><FONT size=2>Ref</FONT></FONT><FONT size=2>(H,-</FONT><FONT
size=2>1</FONT><FONT size=2>)></FONT><FONT size=2>Ref</FONT><FONT
size=2>(H,-</FONT><FONT size=2>2</FONT><FONT size=2>) AND </FONT><FONT
size=2>Ref</FONT><FONT size=2>(H,-</FONT><FONT size=2>1</FONT><FONT
size=2>)>H AND </FONT><FONT size=2>Ref</FONT><FONT size=2>(H,-</FONT><FONT
size=2>1</FONT><FONT size=2>)></FONT><FONT size=2>Ref</FONT><FONT
size=2>(C,-</FONT><FONT size=2>2</FONT><FONT face=Verdana size=2><FONT
face="Times New Roman">);</FONT></DIV><FONT face="Times New Roman">
<DIV>P=</FONT><FONT size=2>Ref</FONT></FONT><FONT size=2>(CONDP,</FONT><FONT
size=2>1</FONT><FONT size=2>)*(X!=</FONT><FONT size=2>LastValue</FONT><FONT
face=Verdana size=2><FONT face="Times New Roman">(X));</FONT></DIV></FONT><FONT
face=Verdana size=2><FONT face="Times New Roman">
<DIV>Plot</FONT><FONT size=2>(C,</FONT><FONT size=2>""</FONT><FONT
size=2>,</FONT><FONT size=2>4</FONT><FONT size=2>*P+</FONT><FONT
size=2>1</FONT><FONT size=2>,</FONT><FONT size=2>64</FONT></FONT><FONT
face=Verdana size=2><FONT face="Times New Roman">);</FONT></DIV><FONT
face="Times New Roman">
<DIV>endt= </FONT><FONT size=2>LastValue</FONT></FONT><FONT size=2>(</FONT><FONT
size=2>ValueWhen</FONT><FONT size=2>( P, x, </FONT><FONT size=2>1</FONT><FONT
face=Verdana size=2><FONT face="Times New Roman"> ));</FONT></DIV><FONT
face="Times New Roman">
<DIV>endS = </FONT><FONT size=2>LastValue</FONT></FONT><FONT
size=2>(</FONT><FONT size=2>ValueWhen</FONT><FONT size=2>( P, H, </FONT><FONT
size=2>1</FONT><FONT face=Verdana size=2><FONT face="Times New Roman"> )
);</FONT></DIV><FONT face="Times New Roman">
<DIV>startt=</FONT><FONT size=2>LastValue</FONT></FONT><FONT
size=2>(</FONT><FONT size=2>ValueWhen</FONT><FONT size=2>( P AND H>ends, x,
</FONT><FONT size=2>1</FONT><FONT face=Verdana size=2><FONT
face="Times New Roman"> ));</FONT></DIV><FONT face="Times New Roman">
<DIV>startS = </FONT><FONT size=2>LastValue</FONT></FONT><FONT size=2>(
</FONT><FONT size=2>ValueWhen</FONT><FONT size=2>( P AND H>ends, H,
</FONT><FONT size=2>1</FONT><FONT face=Verdana size=2><FONT
face="Times New Roman"> ));</FONT></DIV>
<DIV><FONT face="Times New Roman">dtS =endt-startt;</FONT></DIV>
<DIV><FONT face="Times New Roman">aS = (endS-startS)/dtS;bS =
endS;</FONT></DIV><FONT face="Times New Roman">
<DIV>tH = aS * ( x -endt ) + bS; tH1=</FONT><FONT size=2>IIf</FONT></FONT><FONT
size=2>(X>STARTT-</FONT><FONT size=2>3</FONT><FONT size=2>,tH,-</FONT><FONT
size=2>1E10</FONT><FONT face=Verdana size=2><FONT
face="Times New Roman">);</FONT></DIV></FONT><FONT face=Verdana size=2><FONT
face="Times New Roman">
<DIV>Plot</FONT><FONT size=2>(tH1,</FONT><FONT size=2>""</FONT><FONT
size=2>,</FONT><FONT size=2>4</FONT><FONT size=2>,</FONT><FONT
size=2>1</FONT><FONT face=Verdana size=2></FONT><FONT
face="Times New Roman">);</FONT></DIV>
<DIV></FONT> </DIV></BODY></HTML>
------=_NextPart_001_0008_01C26733.2E0B9820--
Attachment:
gif00445.gif
Attachment:
Description: "Description: GIF image"
|