Yep - Cum(1) forces AFL to use all past bars.

On Wed, Oct 15, 2008 at 12:14 AM, wavemechanic <[EMAIL PROTECTED]>wrote:

>    *Tony,*
>
> *I'd be interested in knowing why Cum(1) works and Barindex() doesn't.
> Any ideas?*
>
> *Bill*
>
> ----- Original Message -----
> *From:* Tony Grimes <[EMAIL PROTECTED]>
> *To:* [email protected]
> *Sent:* Tuesday, October 14, 2008 7:01 PM
> *Subject:* Re: [amibroker] Re: PlotText problem when using SelectedValue
>
>  Try this code:
>
> SlopeTest = LinRegSlope( C, 10);
>
> PlotText( "Slope\n "+ NumToStr( SelectedValue( SlopeTest ) ),
> SelectedValue( Cum(1) ), SelectedValue( L) , colorBlack);
>
>
> On Tue, Oct 14, 2008 at 4:18 PM, ozzyapeman <[EMAIL PROTECTED]> wrote:
>
>>   That is pretty weird that it's working for you and not me.
>>
>> I pasted your code into a blank AFL and applied it. The text shows up
>> on the bar where the selection happened to be. But as soon as I select
>> a new bar, no new plot text of slope values appears anywhere. Of
>> course I tried selecting many different bars and still no text.
>>
>> There must be some other funky setting or preference in my Amibroker
>> itself that is preventing the selection from working. Haven't yet
>> figured out what that could be. Any suggestions welcome.
>>
>> On another note, how did you paste your code into Yahoo with all the
>> colors properly set? When I paste from Amibroker into the Yahoo Group
>> using the Rich-Text Editor, the code is in black and white. I then
>> sometimes change the text colors manually.
>>
>> --- In [email protected] <amibroker%40yahoogroups.com>, Lal
>> <[EMAIL PROTECTED]> wrote:
>> >
>> > That's strange. Here's the complete code from my version and it
>> works fine for every bar I click/select on:
>> >
>> > SetBarsRequired(10000, 10000);
>> >
>> > SlopeTest = LinRegSlope( C, 10);
>> > PlotText( "Slope\n "+ NumToStr( SelectedValue( SlopeTest ) ),
>> SelectedValue( BarIndex() ), SelectedValue(L) , colorBlack);
>> >
>> > _SECTION_BEGIN("Price");
>> > SetChartOptions(0,chartShowArrows|chartShowDates);
>> > _N(Title= StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi
>> %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue(
>> ROC( C, 1) ) ));
>> > Plot( C, "Close", ParamColor("Color", colorBlack), styleNoTitle|
>> ParamStyle("Style") | GetPriceStyle() );
>> > _SECTION_END();
>> >
>> > Try copying/pasting this ......
>> >
>> > Lal
>> >
>> >
>> >
>> > ----- Original Message ----
>>  > From: ozzyapeman <[EMAIL PROTECTED]>
>> > To: [email protected] <amibroker%40yahoogroups.com>
>> > Sent: Tuesday, 14 October, 2008 1:00:30
>> > Subject: [amibroker] Re: PlotText problem when using SelectedValue
>> >
>> >
>> > Thanks but that does not make a difference as I already had that line
>> > in my code.
>> >
>> > --- In [EMAIL PROTECTED] ps.com, Lal <klal25@> wrote:
>> > >
>> > > Add this line at the start:
>> > >
>> > > SetBarsRequired( 10000, 10000);
>> > >
>> > > Cheers,
>> > > Lal
>> > >
>> > >
>> > >
>> > > ----- Original Message ----
>> > > From: ozzyapeman <zoopfree@ .>
>> > > To: [EMAIL PROTECTED] ps.com
>> > > Sent: Monday, 13 October, 2008 21:18:10
>> > > Subject: [amibroker] Re: PlotText problem when using SelectedValue
>> > >
>> > >
>> > > Just corrected one careless error but it still does not work
>> properly.
>> > >
>> > > I forgot to wrap the Low in a selectedvalue function. With that
>> > corrected, the slope appears on the selected bar when I first apply
>> > the indicator. But as soon as I select another bar, a new value does
>> > not appear. And even if I go back to the original bar, no more values
>> > of slopes are visible on screen:
>> > >
>> > >
>> > > PlotText("Slope\ n" + NumToStr(SelectedVa lue(SlopeTest) ),
>> > SelectedValue( BarIndex( )), SelectedValue( L), colorBlack);
>> > >
>> > >
>> > >
>> > > --- In [EMAIL PROTECTED] ps.com, "ozzyapeman" <zoopfree@> wrote:
>> > > >
>> > > > I've used PlotText successfully before, but seem to have a problem
>> > when
>> > > > using it with SelectedValue. Hope someone can help.
>> > > >
>> > > > What I am trying to achieve is pretty simple - When I click on a
>> > bar, I
>> > > > want to see the value of the slope of the 10-period linear
>> regression
>> > > > line.
>> > > >
>> > > > This is what I have:
>> > > >
>> > > > SlopeTest = LinRegSlope( C, 10);
>> > > >
>> > > > PlotText( "Slope\n " + NumToStr( SelectedValue( SlopeTest ) ),
>> > > > SelectedValue( BarIndex() ), L , colorBlack );
>> > > >
>> > > > I keep getting an error, "argument #3 has incorrect type..."
>> > > >
>> > >
>> >
>>
>>
>  ------------------------------
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.173 / Virus Database: 270.8.0/1725 - Release Date: 10/14/2008
> 9:25 PM
>
>  
>

Reply via email to