Thanks Graham for your reply. I still get an error message when I click on the chart or change the dates. TIA
--- In amibroker@yahoogroups.com, Graham <[EMAIL PROTECTED]> wrote: > > You might be choosing dates that do not appear in the symbol data > > StartDateBar = LastValue(ValueWhen ( DateNum () <= StartDate,BarIndex ())); > EndDateBar = LastValue(ValueWhen( DateNum () <= EndDate, BarIndex () )); > > -- > Cheers > Graham Kav > AFL Writing Service > http://www.aflwriting.com > > > > 2008/7/10 tipequity <[EMAIL PROTECTED]>: > > I have written the following code to plot % chg in price of ticker > > from starting date to ending date (using parameters). I have to > > problems: > > 1. when I change the date it crashes, point to from date in the title. > > 2. when it works, it draws a horizontal line from first visible bar > > to the starting date. I want to eliminate this line. TIA > > > > dt=DateTime(); > > StartDate = ParamDate ( "Start Date" , Date () ); > > EndDate = ParamDate ( "End Date" , Date () ); > > StartDateBar = LastValue(ValueWhen ( DateNum () == StartDate, > > BarIndex ())); > > EndDateBar = LastValue(ValueWhen( DateNum () == EndDate, BarIndex > > () )); > > > > Ticker = 0; > > > > for (Bar = StartDateBar; Bar < EndDateBar-1; Bar++) > > { > > ticker[bar] = 100 *(( C[Bar] - C[ StartDateBar ])/C [StartDateBar ]); > > //_TRACE("Bar: " + Bar + " StartDateBar " + C[ StartDateBar ] + " C > > [Bar] " + C[Bar]); > > } > > Plot( ticker, Name(), colorBlue ); > > > > SetChartOptions( 1, chartShowDates ); > > PlotGrid( 0, colorYellow ); > > Title = "From: " + WriteVal(dt[StartDateBar],formatDateTime) + " > > To: " + Date() + " - " + "{{VALUES}}" + "\n" + > > Interval(2) + " - " + _DEFAULT_NAME(); > > > > > > ------------------------------------ > > > > Please note that this group is for discussion between users only. > > > > To get support from AmiBroker please send an e-mail directly to > > SUPPORT {at} amibroker.com > > > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > > http://www.amibroker.com/devlog/ > > > > For other support material please check also: > > http://www.amibroker.com/support.html > > Yahoo! Groups Links > > > > > > > > >