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

[amibroker] Re: Weekly chart indicator for an EOD daily database



PureBytes Links

Trading Reference Links

Thank you again Graham!

This new code (see below) eliminated the duplicated candles. I would 
have never thought of doing it this way. Thank you.

One last question: Is it possible to remove the monday thru thursday 
dates leaving only the friday dates.  After applying the changes you 
suggested the monday through friday dates are blank and leave large 
gaps when plotted.

How do I eliminate the gaps and plot only the weekend dates? 


// Weekly Bar Chart in a worksheet with a daily interval
_SECTION_BEGIN("Weekly Graph");
TimeFrameSet( inWeekly );
wo = O;
wh = H;
wl = L;
wc = C;
TimeFrameRestore();
dow = DayOfWeek();
wo = IIf(dow>Ref(dow,1), TimeFrameExpand(wo,inWeekly), Null);
wh = IIf(dow>Ref(dow,1), TimeFrameExpand(wh,inWeekly), Null);
wl = IIf(dow>Ref(dow,1), TimeFrameExpand(wl,inWeekly), Null);
wc = IIf(dow>Ref(dow,1), TimeFrameExpand(wc,inWeekly), Null);
//wo = TimeFrameExpand(wo,inWeekly);
//wh = TimeFrameExpand(wh,inWeekly);
//wl = TimeFrameExpand(wl,inWeekly);
//wc = TimeFrameExpand(wc,inWeekly);
_N(Title = StrFormat("{{NAME}} -  {{DATE}} Open %g, Hi %
g, Lo %g, Close %g (%.1f%%) {{VALUES}}", wO, wH, wL, wC, SelectedValue
( ROC( C, 1 ) ) ));

PlotOHLC( wo, wh, wl, wc, "Weekly Close", colorBlack, styleCandle );
_SECTION_END();




--- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxx> wrote:
>
> that monthly was create before the timeframe functions were created 
by TJ
> The weekly on a daily period chart does give the same value for 
each day of
> the week unitl the next week ends.
> To get just one candle, on say the last day of the week you could 
try
> dow = dayofweek();
> wo = iif(dow>ref(dow,1), TimeFrameExpand(wo,inWeekly), null);
> 
> now this will give a bar showing only on the last day of the week 
(eg
> Friday)
> 
> for monthly you just change all the inweekly to inmonthly
> 
> The other method to show both daily and weekly would be to open a 
new linked
> window and have this window set this to weekly. They will scroll  
in psynch
> with each other as far as the days for that week or month
> 
> -- 
> Cheers
> Graham
> AB-Write >< Professional AFL Writing Service
> Yes, I write AFL code to your requirements
> http://e-wire.net.au/~eb_kavan/ab_write.htm
> 
> On 18/09/06, Tony <talcamo@xxx> wrote:
> >
> > Graham,
> >
> > Thank you.
> >
> > I had originally tried coding the indicator the way you mentioned(
> > see below). However, this code applies the same candle 5 times for
> > each day in the week, rather than just one candle for each week. I
> > guess this is because the interval is still daily on the worksheet
> > tab.
> > I could just create another tab whose interval could be weekly 
and I
> > could get the data i am looking for, however it would be nice to 
have
> > the indicator available on the daily worksheet. I know it has been
> > done for a monthly indicator, by Graham Kavanagh
> > http://www.amibroker.com/library/formula.php?id=249
> >
> >
> > Am i doing something obviously incorrect? Am i missing something 
else?
> > I would the indicator to display in the title: weekdate, Open, 
high,
> > low, close
> >
> >
> > // Weekly Bar Chart in a worksheet with a daily interval
> > _SECTION_BEGIN("Weekly Graph");
> > TimeFrameSet( inWeekly );
> > wo = O;
> > wh = H;
> > wl = L;
> > wc = C;
> > TimeFrameRestore();
> > wo = TimeFrameExpand(wo,inWeekly);
> > wh = TimeFrameExpand(wh,inWeekly);
> > wl = TimeFrameExpand(wl,inWeekly);
> > wc = TimeFrameExpand(wc,inWeekly);
> > _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, 
Hi %
> > g, Lo %g, Close %g (%.1f%%) {{VALUES}}", wO, wH, wL, wC, 
SelectedValue
> > ( ROC( C, 1 ) ) ));
> >
> > PlotOHLC( wo, wh, wl, wc, "Weekly Close", colorBlack, 
styleCandle );
> > _SECTION_END();
> >
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@> wrote:
> > >
> > > You need to use timeframeexpand function to get the weekly to 
fit
> > the daily
> > > chart
> > > eg
> > > wo = timeframexpand(wo,inweekly);
> > >
> > > --
> > > Cheers
> > > Graham
> > > AB-Write >< Professional AFL Writing Service
> > > Yes, I write AFL code to your requirements
> > > http://e-wire.net.au/~eb_kavan/ab_write.htm
> > >
> > >
> > > On 16/09/06, Tony <talcamo@> wrote:
> > > >
> > > > Hi everyone... newbie here.
> > > >
> > > > I have been trying to test Dr Elders formula for Triple 
screen,
> > for
> > > > which there is a AFL formula in the www.amibroker.com/library.
> > > >
> > > > There are indicators provided within the AFL script. However, 
the
> > > > Weekly chart indicator does not work correctly. The OHLC 
ranges
> > are
> > > > not correct and are not displayed by weekdate. See below.
> > > >
> > > > // Weekly Bar Chart
> > > > //_SECTION_BEGIN("Weekly Graph");
> > > > //TimeFrameSet( inWeekly );
> > > > //wo = O;
> > > > //wh = H;
> > > > //wl = L;
> > > > //wc = C;
> > > > //TimeFrameRestore();
> > > > //PlotOHLC( wo, wh, wl, wc, "Weekly Close", colorCustom9,
> > styleBar );
> > > > //_SECTION_END();
> > > > //_SECTION_BEGIN("EMA");
> > > > //P = ParamField("Price field",-1);
> > > > //Periods = Param("Periods", 15, 2, 200, 1, 10 );
> > > > //Plot( EMA( P, Periods ), _DEFAULT_NAME(), ParamColor
( "Color",
> > > > colorYellow ),ParamStyle("Style") );
> > > > //_SECTION_END();
> > > >
> > > > I have been looking for a Weekly chart indicator which 
displays
> > OHLC
> > > > by week in our user group and the AFL library. I can only 
find a
> > > > working monthly created by Graham Kavanagh 26 Dec 2002 in the
> > > > amibroker/library (very cool script that uses java script 
within
> > the
> > > > AFL).
> > > >
> > > > The logic to build this indicator does not seem trivial. Does
> > anyone
> > > > have a working version of a Weekly chart indicator which will
> > work on
> > > > an EOD daily database? It would be beneficial to display in 
the
> > > > title: weekdate, Open, High, low, close.
> > > >
> > > > Thank you in advance for your help. We should post this 
indicator
> > so
> > > > it is easily available for everyone.
> > > >
> > > > Tony
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > 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
> > > >
> > > >
> > > > 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 other support material please check also:
> > http://www.amibroker.com/support.html
> >
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>