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

[amibroker] Re: What is wrong?



PureBytes Links

Trading Reference Links

As Ara said, in the shown code snippet you don't have "barhh" defined,
only "barhh1".

Beyond that, you have the same issue I mentioned originally, that the
linear regression functions and LineArray function take scalar values
(ie. single numbers) as parameters, not arrays.

I gather you're trying to create a line from the most-recent HHV value
using the subsequent close data for every bar on the chart. As I don't
think the linear regression functions can take arrays for the period,
I think you'd need to use a loop and do the linear regression yourself
at each bar (you could call the array functions within the loop, but
since they fill a whole array each time, they would do a lot of
unnecessary work). If you do that yourself inside the loop, then at
each bar you'd have scalar 'x' and 'y' values to calculate the line
slope and so on.

For what it's worth, the BarIndex function simply gives you the bar
number. It provides a way of using the current bar number in array
formula.

Regards,
GP


--- In amibroker@xxxxxxxxxxxxxxx, "Louis P." <rockprog80@xxx> wrote:
>
> Hi,
> 
> Sorry, You can replace "periods" by 50 if you wish.   I just forgot to
> include that.
> 
> barhh1 = HHVBars( High, *50* ) ;
> bi1 = BarIndex() ;
> y11 =  LinearReg( C, barhh ) ;
> y01 =  LinRegIntercept( C, barhh ) ;
> sl1 = LineArray( bi1-barhh1+0, y01, bi1, y11, 0, True );
> 
> Still, it is not working, even if barhh1 is defined...
> 
> Louis
> 
> 2008/9/16 Ara Kaloustian <ara1@xxx>
> 
> >    y11 and y01 use "barhh" which is not defined.
> >
> > You have defined "barhh1"
> >
> >
> >
> > ----- Original Message -----
> > *From:* Louis P. <rockprog80@xxx>
> > *To:* amibroker@xxxxxxxxxxxxxxx
> > *Sent:* Tuesday, September 16, 2008 2:46 PM
> > *Subject:* [amibroker] What is wrong?
> >
> > Hi,
> >
> > What is wrong in the following formula?
> >
> > barhh1 = HHVBars( High, Periods ) ;
> > bi1 = BarIndex() ;
> > y11 =  LinearReg( C, barhh ) ;
> > y01 =  LinRegIntercept( C, barhh ) ;
> > sl1 = LineArray( bi1-barhh1+0, y01, bi1, y11, 0, True );
> >
> >
> > Thanks,
> >
> > Louis
> >
> > p.s. There was "Selectedvalue" in the first four lines but I don't
want to
> > plot it on the chart based on where I am on that chart, but simply
set the
> > variable so I can use the stuff later.
> >
> >  
> >
>



------------------------------------

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/