PureBytes Links
Trading Reference Links
|
Another option.
If you toss a coin enough times you will end up with 50/50 heads
tails.
The chance of tossing the second head is still 0.5.... this assumes
independency.
You can use serial dependency formulas to calculate depenendency:
refer to google, RalphVince or Howard Bandy (I seem to recall that
Howard gives some AFL code in his book Quantatative Trading Systems).
I use this quick and dirty method:
logic == of there is dependency the ratio of ups that follow the
firstup will be > 0.5 probability
Filter = 1;
Up = Cum(Ref(ROC(C,1),-1) > 0);
SUp = Cum(Ref(ROC(C,1),-1) > 0 AND ROC(C,1) > 0);
AddColumn(Up,"Up",1,1);
AddColumn(SUp,"SecondUp",1,1);
//AddColumn(BarCount,"Count",1,1);
AddSummaryRows(1,1);
Plot(Up,"Up",1,1);
Plot(SUp,"SecondUp",1,1);
Also, since every streak (run) starts with a trend reversal you can
count bars in trend by:
find the pivot that starts the trend
count barsince(pivot)
pivot = Ref(ROC(C,1),-1) < 0 and ROC(C,1) > 0;
Note: there are other definitions of a pivot but that is my preferred
you can use Param functions to change the field.
--- In amibroker@xxxxxxxxxxxxxxx, "Soham" <sohamdas@xxx> 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/
|