PureBytes Links
Trading Reference Links
|
Better
SetBarsRequired(100,100);
range= int(MFI(14));
mean=MA(Avg,range);//1,2
array=Avg;
result = 0;
for( i = 0 ; i < BarCount; i++ )
{
if(i<range[i])
result[i]=Null;
else
{
result[ i ] = 0;
// the mean is not 'moving' over the range (outside the loop)
tm = mean[ i ];
for( j = 0; j < range[i]; j++ )
{
result[ i ] = result[ i ] + abs( array[ i - j ] - tm );
}
result[ i ] = result[ i ] / range[i];
}
}
CCIx = (Avg - mean) / (0.015 * result);//5,6,7
Plot(CCIx,"CCIx",colorGreen,styleLine);
Plot(CCI(14),"CCI",colorRed,styleLine);
Plot(Range,"Range",colorBlue,styleLine|styleOwnScale);
>
> hope it helps
> change the range with any variable positive and not null period
>
> and // the afl cci
>
>
> range= 20;//MFI(14);
> mean=MA(Avg,range);//1,2
> array=Avg;
> result = 0;
>
>
>
> for( i = 0 ; i < BarCount; i++ )
> {
> if(i<range[i])
> result[i]=Null;
> else
> {
> result[ i ] = 0;
> // the mean is not 'moving' over the range (outside the loop)
> tm = mean[ i ];
> for( j = 0; j < range[i]; j++ )
> {
> result[ i ] = result[ i ] + abs( array[ i - j ] - tm );
> }
>
> result[ i ] = result[ i ] / range[i];
> }
> }
>
> CCIx = (Avg - mean) / (0.015 * result);//5,6,7
> Plot(CCIx,"CCIx",colorGreen,styleLine);
> Plot(CCI(range),"CCI",colorRed,styleLine);
>
>
> >
> > could anyone help? Maybe TJ?
> >
> > Thanks in advance
> > Hans
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Hans" <hansib@xxxx> wrote:
> > >
> > > Hello,
> > >
> > > I need some help.
> > >
> > > My goal is to have a CCI with variable period so that bars
since
> buy
> > > or sell that exceeds 10 are the new CCI period.
> > >
> > > I have coded this:
> > >
> > > p4=10;
> > >
> > > bs=BarsSince(Buy OR Sell);
> > > pp=Max(bs,p4);
> > > CC=CCI(pp);
> > >
> > > Buy=Cover=Cross(Cc,-100);
> > > Sell=Short=Cross(100,Cc);
> > >
> > > **********
> > > problems are initialization of arrays.
> > > how can i consider buy/sell before calculation, and at the same
> time
> > > to make calculations i need buy/sell.
> > >
> > > Thanks for any help.
> > >
> > > Hans
------------------------ Yahoo! Groups Sponsor --------------------~-->
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> 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/
|