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

[amibroker] Timeframe question



PureBytes Links

Trading Reference Links

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
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software Investment software


YAHOO! GROUPS LINKS