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

Re: [Metastockusers] Re: Drawing horizontal line from a previous day to today



PureBytes Links

Trading Reference Links

This is easy enough to do. Here's the procedure.

Determine the ending point of the line. This can be signalled either with a single bar true or a
signal that goes true and stays true from that point onward.

Use LastValue(BarsSince()) to count the bars since the single bar spike was true or the solid true
was false. If you're using the second of these options then the result will be one greater than the
first option, and you'll need to subtract one to get the correct number of bars to blank. You now
have a constant of the number of bars to be blanked. If you don't use LastValue() then the number
can't be used in the subsequent Ref() functions.

The next step in the process is to shift the plot that number of bars to the right, then shift it
the same number of bars to the left.

Here's an example with the end of your code modified to remove the plot for 2004. Notice that the
inner Ref() is processed first so the plot you started with is moved to the right then to the left.
Hope this makes sense.

Roy

fmDay:=Input("Date from (dd)",1,31,1);
fmMonth:=Input("Date from (mm)",1,12,1);
fmYear:=Input("Date from (yyyy)",1980,2099,2003);

toDay:=Input("Date to (0 - last day)",0,31,31);
toDay:=If(toDay=0,LastValue(DayOfMonth()),toDay);
toMonth:=Input("Date to (0 - last month)",0,12,12);
toMonth:=If(toMonth=0,LastValue(Month()),toMonth);
toYear:=Input("Date to (0 - last year)",0,2099,2003);
toYear:=If(toYear=0,LastValue(Year()),toYear);

afterFrom:=(DayOfMonth()>=fmDay AND Month()=fmMonth AND Year()
=fmYear) OR (Month()>fmMonth AND Year()=fmYear) OR Year()>fmYear;
beforeTo:=(DayOfMonth()<=toDay AND Month()=toMonth AND Year()=toYear)
OR (Month()<toMonth AND Year()=toYear) OR Year()<toYear;

X:=afterFrom AND beforeTo;
Y:=ValueWhen(1,X,C);
Z:=LastValue(BarsSince(X));
Ref(Ref(Y,-Z),+Z);



> Roy,  How can I draw a line bewteen only two points.  I can start the
> line at the time period when I want, but when the period has elapsed
> the line keeps going at its last value. (I hope this makes some
> sense?)
>
> Anyway the code I am using is:
>
> fmDay:=Input("Date from (dd)",1,31,1);
> fmMonth:=Input("Date from (mm)",1,12,1);
> fmYear:=Input("Date from (yyyy)",1980,2099,2003);
>
> toDay:=Input("Date to (0 - last day)",0,31,31);
> toDay:=If(toDay=0,LastValue(DayOfMonth()),toDay);
> toMonth:=Input("Date to (0 - last month)",0,12,12);
> toMonth:=If(toMonth=0,LastValue(Month()),toMonth);
> toYear:=Input("Date to (0 - last year)",0,2099,2003);
> toYear:=If(toYear=0,LastValue(Year()),toYear);
>
> afterFrom:=(DayOfMonth()>=fmDay AND Month()=fmMonth AND Year()
> =fmYear) OR (Month()>fmMonth AND Year()=fmYear) OR Year()>fmYear;
> beforeTo:=(DayOfMonth()<=toDay AND Month()=toMonth AND Year()=toYear)
> OR (Month()<toMonth AND Year()=toYear) OR Year()<toYear;
>
> ValueWhen(1,afterFrom AND beforeTo,C)
>
> You might notice the horizontal line at the level of the last closing
> price on the last day in the period.  This is the portion I would
> like to get rid of, leaving only the data within the specified time
> frame.
>
> Any assistance would be appreciated.  Thanks in advance.
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
>  http://groups.yahoo.com/group/Metastockusers/
>
> To unsubscribe from this group, send an email to:
>  Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
>
> Your use of Yahoo! Groups is subject to:
>  http://docs.yahoo.com/info/terms/
>
>
>
>



 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/Metastockusers/

To unsubscribe from this group, send an email to:
 Metastockusers-unsubscribe@xxxxxxxxxxxxxxx

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