Hi,
barindex() gives a rising number, every bar receives a new number.
See: Plot(BarIndex(),"Barindex",1,1);
In your code you have to define what Mybar should be.
So you could define:
Mybar = 200;
X = ValueWhen (Mybar == BarIndex(), Close);
X2 = ValueWhen(Mybar == BarIndex(),BarIndex());
Plot(BarIndex(),"Barindex",1,1);
PlotShapes(IIf(mybar==BarIndex(),shapeCircle,Null),colorRed,0,BarIndex(),0);
Title = "Close at
mybar = " + WriteVal(X);
The code plots a red dot at the bar number 200 and displays the close of
bar 200 in the title.
- - - - - - - - - - - - - - - - - - - -
Best regards
Thomas
www.tradingbasis.com
support@xxxxxxxxxxxxxxxx
- - - - - - - - - - - - - - - - - - - -
-----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of
cstrader
Sent: Sunday, January 29, 2006 5:20 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Does barindex() == require selectedvalue()?
I would like to avoid using selectedvalue in this code. Is it
possible?
X = valuewhen (Mybar == Selectedvalue(Barindex()), Close);
I'm not really sure why this code does not work:
X = valuewhen (Mybar == Barindex(), Close);
thanks in advance
------------------------ Yahoo! Groups Sponsor
--------------------~-->
Try Online Currency Trading with GFT. Free 50K Demo. Trade
24 Hours. Commission-Free.
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~->
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 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/
<*> 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/