Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

A Simple and Efficient CCI Trading System for Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
trading system, amibroker

Commodity Channel Index (CCI) is an oscillator indicator which accurately identifies overbought or oversold levels. It was developed by Donald Lambert in 1980, and was originally supposed to be used exclusively for commodities trading, but later it found its application in Stocks and Futures as well. CCI compares current price to the average price for a given time period. If the current price is greater than the average price CCI indicates Overbought condition, while if the current price is less than average price CCI indicates Oversold condition. CCI value oscillates between two extremes, hence its is particularly useful for Mean reversion Trading systems. However CCI divergence can be used to identify trends too.

Read more about this system and download backtest report here

Screenshots

Indicator / Formula

Copy & Paste Friendly
//------------------------------------------------------
//
//  Formula Name:    CCI Trading system
//  Author/Uploader: Trading Tuitions
//  E-mail:          support@tradingtuitions.com
//  Website:         www.tradingtuitions.com
//------------------------------------------------------

_SECTION_BEGIN("CCI Trading System");

SetBarsRequired( sbrAll );
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C ));

//Initial Parameters
SetTradeDelays( 1,1,1, 1 );
SetOption( "InitialEquity", 200000);
SetOption("FuturesMode" ,True);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",100);
SetOption("AccountMargin",10);
SetOption("RefreshWhenCompleted",True);
SetPositionSize(150,spsShares);
SetOption( "AllowPositionShrinking", True );

Plot( Close, "Price",colorWhite, styleCandle );

CCISlow=Param("CCISlow",30,30,100,10);
CCIFast=Param("CCIFast",10,5,30,5);
 
Buy = Cross( CCI(CCIFast), 0 ) AND CCI(CCIFast) > CCI(CCISlow) ;
 
Short = Cross( 0,CCI(CCIFast)) AND CCI(CCIFast) < CCI(CCISlow);

Sell=Short;
Cover=Buy; 

BuyPrice=Open;
SellPrice=Open;
ShortPrice=Open;
CoverPrice=Open;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

printf("\nBuy : " + Buy );  
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  

StopLoss=Param("SL",2,1,10,1);
Target=Param("Target",5,5,40,5);
ApplyStop(Type=0,Mode=1,Amount=StopLoss);
ApplyStop(Type=1,Mode=1,Amount=Target);
 
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();

2 comments

1. pkgmtnl

How does these Codes :-

StopLoss=Param("SL",2,1,10,1);
Target=Param("Target",5,5,40,5);
ApplyStop(Type=0,Mode=1,Amount=StopLoss);
ApplyStop(Type=1,Mode=1,Amount=Target);

works in actual market when AFL works in Live
can any 1 advise

2. culion

Have you looked at the equity curve for this system?

Leave Comment

Please login here to leave a comment.

Back