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

Re: [amibroker] adaptative indicator



PureBytes Links

Trading Reference Links

Jerome,
 
Built-in CCI does not work with variable period.
You would need to re-implement it using loops or using other functions that
are variable-period enabled to have variable-period version.
 
function MeanDev( array, mean, range )
{
  result =
0
;

  
for( i = LastValue( range ) ; i < BarCount
; i++ )
   {
      result[ i ] =
0
;
      
// the mean is not 'moving' over the range (outside the loop)

      tm = mean[ i ];
      
for( j = 0; j < range[ i ] AND ( i - j ) >= 0 AND ( i - j ) < BarCount
; j++ )
      {
        result[ i ] = result[ i ] +
abs
( array[ i - j ] - tm );
      }
    
    result[ i ] = result[ i ]/range[ i ];
  }
  
  
return
result;
}

function
VarCCI( array, period )
{

 SMATP =
MA(array,period );//1,2


 MD = MeanDev( array, SMATP, period  );

 CCIx = (
Avg - SMATP) / (0.015
* MD);

 return
CCIx;

}

n =
20 + 4 * sin( Cum(1) ); // variable period


Plot(VarCCI(Avg, n),"CCIx",colorGreen,styleLine
);

//Plot(CCI(n),"CCI",colorRed,styleLine);



Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "jerome_maeder" <jerome_maeder@xxxxxxxx>
Sent: Tuesday, August 09, 2005 3:37 PM
Subject: [amibroker] adaptative indicator

> Hi!
>
> I would like to change the parameter of my indicator ( CCI for
> exemple ) after each bar. For example:
>
> Length = 0;
> Length = Length + 1;
>
> NewCCI = CCI(Length);
>
> Buy = CCI(Length) > 150;
>
> It's just a simple example, do you understand what is my problem?
> Length is an array and it's not possible to use it as a parameter!
>
> Thanks in advance!
>
> Jerome
>
>
>
>
>
>
> ------------------------ Yahoo! Groups Sponsor --------------------~-->
> <font face=arial size=-1><a href="'http://us.ard.yahoo.com/SIG=12hnqalfd/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123601941/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html">Help'>http://us.ard.yahoo.com/SIG=12hnqalfd/M=362343.6886682.7839641.1493532/D=groups/S=1705632198:TM/Y=YAHOO/EXP=1123601941/A=2894352/R=0/SIG=11fdoufgv/*http://www.globalgiving.com/cb/cidi/tsun.html">Help tsunami villages rebuild at GlobalGiving. The real work starts now</a>.</font>
> --------------------------------------------------------------------~->
>
> 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
>
> <*> 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/

>
>
>
>


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