PureBytes Links
Trading Reference Links
|
Hi,
this loop example can be a starting point ( limited
to 500 previous bars)
SetBarsRequired(<FONT color=#ff00ff
size=1>100000,<FONT color=#ff00ff
size=1>100000);
period=255<FONT face="Courier New"
size=1>;
for ( i=period; i<BarCount ; i++)
{
k=0<FONT
face="Courier New" size=1>;
for ( j=1<FONT
face="Courier New" size=1>; j<period ; j++)
{
if(H[i]>H[i-j])
k++ ;
}
Tot[i]=k;
}
Plot(tot,<FONT
face="Courier New" color=#ff00ff size=1>""<FONT face="Courier New"
size=1>,2<FONT
face="Courier New" size=1>,<FONT face="Courier New" color=#ff00ff
size=1>1);
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
<A title=backup_dayad@xxxxxxxxxxxx
href="">Kropotkin
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Tuesday, July 27, 2004 5:19
PM
Subject: [amibroker] Re: days since
higher price
I should check - am I reinventing the wheel here? My basic
aim is to be able to find new highs without limiting the search to a
certain period (e.g. if I search for prices crossing the prior 100 period
high, this will miss the break of a 110 day high, and so on). Is this
built into a function? or has someone already written the code for
this? I've looked but can't find anything.
ThanksChris--- In amibroker@xxxxxxxxxxxxxxx, "Kropotkin"
<backup_dayad@xxxx> wrote:> I'm trying to find how many days
since there was a higher price than > today's. This works:>
>
Condition=H>LastValue(H);>
nH=BarsSince(Condition);> > (thanks to those who helped me with
this, incl Dimitris).> > > The problem is that
LastValue(H) is not suitable for backtesting, as > it will reference
forward to the final bar. > > How can I get around it? Is there
a way I can reference the bar for > which the exploration is being
done? > > Or can I turn the variable BarIndex() for the present
day, from an > array into a number? (Then e.g. I could call that number
"today" and > use "Condition=H>H[today];")> > ( I want
this scan to also run quickly for when I do intraday scans, > so if
possible I'd rather avoid using Cum or If functions which > require
computations for every bar of the stock ).> > Thanks, >
ChrisCheck AmiBroker web page at:<A
href="">http://www.amibroker.com/Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
__________
NOD32 1.823 (20040726) Information __________This message was checked
by NOD32 antivirus system.<A
href="">http://www.nod32.com
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Sponsor
ADVERTISEMENT
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 the Yahoo! Terms of Service.
|