AFL for using Multiple Commodity Channel Index (CCI) in single chart
CCI is a versatile momentum oscillator that can be used to identify overbought/oversold levels or trend reversals. The indicator becomes overbought or oversold when it reaches a relative extreme.
This indicator will allow you to display up to 3 CCI indicators with different periods in the same pane.
Script:
_SECTION_BEGIN( “CCI OVERBOUGHT / SOLD ZONE” );
CCI_OVERSOLD = Param( “CCI_OVERSOLD”, -100 );
Plot( CCI_OVERSOLD, “”, colorGreen, styleDashed );
CCI_CenterLine = Param( “CCI_CenterLine”, 0 );
Plot( CCI_CenterLine, “”, colorWhite, styleDashed );
CCI_OVERBOUGHT = Param( “CCI_OVERBOUGHT”, 100 );
Plot( CCI_OVERBOUGHT, “”, colorRed, styleDashed );
rulesExtendedZone = ParamList( “Extended Zone”, “Enable|Disable”, 0 );
if( rulesExtendedZone == “Enable” )
{
CCI_OVERSOLD2 = Param( “CCI_OVERSOLD2”, -200 );
Plot( CCI_OVERSOLD2, “”, colorGreen, styleDashed );
CCI_OVERBOUGHT2 = Param( “CCI_OVERBOUGHT2”, 200 );
Plot( CCI_OVERBOUGHT2, “”, colorRed, styleDashed );
}
_SECTION_END();
_SECTION_BEGIN( “CCI 1” );
rulesCCI1 = ParamList( “CCI 1 Toggle”, “Enable|Disable”, 0 );
if( rulesCCI1 == “Enable” )
{
CC_Period = Param( “CCI 1 Period”, 9, 2, 400, 1 );
CC = CCI( CC_Period );
Plot( CC, “CCI 1”, ParamColor( “CCI 1”, ColorYellow ), ParamStyle( “Style1” ) );
}
_SECTION_END();
_SECTION_BEGIN( “CCI 2” );
rulesCCI2 = ParamList( “CCI 2 Toggle”, “Enable|Disable”, 0 );
if( rulesCCI2 == “Enable” )
{
CC_Period = Param( “CCI 2 Period”, 14, 2, 400, 1 );
CC = CCI( CC_Period );
Plot( CC, “CCI 2”, ParamColor( “CCI 2”, ColorGreen ), ParamStyle( “Style2” ) );
}
_SECTION_END();
_SECTION_BEGIN( “CCI 3” );
rulesCCI3 = ParamList( “CCI 3 Toggle”, “Enable|Disable”, 0 );
if( rulesCCI3 == “Enable” )
{
CC_Period = Param( “CCI 3 Period”, 29, 2, 400, 1 );
CC = CCI( CC_Period );
Plot( CC, “CCI 3”, ParamColor( “CCI 3”, ColorRed ), ParamStyle( “Style3” ) );
}
_SECTION_END();