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

[amibroker] Re: Three Day Weekend



PureBytes Links

Trading Reference Links

Graham,
the actual start/end may be solved in many ways.
In order to avoid tedious istrue AND isempty, you may have them both 
through Sum(EXIST,2). It will be equal to 1 for both the START and 
the [next to the] END of the line.
Draw an AB [from left to right !!] and 

 Plot(C,"C",1,64);X=BarIndex();
DL=Study("AB",GetChartID());
exist=IsTrue(DL);
LIMITS=Sum(EXIST,2)==1;
PlotShapes(shapeUpTriangle*LIMITS,colorRed);
Plot(EXIST,"TRUE",colorWhite,2+styleOwnScale);
STARTX=LastValue(ValueWhen(Limits,X,2));
ENDX=LastValue(-1+ValueWhen(Limits,X,1));
STARTY=LastValue(ValueWhen(X==STARTX,DL));
ENDY=LastValue(ValueWhen(X==ENDX,DL));
Title="STARTX="+WriteVal(STARTX,1.0)+", ENDX="+WriteVal(ENDX,1.0)+", 
STARTY="+WriteVal(STARTY)+", ENDY="+WriteVal(ENDY);;

Dimitris Tsokakis

--- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> Dimitris, thanks for that. 
> It also assumes the last bar of the 2 drawn lines to be the end of 
the
> chart. I cannot get it to use the actual last bar of the drawn 
lines. OK if
> the lines are right extended to, or past, the last bar. The prices 
are ok
> for the ends, just put onto the wrong bar.
> I have tried different methods to get the right end bar number for 
the lines
> to no avail.
> 
> Cheers,
> Graham
> http://e-wire.net.au/~eb_kavan/
> 
> -----Original Message-----
> From: DIMITRIS TSOKAKIS [mailto:TSOKAKIS@x...] 
> Sent: Sunday, June 27, 2004 3:36 PM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: Fib lines from manual study lines
> 
> Graham,
> thank you for sharing this.
> You should add, in the beginning, a SetBarsRequired(10000,10000); 
to 
> help if QuickAFL is enabled.
> One more note [for my codes also] : 
> We both suppose the line is drawn from left to right ! 
> If you draw f1 or f2 from right to left, there is no result.
> We should add some min(t1,t2) to avoid this.
> Dimitris Tsokakis
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > Hope DT hasn't already done this one, but his work in automated 
> angled
> > sup/res lines got me to thinking drawing angled Fibonacci levels. 
> The built
> > in fib tool is good, but only uses horizontal lines, so I thought 
I 
> would do
> > one for any pair of drawn lines.
> > 
> > Just draw 2 lines on the price chart and name them F1 and F2 in 
the 
> line
> > properties window. You can add or delete lines, change % and 
> colours just
> > using the fibline statement per the last few lines of the code.
> > 
> > Plot(C,"",colorBlack,styleBar);
> > 
> > Upper=ValueWhen(NOT IsNull( Study("f1",GetChartID())
> > ),Study("f1",GetChartID()));
> > Lower=ValueWhen(NOT IsNull(
> > Study("f2",GetChartID())),Study("f2",GetChartID()));
> > 
> > TLB = ValueWhen( Upper AND IsNull(Ref(Upper,-1)), BarIndex());
> > TLP = ValueWhen( Upper AND IsNull(Ref(Upper,-1)), Upper );
> > TRB = ValueWhen( Upper ==LastValue(Upper), BarIndex());
> > TRP = ValueWhen( Upper ==LastValue(Upper), Upper );
> > 
> > BLB = ValueWhen( Lower AND IsNull(Ref(Lower,-1)), BarIndex());
> > BLP = ValueWhen( Lower AND IsNull(Ref(Lower,-1)), Lower );
> > BRB = ValueWhen( Lower ==LastValue(Lower), BarIndex());
> > BRP = ValueWhen( Lower ==LastValue(Lower), Lower );
> > 
> > procedure FibLine(x,y)
> > {
> > LB = LastValue( BLB+(TLB-BLB)*x );
> > RB = LastValue( BRB+(TRB-BRB)*x );
> > LP = LastValue( BLP+(TLP-BLP)*x );
> > RP = LastValue( BRP+(TRP-BRP)*x );
> > Line = LineArray( LB, LP, RB, RP ,0 );
> > Plot( Line, "Line "+(x*100)+"%", y, styleLine);
> > }
> > 
> > FibLine(0.5,colorRed);
> > FibLine(0.618,colorBlue);
> > FibLine(0.382,colorGreen);
> > FibLine(1.618,colorRed);
> > FibLine(-0.618,colorRed);
> > 
> > 
> > Cheers,
> > Graham
> > http://e-wire.net.au/~eb_kavan/
> 
> 
> 
> 
> Check AmiBroker web page at:
> http://www.amibroker.com/
> 
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> Yahoo! Groups Links



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
     amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/