Ken,

 

I just use this type of code to mark intraday bars. This is for 15 minute code, but wouldn't really matter what the timeframe was (provided you had a bar starting at the indicated time). Sorry, but I don't have the time to go through your code example. I hope this helps.

 

myOpen      = IIf(DateNum() != Ref(DateNum(),-1),1,0);

weekOpen    = IIf(DayOfWeek() < Ref(DayOfWeek(),-1),1,0); //Sunday = 0, Saturday = 6 so if the today < previous day it must be a new week.

closingTime = 160000; //To be modified by Holidays include for early close days

myClose     = Ref(TimeNum(),-1) < closingTime AND TimeNum() >= closingTime; //Marks last trading bar of the day without looking into the future.

Tooearly    = TimeNum() < 094500; //Subject to change. Currently not used anywhere

 

Here is some use of the above code.

 

AtClose = TimeNum() == closingTime - 1500 OR TimeNum() == closingTime OR TimeNum() == closingTime + 1500;

Jumpin  = TimeNum() == closingTime OR TimeNum() == closingTime + 1500;

. . .

Plot(myClose,"",colorBlack,styleHistogram+styleDashed+styleOwnScale);

--

Terry

-----Original Message-----
From:
[email protected] [mailto:[email protected]] On Behalf Of Ken Close
Sent: Monday, October 09, 2006 14:58
To:
[email protected]
Subject: [amibroker] Still Looking for Help with Intraday Bars

 

I still am looking for some words about how to identify a given bar in Intraday mode.  I would like to enter a "Buy Date & Time" and have a trailing stop plotted from this point.  I posted my full code, in Daily mode, in another message.  I am trying to get the same functionality in Intraday mode.

 

I created the following code to help me understand things like TimeNum(), DateTime(), etc.  I have seen that BarIndex() changes depending on the interval selected.  I also notice that the quality of the data in the intraday database is important. I use QuoteTracker, set for 1 minute data gathering.  Sometimes it misses bars (esp if the application isn't running at the start of the market).  So the number of bars reported from BarIndex in 30 min mode is not double the number of bars reported in hourly mode.

 

Here is the test code I wrote.

 

Plot(C,"Close",colorRed,styleCandle);

Ix = Interval(0)/60;

T = TimeNum();

DT = DateTime();

DN = DateNum();

BI = BarIndex();

E3 = EMA(C,3);

e21 = EMA(C,21);

Up = Cross(E3,E21);

Dn = Cross(E21,E3);

Plot(E3,"E3 -- Interval = " + WriteVal(Ix,1.0) + " Min",colorBlue,styleLine);

Plot(E21,"E21 -- BarIndex = " + WriteVal(BarIndex(),1.0),colorRed,styleLine);

//Title = WriteVal( DateTimeConvert( 2, BuyDate ), formatDateTime );

Plot(Null,"TimeNum = " + WriteVal(DT,formatDateTime),colorWhite,styleLine);

Plot(Null,"\nDateNum() = " + WriteVal(DT,1.0) + "TimeNum = " + WriteVal(t,1.0),colorBlue,styleLine);

PlotShapes(Up*shapeUpArrow,colorGreen);

PlotShapes(Dn*shapeDownArrow,colorRed);

BuyDate = 442;//1061005;

On = BI == Buydate;

PlotShapes(On*shapeUpTriangle,colorAqua);

 

Can someone suggest a way to enter the BuyDate easily.  Right now I am thinking to display the bar number, then write in the code, like above, the Bar Number for the BuyDateTime.

 

Is there a number that represents the combination of the Date and Time?  If you plot the above code, the number showing up for DateNum is an impossibly long and non obvious number.

 

Any help out there on this issue???

 

Ken

 

 

__._,_.___

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
Software support Small business finance Business finance online
Business finance training Business finance course

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

__,_._,___

Reply via email to