MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

A B C D E F G H I J K L M N O P R S T U V W Y Z #

Trendline - Date Range by Jose Silva

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: chorlton_c_hardy <micro_dot_uk__at__hotmail.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Saturday, June 3, 2006, 10:09:08 AM
Subject: [EquisMetaStock Group] Support & Resistance levels

Hello All,

Is there anyway that I can draw a line on my chart which represents a Support / Resistance (S/R) level and then refer to that same line in an exploration?

I've mananged to find a way to do it if the S/R line is horizontal by creating a new indicator which plots the horizontal line at a determined level and then referring to it in an exploration but this obviously doesn't work if I have a S/R level which is not horizontal.
ie. trending upwards or downwards!!

Can anyone offer any advice as to how I overcome this?

Thanks...
Chorlton

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22__at__yahoo.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Sunday, June 4, 2006, 12:20:38 AM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

Chorlton, you will need to first code and then reference your trendline for your exploration.

You'll find some examples of coded trendlines at http://www.metastocktools.com/#metastock

"2-point plot" - coding example of 2-point, x/y line plot - useful for creating automatic chart trendlines.

"LinReg Trendline v4" - Linear Regression Trendline with Standard Deviation/Error Channels/Bands, date-adjustable.

"TrendLine" - adjustable automatic trendline.

"Benchmark trendline" - plots a performance benchmark trendline based on a fixed % yearly growth rate - with several user inputs.

jose '-)
http://www.metastocktools.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: chorlton_c_hardy <micro_dot_uk__at__hotmail.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Sunday, June 4, 2006, 2:27:48 PM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

Hi Jose,

Firstly, Thanks for the reply & the link.

I've taken a look but the indicators there seem a bit more complicated than what I'm after. As my programming skills aren't the best, ideally, I would like to just start off small with regard to programming the indicator and then build on it in the future.

Consequently, would it be possible for you to tell me how I could simple enter 2 previous dates and then plot a line across my chart which goes through both the closes for those days but which would also extend up to todays date?

Is this quite complicated or is it relatively straight forward?

Any help much appreciated,

Chorlton

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22__at__yahoo.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Sunday, June 4, 2006, 11:51:15 PM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

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

{ Trendline - date range v3.0

CCopyright 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


 

jose '-)
http://www.metastocktools.com

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: chorlton_c_hardy <micro_dot_uk__at__hotmail.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Monday, June 5, 2006, 10:26:56 AM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

Jose,

Thanks very much for your reply/comments. Ultimately, I do want to learn the language though so I can program my own code in the future.

At the moment though my MS manual is in storage which means I keep having to refer to the online help for assistance. However, after reading through the code below (and the code for the various other indicators on your site) I am slowly beginning to understand the different commands. Together with the online help I should be able to understand what part does what!!

Once again, thanks for your time and advice.......

All the best,
Chorlton

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: DKMK <dr_khalidmasood__at__yahoo.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Monday, June 5, 2006, 6:02:45 AM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

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

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From: Jose Silva <josesilva22__at__yahoo.com>
To: equismetastock__at__yahoogroups.com <equismetastock__at__yahoogroups.com>
Date: Tuesday, June 6, 2006, 2:48:21 AM
Subject: [EquisMetaStock Group] Re: Support & Resistance levels

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

Source / From: TOP
Metastockusers[at]yahoogroups[dot]com  

Equis and MetaStock® and MetaStock Professional® are registered trademarks of Equis International. Achelis Binary Wave®, The DownLoader®,
Expert Advisor®, OptionScope®, Quotecenter® and Smart Charts® are trademarks of Equis International, a Thomson Reuters company.

TradeStation® Pro, TradeStation® 2000i, OptionStation®, SuperCharts®, PowerEditor® and EasyLanguage®
are registered trademarks of TradeStation Technologies, Inc. Other names and marks referred to are the property of their respective owners.

All information provided on this website is for educational purposes only. Trading involves risk, including possible loss of principal and other losses.

Ten i inne materiały na tej stronie zostały zamieszczone zostały jedynie w celach edukacyjnych, nie ponoszę żadnej odpowiedzialno¶ci za ich stosowanie.

Gra na giełdzie i rynkach walutowych (FOREX) niesie ze sob± ryzyko poważnych strat finansowych!