Hi Graham
Very interesting!! I plotted the code you provided and I
saw the blue line being drawn across the next day. The indicator you provided is
taking the 15:59 bar as the last bar of the day - the blue line always starts at
this 15:59:00 p.m. candle and then goes across the screen for the rest of the
next day, showing me the 'closing' price I have been trying to use. So...I will
use the code you gave me and review the time stamp information of my data and
try to come up with a solution. It will be interesting to try and figure out why
3:59 is being taken as the 'last bar' of the day. At any rate, I should be able
to manipulate the code you gave me to make a hack indicator that does what I
want, maybe like this
Cond= ( TimeFrameExpand( TimeFrameCompress(C, inDaily, compressLast),
inDaily, expandLast ));
Cond1=C>Cond AND Ref(C,-1)<Cond;
Plot (Cond1, "", 43, 4, 512);
In fact I just plotted this and it seems to be
doing what I expected. It's not exactly whay I want yet but I can work with it!
A hack job for you high end programmers, no doubt, but it may work for
me!
Thanks very much for taking the time - this is exactly
what I needed.
PS I am in Toronto (EST) but I am not sure how this data
was date-stamped - I got it as an Excel file from another trader. For some
reason in File--Database Settings--Intraday Settings, the per-database
settings option is timeshifted -8 hours. I remember doing this but can't
remember why - it was on the instruction of Marcin a long time ago. Anyway, I
will take it from here. Thanks again
Nikku
----- Original Message -----
Sent: Monday, October 17, 2005 1:55
AM
Subject: Re: [amibroker] Timeframe
question
Plot the data you want and see what is happening, something like
this
plot(c,"close",colorgrey50,stylecandle)
plot( timeframeexpand( timeframecompress(c, indaily, compresslast),
indaily, expandlast ), "daily", colorblue, stylestaircase);
What country are you in? Is your data in your local time or US EST time
and if so does the time of the data straddle your midnight? eg I am in
Australia and ASX market time 10am-4pm. My data comes as US times which atm is
exchange time 8pm to 2am, so it straddles my exchange midnight. AB timeframe
indaily unfortunately works against the database times, ie midnight to
midnight, so it shows from 2pm to 2pm on my charts and scans...have reported
to TJ already
best way to overcome this would be to use valuewhen until the timeframes
get fixed
YesterdayClose = valuewhen( datenum()!=ref(datenum(),1), C
);
On 10/17/05, Nikku
<nikku@xxxxxxxx> wrote:
Hi Graham
Thanks a lot for taking the time to reply. I went to
File--Database Settings--Intraday and saw that my trading day is defined as
09:30 until 17:00. Therefore all data falls between these times. Filtering
is set to 'Show 24 hours trading'. I thought that since I only have the day
session in my data, I should switch this to 'Show day session only', but
when I tried choosing that option, my chart just turned into a bunch of flat
lines instead of candles.
For Daily Time Compression uses I am using 'Exchange
Time'.
I am assuming that the field 'Base Time Interval'
which is available under Database settings is not relevant since it was
fixed when I created the database.
Unfortunately, the indicator I am trying to write,
which now looks very simple, like this
cond=TimeFrameGetPrice("C",inDaily,-1);
Cond1=C>Cond;
Plot (Cond1,"",43,4,
512);
is not providing me with what
I need. The last bar of the day, the one that is sometimes 4:02, sometimes
4:05 etc etc is not the bar which is providing the 'closing price' variable
which I need, the price above which I want a signal on the next trading day.
I am trying to figure out exactly what prices are being used but it is
not clear to me at this time.
I have a feeling that this is
a problem with the Database settings but I don't know how to fix it.
I am trying to use the help to figure
this out right now, so I might get lucky tonight - any more comments are
appreciated.
Nikku
----- Original Message -----
Sent: Sunday, October 16, 2005 6:02
PM
Subject: Re: [amibroker] Timeframe
question
Nikku
It reads the times as per your settings in File-Databse Settings -
Intraday for the market hours
To get yesterday's close you can use timeframegetprice with
shift=-1
On 10/17/05, Nikku <nikku@xxxxxxxx>
wrote:
Hi everyone
Those who know me know that I am no programmer,
but I'm willing to try before asking. Here is what I am facing today.
I have NAZ 100 data from 3/3/04 to 11/2/2004, 1
minute bars. I wanted to try to write an indicator which
would determine yesterdays close and then give a signal when the
closing price of the current 1 minute bar exceeded yesterdays
close. I came up with this. Remember, the chart and the data set are 1
minute intervals.
Cond=TimeFrameSet(inDaily);
Cond1=Ref(C,0);
Cond2=Ref(O,0);
TimeFrameRestore();
Cond3=C>TimeFrameExpand(Cond1,inDaily);
Plot(Cond3,"",43,4,512);
(By the way, I initially tried Ref(c,-1) to
reference yesterdays close but for some reason, the formula then looked
at the close 2 days ago).
So lo and behold - this thing seems to be working!!
I can observe the closing price from the day before and then I see
that when the current day's 1 minute bar closes above that, I get a
signal. However...
My data is such that at the end of the trading day,
the last bar is sometimes given at 4:01 p.m., sometimes at 4:03 p.m.,
sometimes they even go on until 4:08 p.m. The formula I have created,
however, seems to be assuming that the price at 3:59:00 p.m. is the
closing price, because sometimes, if the 4:00:00 bar closes higher than
the 3:59:00 bar, my indicator often goes off. Even if this
doesn't happen, I can see that the signals I am getting are related
to the yesterdays 3:59:00 bar and not the very last bar in yesterdays
data. The price from 3:59:00 is the one that is the formula is saying is
the 'close'. Now, sometimes the 3:59:00 price is close enough to the
actual final bar of the day that this doesn't make much difference, but
sometimes it isn't. This is the first problem I am having.
The second is this - Right now, the software
seems to be rounding off to the nearest whole number when determining
the closing price. I have figured this out by drawing a horizontal line
through the closing price at the 'last' bar of the day before (actually
the 3:59:00 bar!!) and then seeing EXACTLY when the trigger is given the
next day, if of course one is given.
Any help is appreciated.
Nik
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
--
Cheers Graham AB-Write >< Professional AFL Writing
Service Yes, I write AFL code to your requirements http://e-wire.net.au/~eb_kavan/ab_write.htm
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
-- Cheers Graham AB-Write >< Professional AFL
Writing Service Yes, I write AFL code to your requirements http://e-wire.net.au/~eb_kavan/ab_write.htm
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
|