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

[amibroker] Re: Resetting an indicator at the start of a session



PureBytes Links

Trading Reference Links

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@xxx> 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

<*> 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/