PureBytes Links
Trading Reference Links
|
You're the man. Thanks it works beautifully.
--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> Sorry ignore previous response as I made mistake, tried to stop it
> sending but was too slow
>
> I had a quick look at your total code and made some mods to help.
here
> is one way to do it
>
> SetBarsRequired(10000,10000);
> da = Date();
> dn = DateNum();
> bi = BarIndex();
>
>
> StartDate = ParamDate ( "Start Date" , da );
> EndDate = ParamDate ( "End Date" , da );
>
> StartDateBar = LastValue( ValueWhen ( dn <= StartDate ,bi ) );
> EndDateBar = LastValue( ValueWhen( dn <= EndDate, bi ) );
>
> StartDateC = LastValue( ValueWhen ( dn <= StartDate ,C ) );
> EndDateC = LastValue( ValueWhen( dn <= EndDate, C ) );
>
> Ticker = IIf( bi>=StartDateBar, 100 * ( C - StartDateC ) /
StartDateC, Null );
>
> Plot( ticker, Name(), colorBlue );
>
> SetChartOptions( 1, chartShowDates );
> PlotGrid( 0, colorYellow );
> Title =
> "From: " + WriteVal( DateTimeConvert( 2, StartDate ),
formatDateTime )
> + " To: " + WriteVal( DateTimeConvert( 2, EndDate ),
formatDateTime )
> + " - " + "{{VALUES}}" + "\n"
> + Interval(2) + " - " + _DEFAULT_NAME();
>
>
> --
> Cheers
> Graham Kav
> AFL Writing Service
> http://www.aflwriting.com
>
>
>
>
> 2008/7/11 Graham <kavemanperth@xxx>:
> > 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 <l3456@xxx>:
> >> 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 amibroker@xxxxxxxxxxxxxxx, "tipequity" <l3456@> wrote:
> >>>
> >>> Thanks Graham for your reply. I still get an error message when
I
> >>> click on the chart or change the dates. TIA
> >>>
> >>> --- In amibroker@xxxxxxxxxxxxxxx, 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
<*> 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/
|