PureBytes Links
Trading Reference Links
|
Khalid, the trendline may plot a curved line on semi-log charts, but
the trendline values remain correctly aligned with the chart's price
throughout.
Making the trendline plot straight on semi-log charts would defeat the
purpose of the trendline.
jose '-)
http://www.metastocktools.com
--- In equismetastock@xxxxxxxxxxxxxxx, DKMK <dr_khalidmasood@xxx>
wrote:
>
> Dear Jose,
>
> I plotted trendline-date range indicator. It works fine on
> arithmatic charts , but does not draw straight line on semi-log
> scale.
> Will you do a favour to provide a code which allows a user to choose
> price scale. I hope you will be kind enough to reply.
>
> With respect,
> Dr.Khalid Masood
>
>
> Jose Silva <josesilva22@xxx> wrote:
>
> Chorlton, if the code is too complicated for your level of MetaStock
> expertise, you'd be better off employing the services of a
> professional programmer. This would allow you to concentrate on
> your trading strategy rather than the coding's "nuts & bolts".
>
> In the meantime, below is a trendline indicator with user-definable
> dates.
>
>
> MetaStock -> Tools -> Indicator Builder -> New
> Copy and paste formula below.
>
> ======================
> Trendline - date range
> ======================
> ---8<--------------------------
>
> { Trendline - date range v3.0
>
> Copyright 2002~2006 Jose Silva.
> For personal use only.
> All code remains the property of Jose Silva.
> http://www.metastocktools.com }
>
> { Dates user input }
> StDay:=Input("start Day",1,31,1);
> StMnth:=Input("start Month",1,12,1);
> StYear:=Input("start Year",1800,2200,2006);
> EnDay:=Input("end Day",1,31,1);
> EnMnth:=Input("end Month",1,12,6);
> EnYear:=Input("end Year",1800,2200,2006);
>
> { Selected date periods }
> start:=Year()>StYear
> OR (Year()=StYear AND (Month()>StMnth
> OR Month()=StMnth AND DayOfMonth()>=StDay));
> end:=Year()<EnYear
> OR (Year()=EnYear AND (Month()<EnMnth
> OR Month()=EnMnth AND DayOfMonth()<=EnDay));
>
> { Date signals }
> date1:=start AND Alert(start=0,2);
> date2:=end=0 AND Alert(end,2);
> date2:=Zig(end AND Cum(1)>1,1,$)=1;
>
> { Restrict out of range dates to chart }
> date1:=If(LastValue(Cum(date1))>0,date1,
> Cum(1)=1);
> date2:=If(LastValue(Cum(date2))>0,date2,
> LastValue(Cum(1))=Cum(1));
>
> { Sort dates in chronological order }
> dateOk:=LastValue(BarsSince(date1))
> >LastValue(BarsSince(date2));
> day1:=If(dateOk,date1,date2);
> day2:=If(dateOk,date2,date1);
>
> { Data Array type, levels }
> dataArray:=C;
> price1:=ValueWhen(1,day1,dataArray);
> price2:=LastValue(ValueWhen(1,day2,dataArray));
>
> { Trendline definition }
> x1:=LastValue(BarsSince(day1));
> x2:=LastValue(BarsSince(day2));
> trendline:=price1
> +BarsSince(day1)*(price2-price1)
> /Max(x1-x2,.000001);
>
> { Rem next line to extend plot to end of chart }
> {trendline:=Ref(Ref(trendline,-x2),x2)};
>
> { Plot on price chart }
> trendline
>
> ---8<--------------------------
>
>
> jose '-)
> http://www.metastocktools.com
------------------------ Yahoo! Groups Sponsor --------------------~-->
You can search right from your browser? It's easy and it's free. See how.
http://us.click.yahoo.com/_7bhrC/NGxNAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/equismetastock/
<*> To unsubscribe from this group, send an email to:
equismetastock-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|