PureBytes Links
Trading Reference Links
|
I believe that ValueWhen will do what you want, as shown below.
PrevClose = Ref(Close, -1);
Indices = BarIndex();
Rising = Close > PrevClose;
FailureBars = ValueWhen(NOT Rising, Indices);
ConsecutiveRise = Indices - FailureBars;
Colors = IIF(Rising, colorDarkGreen, IIF(Close < PrevClose,
colorDarkRed, colorLightGrey));
Plot(ConsecutiveRise, "Consecutive Up Bars", Colors, styleLine |
styleOwnScale);
Plot(Close, "Close", Colors, styleNoTitle | styleBar);
Mike
--- In amibroker@xxxxxxxxxxxxxxx, "Soham" <sohamdas@xxx> wrote:
>
> The issue is I want to handle the consecutive days.
>
> For example, for those who have read Curtis Faith, I want to check
if
> my market is trending and quite as opposed to trending and violent.
> That is having huge violent ups and downs.
>
> In effect, I am trying to check, if its possible to use breakout
rules
> in Indian markets.
>
> I am stuck here:
> My code goes something like this:
>
> LongTrigger= C>BBandTop(C,22,1.5);
>
> if(LongTrigger==1)
> {
> //count the number of *consecutive* days when the closing prices
> exceed the previous close
> }
> Additionally I will include more studies, into this, as to when it
> indeed retraces, how much does it retrace.etc etc.
> I am not able to find a way to implement the internal pseudocode
> elegantly. Sum() and Cum() just counts the number of up down days in
> some period.Not consecutively.
>
> Looking for some insight and help
>
> Soham
> --- In amibroker@xxxxxxxxxxxxxxx, "Soham" <sohamdas@> wrote:
> >
> > Hi guys,
> >
> > Although I am familiar with AFL but strangely finding myself not
able
> > to get my work done.
> >
> > I am having a requirement to:
> >
> > 1. Count the number of days,Close is above [or below] the
bollinger band
> > 2. And count the number of days for which it has trended in the
same
> > direction.
> >
> > I would additionally love to see, a standard histogram of
trending days.
> >
> > Can you help me out?
> >
> >
> > Soham
> >
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL 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/
|