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

[amibroker] Re: HHV (?) Question



PureBytes Links

Trading Reference Links


Graham,

Thanks you for your will to help. I guess I haven't clarified myself 
properly.

With your permission, I'll try to explain: In AmiBroker (as far as I 
know it - I might be wrong), there's no way to access "current" bar. 
For example, if you write "High", the program itself iterate 
internally through all "High" field prices (from Bar=0 to Barcount-
1), and retrieves the value for the "current" bar. When I 
write "current", I refer to the Bar "currently" being iterated. 

Now, I wrote a function that gets a Bar reference as a parameter and 
returns a value (different for each bar). I'm interest to call this 
function (while backtesting), in order to 
compare its "delivered" value with the Low/High/Close. 
My question is, do I have to create an array with function values 
prior to writing the Buy and Sell rules, or is there any way to send 
to the function the "current" Bar being iterated so it can deliver a 
value back? 

Here's an example:

function Calculate(Bar) {
// Just a simple example
Result=(High[Bar]+Low[Bar])/2;
return Result;
}

Now I'd like to write something like this:

Buy=Calculate(Bar)>Close;


Yes, I know that in this case, I can write it in AFL without the 
function (just using arrays). But suppose I'm interested to write it 
in the way described. How can I send the "currently iterated" bar to 
the function? (that will replace 'Bar' in the example above).

Thank you,

Short.

--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> wrote:
> Glad I could help.
> 
> Sorry I don't understand what you are trying to do with current 
bar?
> 
> 
> On Sun, 27 Feb 2005 08:50:32 -0000, the_short_fox 
<theshortfox@xxxx> wrote:
> > 
> > 
> > Graham, that's brilliant. Thanks!
> > BTW, is there any way to access the (current) Bar? I have a 
function
> > I wrote that gets a Bar as a parameter and returns a value. It 
is of
> > interest to call this function each bar during backtest, in 
order to
> > allow it to "deliver" its value. Is there any way to send
> > the "current" bar, or one must create an array with function 
values
> > prior to actually backtesting?
> > 
> > Thanks.
> > 
> > Short.
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> 
wrote:
> > > Short, something like this may work
> > >
> > > Buy = H>ref(hhv(h,10),-1) and ref(hhv(h,10),-1)<ref(hhv(h,20),-
1);
> > >
> > >
> > >
> > >
> > > On Sat, 26 Feb 2005 23:18:15 -0000, the_short_fox
> > <theshortfox@xxxx> wrote:
> > > >
> > > >
> > > > Hi All,
> > > >
> > > > Suppose I'd like to code something like: Buy if,
> > > >
> > > > (1) Today's high is higher than the highest price of the 
last 10
> > > > bars. and,
> > > > (2) None of the last 10 bars represent (themselves) a 20 day
> > high.
> > > >
> > > > I know how to code (1), but as I'm only studying the syntax 
of
> > AFL,
> > > > I experience difficulties with (2). Would someone please 
give a
> > > > hand? Thank you in advance.
> > > >
> > > > Short.
> > > >
> > > >
> > > > Check AmiBroker web page at:
> > > > http://www.amibroker.com/
> > > >
> > > > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Cheers
> > > Graham
> > > http://e-wire.net.au/~eb_kavan/
> > 
> > 
> > Check AmiBroker web page at:
> > http://www.amibroker.com/
> > 
> > Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > Yahoo! Groups Links
> > 
> > 
> > 
> > 
> > 
> 
> 
> -- 
> Cheers
> Graham
> http://e-wire.net.au/~eb_kavan/





------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/