You have this DateNum () == StartDate But should be dt == StartDate
You might also find you need to add this line SetBarsRequired(10000,10000); -- Cheers Graham Kav AFL Writing Service http://www.aflwriting.com 2008/7/11 tipequity <[EMAIL PROTECTED]>: > The trace statement gives the following error message that I get: > > [2392] Bar: 2890 StartDateBar {EMPTY} C[Bar] {EMPTY} > > I don't understand why it works on loadup then it fails upon changes > to paramdate. > > > --- In [email protected], "tipequity" <[EMAIL PROTECTED]> wrote: >> >> Thanks Graham for your reply. I still get an error message when I >> click on the chart or change the dates. TIA >> >> --- In [email protected], Graham <kavemanperth@> 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 <l3456@>: >> > > 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 >> > > >> > > >> > > >> > > >> > >> > > > > ------------------------------------ > > 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 > > > >
