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

[amibroker] Bar index of last visible bar



PureBytes Links

Trading Reference Links

I'm writing an indicator. Searching the newsgroup archives, I found 
(posted 3/2/2003) what I thought was my answer to determining the bar 
index of the last visible bar:

"
Tomasz posted this to the member section a while ago......
 
barvisible = Status("barvisible");
r = RSI( 14 );
maxr = LastValue( Highest( IIf( barvisible, r, 0 ) ) );
"

So it would seem that:

aVisBars = Status("barvisible");
nLastVisBar = LastValue(Highest(IIf(aVisBars, BarIndex(), 0)));

should work, where nLastVisBar holds the barindex of the last visible 
bar. However, nLastVisBar always has a value of 0 when I access it in 
code. Also, the help says that Highest returns a NUMBER, but it seems 
to be an ARRAY. Without the use of the LastValue() function, I can't 
use nLastVisBar in an IF statement. 

That way I initialize nLastVisBar, btw, is at the top of an 
indicator. The value is then used to control a for loop. 

If anyone can see the error I must be missing, I would appreciate it.

Gordon



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/