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

Re: Auto Channels/Triangles/Wedges Ver. 1.1



PureBytes Links

Trading Reference Links

Here is the revised code. The lines now don't extend back to the
first data point, but start from the third most recent peak or
trough, and adjust automatically from one stock to another. 

Nand.

+++++++++++++++++++code list starts here. Pastr in indicator window. 
Best viewed in half or full sheet.++++++++++++++

//Channel,Triangle,Wedge Formations//

perchg =10; // 10 percent swings, can be changed

maxgraph=5;
//===================get bottom trendline
btx = cum(1);
btstartvalue = lastvalue( trough( low, perchg, 1 ) );
btendvalue = lastvalue( trough( low, perchg, 2 ) );
btstartbar = lastvalue( valuewhen( low ==btstartvalue, btx, 1 ) );
btendbar = lastvalue( valuewhen( low == btendvalue, btx, 1 ) );

bta = (btendvalue-btstartvalue)/(btendbar-btstartbar);
btb =btstartvalue;
bottrendline = bta * ( btx - btstartbar ) + btb; 
//==================get top trendline
pkx = cum(1);
pkstartvalue = lastvalue( peak( high, perchg, 1 ) );
pkendvalue = lastvalue( peak( high, perchg, 2 ) );
pkstartbar = lastvalue( valuewhen( high == pkstartvalue, pkx, 1 ) );
pkendbar = lastvalue( valuewhen( high == pkendvalue, pkx, 1 ) );

topa = (pkendvalue-pkstartvalue)/(pkendbar-pkstartbar);
topb = pkstartvalue;
toptrendline = topa * ( pkx - pkstartbar ) +topb; 
//===========draw lines on a price chart
graph0 = close;
graph0style=64;
graph0color=2;

pdaysback=lastvalue(peakbars(high,perchg,3));
graph1=iif(cum(1)>lastvalue(cum(1))-pdaysback,toptrendline,0.99*low);
graph1style=5;
graph1barcolor=iif(cum(1)>lastvalue(cum(1))-(pdaysback-1) ,5,0);

tdaysback=lastvalue(troughbars(low,perchg,3));
graph2=iif(cum(1)>lastvalue(cum(1))-tdaysback,bottrendline,0.99*low);
graph2style=5;
graph2barcolor=iif(cum(1)>lastvalue(cum(1))-(tdaysback-1),5,0);

//====end for now




--- In amibroker@xxxx, "Christos Panayiotou" <pachris@xxxx> wrote:
> Hello
> Congratulations for the excellent work , can you please write your 
completed
> formula for us?
> Best regards Christos
> ----- Original Message -----
> From: <nkishor@xxxx>
> To: <amibroker@xxxx>
> Sent: 12 August 2001 21:52
> Subject: [amibroker] Re: Auto Channels/Triangles/Wedges
> 
> 
> 
> Yes! Fantastic. Andrew's Pitcfork shouldn't be hard to now.
> 
> Thank you for you AFL tips and tricks.
> 
> nnad
> 
> --- In amibroker@xxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> wrote:
> > Nand,
> > Since only the last 90 days will be visible,
> > do the same with the function.
> > Instead
> > graph2style=5;
> > graph2color = 5;
> > graph2=bottrendline;
> > you may have
> >
> > graph2=iif(cum(1)>lastvalue(cum(1))-91,bottrendline,0.99*low);
> > graph2style=5;
> > graph2barcolor=iif(cum(1)>lastvalue(cum(1))-90,5,0);
> >
> > and the same changes to other lines.
> >
> > If you have 90 in both lines, graph and color, your graph will be
> > the half of an ANDREW´S PITCHFORK.
> > (Some software presented that as a FIRST RATE Automation
> > success, the AUTOMATIC ANDREW´S PITCHFORK !!)
> >
> > The invisible of your "bottrendline" will be 1% minus low, so
> > you will not be out of limits so much.
> >
> > DIMITRIS TSOKAKIS
> >
> > P. S. If all is O.K., you said something for wedges and triangles.
> > Shall we be happy to see them in your next code ?
> > Good luck.
> > --- In amibroker@xxxx, nkishor@xxxx wrote:
> > >
> > > Thanks for the feedback.
> > >
> > > However, if the lines are still there, the charts will still not
> > > look nice for some tickers because the lines extend to the very
> > > beginning of the data.
> > >
> > > We need a way to start the line 90 days past today, that is only
> > > part of the line. Some the array should become empty prior to
> > > the 90 days.
> > >
> > > thanks again
> > >
> > > nand
> > >
> > >
> > > --- In amibroker@xxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> 
wrote:
> > > > Nand,
> > > > You can limit the lines to the last 90 days.
> > > > Instead of
> > > > graph2color = 5;
> > > > you may write
> > > > graph2barcolor=iif(cum(1)>lastvalue(cum(1))-90,5,0);
> > > > The lines will be there, but they are not visible.
> > > > The last 0 is if your ground color id grey.
> > > > I use blue and I must write
> > > > graph2barcolor=iif(cum(1)>lastvalue(cum(1))-90,5,3);
> > > >
> > > > Dimitris Tsokakis
> > > > --- In amibroker@xxxx, nkishor@xxxx wrote:
> > > >
> > > > > If you know how to limit the lines, say for the last 3
> months,
> > > then
> > > > > the charts will look even better.
> > > > >
> > > > > Nand
> > > > > --------------------------------------------------------
> > > > > graph2color = 5;
> 
> 
> 
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/