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

Re: [amibroker] Code Help



PureBytes Links

Trading Reference Links

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@xxxxxxxxxx>:
> 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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

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