Hi Ken,
The error is due to the test for DB name,
sorry, I forgot about that - about 5 lines down, try changing the DB name
from "Data-TC2005" to the name of your TC2K DB. I remember when I was
writing it that my original intent was about the same as yours, but I discovered
that I liked it better using only the range markers and leaving the vertical
line free for other things. So in the code, setting the first range marker
calculates from that point to the end, then if you set the second
range marker, it moves up the end of range to the second marker. Or, here
is some quick code that does that:
SetBarRequired( 100000, 100000 )
BarNumber = BarIndex();
if ( BeginValue( BarNumber) ) ) // if beginning range marker is set
{
StartBar = BeginValue( BarNumber );
EndBar = EndValue( BarNumber );
}
for ( i = Startbar + 1; i <= EndBar, i++ )
...calculate % change...
If you still want to use the vertical line, try
this:
BarNumber = BarIndex();
if ( SelectedValue( BarNumber ) != LastValue( BarNumber ) )
// a bar is selected
Steve
----- Original Message -----
Sent: Saturday, January 07, 2006 8:01
AM
Subject: RE: [amibroker] SelectedValue vs
BeginValue
Steve:
Hats off to you for programming that code.
Wow!
I played with it momentarily but always got a "T1 not
defined" and could not afford the time to delve in to make it work. No
even sure I could make it work, and really didn't comprehend the
"approach". But it works for you and more power to
you.
Thanks for the offer. I was hoping for a simple one
or two line suggestion on detecting whether a pole has been planted or a range
marker has been set up.
Ken
Hi Ken,
Maybe you can modify the attached code - it
plots relative price change of TC2K sectors, and is pretty flexible in
allowing you to use different ways to select your time periods. If I
remember right, you used to use TC2K? If so, it should work for you right
out of the box.
Steve
----- Original Message ----- From:
"Ken Close" <closeks@xxxxxxxx> To:
<amibroker@xxxxxxxxxxxxxxx> Sent: Friday, January 06, 2006 10:06
PM Subject: [amibroker] SelectedValue vs BeginValue
>I would
like to calculate %price change in the Title. > > If there is
neither a vertical pole or initial range marker, I would like > the
return to be from the first data point to the current or last data >
point > (closing price of course). > > If a vertical pole is
planted (click once), then I want to calculate > change > from
the pole to the last value. > > If two range markers are placed
(F12 and then Shift-F12), then I would > like > to calculate
change from the dates (barindexes) between the range markers. > >
I am sure this is simple, but I am having trouble telling the formula >
whether a vertical pole (SelectedValue) has been planted or whether a >
range > marker (BeginValue) has been planted. > > Any
suggestions will be appreciated. > > Ken > > --
> No virus found in this outgoing message. > Checked by AVG Free
Edition. > Version: 7.1.371 / Virus Database: 267.14.14/222 - Release
Date: 1/5/2006 > > > > > > 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 > > > > > > >
-- No virus found in this incoming message. Checked by
AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.14/222 -
Release Date: 1/5/2006
-- No virus found in this outgoing message. Checked by
AVG Free Edition. Version: 7.1.371 / Virus Database: 267.14.15/223 -
Release Date: 1/6/2006
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
SPONSORED LINKS
YAHOO! GROUPS LINKS
|