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

Re: [amibroker] Intra-Day Database Setup



PureBytes Links

Trading Reference Links



Pete,
 
below an example how to do it,
 
rgds, Ed
 
 
starttime = 093000;
endtime = 160000;
 
timecond = TimeNum() >= starttime AND TimeNum() <= endtime;
 
firstBarOfDay = TimeNum() >= starttime ;firstBarOfDay = firstBarOfDay - Ref(firstBarOfDay,-1);
lastBarOfDay = TimeNum() >= endtime;lastBarOfDay = lastBarOfDay - Ref(lastBarOfDay,-1);
 
myHigh = ValueWhen( timecond, HighestSince( firstBarOfDay, High) );
myLow = ValueWhen( timecond, LowestSince( firstBarOfDay, Low) );
myClose = ValueWhen(lastBarOfDay,C);
 
DH = TimeFrameCompress(myHigh, inDaily, compressLast);
DL = TimeFrameCompress(myLow, inDaily, compressLast);
DC = TimeFrameCompress(myClose, inDaily, compressLast);
 
DH = Ref(DH,-1);
DL = Ref(DL,-1);
DC = Ref(DC,-1);
 
YHigh = TimeFrameExpand( DH, inDaily, expandFirst );
YLow = TimeFrameExpand( DL, inDaily, expandFirst );
YClose = TimeFrameExpand( DC, inDaily, expandFirst );
 
 
 
 
----- Original Message -----
From: Pete
Sent: Sunday, July 19, 2009 5:44 AM
Subject: [amibroker] Intra-Day Database Setup

 

There is a topic in the help files titled "Database Settings". There is a section where it explains how to use the trading hours to define precisely how time-compression works. I would like to know how I can set the Day/Night session start and end times such that the time compression will only take the O,H,L,C from between the market open at 9:30 am eastern to the market close at 4:00 pm eastern.

I have spent hours trying to adjust these values and then wright a simple code which accurately calculates daily moving averages using time compression in a intra-day time frame. No matter what I try I am always left with assigning the values of O,H,L,C using the TimeNum() >= 093000 and TimeNum() <= 160000 statements.

The goal is the able to use a simple code:
Timeframeset(indaily);
DlyH = H;
DlyL = L;
DlyMA = MA(H-L,10);
Timeframerestore(indaily);
Plot(Timeframeexpand(DlyMA,indaily), "Dly H-L", colorRed, StyleLine);

Thanks.

Pete :-)



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___