PureBytes Links
Trading Reference Links
|
Dan,
Many times a Future trading after hours will have no trades for more
than 15 minutes. It is better to specify the exact time desired. In
my case, I also run volume and range based bars which usually have a
start time before the end of day, and span the 15 minute market closed
time period. I set all my bars for start time stamps. I have to be
careful with my time comparisons or I would miss the closing time
since it is the middle of a bar. Makes it tricky to specify when and
at what price to go flat for the day.
BR,
Dennis
On May 20, 2008, at 5:00 PM, monitorit wrote:
> Sidhartha70
> You said:
> I consider the open the 16:30 night session start and close
> the 16:15 day session end the following day.
>
> To find the first bar of a session consider:
>
> barsSinceStart= BarsSince(TimeNum()>Ref(TimeNum(),-1)+1499)+1;
>
> // this says barsSinceStart==1 when this bar is 15 or more minutes
> after the prior bar. It will be 1 whenever this is true [ie, no
> trade for 15 or more minutes... if you change the > to == 1500 it
> will be when exactly 15 miinutes. check your bar times as you may
> have to change this constant - read TimeNum() and DayofYear() ].
>
> Now are there any qpFeed users out there who can help me with my last
> two posts re data problems?
> Dan
>
>
>
>
>
> --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@xxx>
> wrote:
>>
>> Dennis,
>>
>> like you I'm looking at 24 hour futures. Specifically the S&P E-mini
>> right now. I consider the open the 16:30 night session start and
> close
>> the 16:15 day session end the following day. I have my database
>> intraday settings set up as such.
>>
>> Clearly AmiBroker has this info because it plots vertical session
>> lines at the session break each day.
>>
>> You are very probably right Dennis, and I need to hard code some
> kind
>> of time checking mechanism to reset my indicator to zero each
> session
>> start... I just intuitively thought AFL might have a hardcoded set
> of
>> flags like this already.
>>
>> Thanks
>>
>> --- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@> wrote:
>>>
>>> Sidhartha70,
>>>
>>> AB database settings allow you to filter the data based on market
> open
>>> hours. I don't think AB knows when a holiday or half day is.
> The
>>> charts skip them simply because there was no trades when the
> market
>>> was closed, so no data.
>>>
>>> However, I am charting Futures contracts which trade almost 24
> hours a
>>> day, so I do not filter anything at the database level except
>>> weekends. I take all trade data and do my own filtering. For
> many
>>> indicators, the extra after hours trading smoothes out the
> indicators
>>> for the start of the regular trading day. Those trades after
> hours in
>>> response to news do influence the next days trading. Many
> indicators
>>> have time domain factors and will behave badly if they are given
> a gap
>>> at the open. Resetting is just like a gap for some indicators.
> You
>>> must carefully pick the reset state values --and it may depend on
> the
>>> open price.
>>>
>>> BR,
>>> Dennis
>>>
>>> On May 20, 2008, at 1:56 PM, sidhartha70 wrote:
>>>
>>>> Dennis,
>>>>
>>>> you are absolutely right... that's exactly what I do mean. 1
>>>> instrument... with an indicator run across a large time series
> (i.e. 1
>>>> year)... and each new trading day (session) resetting the
> indicator.
>>>>
>>>> Dennis, I've eyeballed your code and I think I know what's
> going on.
>>>> My only question is, given the charts I can see before my eyes,
>>>> AmiBroker clearly knows when a session begins, when it's a
> weekend or
>>>> a holiday etc... because it plots the graphs perfectly as
> defined.
>>>>
>>>> On that basis is really necessary to re-code it...? Are there
> not some
>>>> flags (booleans) within AFL that signify things like the
> starting bar
>>>> of a session, each and every session...?
>>>>
>>>> Sorry if I sound off base here... like I say I've come from C#
>>>> world!!!
>>>>
>>>>
>>>>
>>>> -- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@> wrote:
>>>>>
>>>>> Dingo, Sidhartha70,
>>>>>
>>>>> Sorry, I thought the question about starting the indicator
> over each
>>>>> trading session (ie., trading day).
>>>>>
>>>>> BR,
>>>>> Dennis
>>>>>
>>>>> On May 20, 2008, at 12:48 PM, dingo wrote:
>>>>>
>>>>>> IMHO you should seriously read thru the list of functions in
> the
>>>>>> help file.
>>>>>> And you should do this at least twice per year.
>>>>>>
>>>>>> Look at the "stocknum" param in the following:
>>>>>>
>>>>>> http://www.amibroker.com/guide/afl/afl_view.php?id=141
>>>>>>
>>>>>> You can test to see if the result is = 0 which will indicate
> the
>>>>>> start.
>>>>>>
>>>>>> d
>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: amibroker@xxxxxxxxxxxxxxx
>>>>>>> [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of sidhartha70
>>>>>>> Sent: Tuesday, May 20, 2008 12:29 PM
>>>>>>> To: amibroker@xxxxxxxxxxxxxxx
>>>>>>> Subject: [amibroker] Re: Resetting an indicator at the start
>>>>>>> of a session
>>>>>>>
>>>>>>> Dennis,
>>>>>>>
>>>>>>> Thank you. I will take a look at the code.
>>>>>>>
>>>>>>> First question... goodness. Is there a really easy way to
> know if
>>>>>>> we
>>>>>>> are at the start of a session...?? A flag of some sort that
> gets
>>>>>>> set
>>>>>>> at the start of the session...?
>>>>>>>
>>>>>>> Sorry, I come from C# world...
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> --- In amibroker@xxxxxxxxxxxxxxx, Dennis Brown <see3d@>
> wrote:
>>>>>>>>
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> Here is a snippet of AFL from my system that is concerned
>>>>>>> with what
>>>>>>>> you are looking for. Sift through it and see if it gives
>>>>>>> you any ideas.
>>>>>>>>
>>>>>>>> // Generate the Holiday mask so we don't backtest trading
>>>>>>> or use in
>>>>>>>> volume calculations
>>>>>>>> Holiday = 1;
>>>>>>>> for(i=0; StrExtract(HolidayList,i)!=""; i++){Holiday &=
>>>>>>> BarDates !=
>>>>>>>> StrToNum(StrExtract(HolidayList,i));}
>>>>>>>> Halfday0 = 1;
>>>>>>>> for(i=0; StrExtract(HalfdayList,i)!=""; i++){Halfday0 &=
>>>>>>> BarDates !=
>>>>>>>> StrToNum(StrExtract(HalfdayList,i));}
>>>>>>>> Halfday = Halfday0 | BarTimes <= 130000;
>>>>>>>> // Major US equity markets open/close markers
>>>>>>>> MarketOpen = Holiday AND Halfday AND BarTimes >= 93000 AND
>>>>>>> BarTimes <=
>>>>>>>> 160000;
>>>>>>>> FirstTradeBar = Cross(MarketOpen,.5);
>>>>>>>> LastTradeBar = Cross(.5,MarketOpen);
>>>>>>>> // Market volume valid mask
>>>>>>>> ValidVolBars = MarketOpen AND Halfday0;
>>>>>>>> // Time of day to place trades mask
>>>>>>>> EntryTimes = TimeNum() >= TradeBeg AND TimeNum() <=
> TradeEnd-
>>>>>>>> TradeEnd2; //time of day to place new trades
>>>>>>>> EntryTimes &= HalfDay & Holiday;
>>>>>>>> ExitTimes = TimeNum() >= TradeBeg AND TimeNum() <=
>>>>>>> TradeEnd; //time of
>>>>>>>> day to place exits
>>>>>>>> ExitTimes &= HalfDay & Holiday;
>>>>>>>> // Go flat at end of day bar
>>>>>>>> LastDayTradeBar = Cross(TimeNum() >= TradeEnd,.5) |
>>>>>>> Cross(0.5,HalfDay);
>>>>>>>>
>>>>>>>> BR,
>>>>>>>> Dennis
>>>>>>>>
>>>>>>>> On May 20, 2008, at 11:17 AM, sidhartha70 wrote:
>>>>>>>>
>>>>>>>>> Herman et al,
>>>>>>>>>
>>>>>>>>> any thoughts on this...?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70"
> <sidhartha70@>
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Herman,
>>>>>>>>>>
>>>>>>>>>> thanks for this. very interesting.
>>>>>>>>>>
>>>>>>>>>> however, exactly what i'm trying to do is completely
> reset an
>>>>>>>>>> indicator at the beginning of each session. the
>>>>>>> indicator is forming
>>>>>>>>>> part of an oscillator, so i want to cumulative a value
>>>>>>> over over each
>>>>>>>>>> session, and then reset it to zero.
>>>>>>>>>>
>>>>>>>>>> is there an easy way of doing that?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ------------------------------------
>>>>>>>>>
>>>>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>>>>>>>>> http://www.amibroker.com/devlog/
>>>>>>>>>
>>>>>>>>> For other support material please check also:
>>>>>>>>> http://www.amibroker.com/support.html
>>>>>>>>> Yahoo! Groups Links
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------
>>>>>>>
>>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>>>>>>> http://www.amibroker.com/devlog/
>>>>>>>
>>>>>>> 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.
>>>>>>> Version: 8.0.100 / Virus Database: 269.23.21/1456 - Release
>>>>>>> Date: 5/20/2008 6:45 AM
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------
>>>>>>
>>>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>>>>>> http://www.amibroker.com/devlog/
>>>>>>
>>>>>> For other support material please check also:
>>>>>> http://www.amibroker.com/support.html
>>>>>> Yahoo! Groups Links
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------
>>>>
>>>> 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 NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
>>>> http://www.amibroker.com/devlog/
>>>>
>>>> For other support material please check also:
>>>> http://www.amibroker.com/support.html
>>>> Yahoo! Groups Links
>>>>
>>>>
>>>>
>>>
>>
>
>
>
> ------------------------------------
>
> 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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> http://www.amibroker.com/devlog/
>
> For other support material please check also:
> http://www.amibroker.com/support.html
> Yahoo! Groups Links
>
>
>
------------------------------------
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|