Welcome Features News Download Registration Support FAQ Wish list Links
Advanced stock charting and analysis program

AFL Library

This is read-only version of AFL library entry. Ability to add user formulas and comment is only available from members-only area.

Details:

Formula name: Coppock Trade Signal on Price Chart
Author/Uploader: rcef88 -
Date/Time added: 2009-01-27 13:12:18
Origin: Edwin Sedgwick Coppock
Keywords: Coppock, weighted moving average, rate of change
Level: medium
Flags: indicator

DISCLAIMER: Most formulas present in AFL on-line library are submitted by the users and are provided here on an "as is" and "as available" basis. AmiBroker.com makes no representations or warranties of any kind to the contents or the operation of material presented here. We do not maintain nor provide technical support for 3rd party formulas.
Description:

Based on Edwin Sedgwick Coppock\'s original work to generate Buy and Sell signals on price chart. All the parameters are, however, adjustable including the Coppock Filter to filter out the market noise.

Formula:

/*
Coppock Trade Signal on Price Chart v1.0 (01/28/09)

The Coppock formula was introduced in Barron's in 1962, devised by a San
Antonio, TX-based technician, economist and investment advisor named Edwin
Sedgwick Coppock.
Since then, the Coppock oscillator has been adopted and adapted by technicians
around the world.

The Coppock curve is a long-term price momentum indicator used primarily to
recognize major bottoms in the stock market.
It is calculated as a 10-month weighted moving average of the sum of the
14-month rate of change and the 11-month rate of change for the index.

A buy signal is formed when there is an upturn in the curve after an extreme
low in the curve.
A sell signal is formed when there is a higher peak in stock prices but a lower
peak in the Coppock curve.
These are the basic signals, more signals and interpretations are seen at more
advanced levels.

AFL Author: rcef88
goriamtrader[at]yahoo.com
EliteVest, Public Mutual Bhd
*/

_SECTION_BEGIN("Coppock Trade Signal on Price Chart v1.0");

//PARAMETERS:
ROC1Periods		=Param("ROC1 periods",14,2,200,1,0);
ROC2Periods		=Param("ROC2 periods",11,2,200,1,0);
WMAPeriods			=Param("WMA periods",10,2,200,1,0);
ShowTradeSignal	=ParamToggle("Show trade signal","No|Yes",1);
CoppockFilter		=Param("Coppock filter",20,2,200,1,0);
ColBuy				=ParamColor("Buy color",colorBrightGreen);
ColSell			=ParamColor("Sell color",colorRed);
PriceOnChart		=ParamToggle("Show price","No|Yes",1);
PriceColor			=ParamColor("Price color",colorBlack);
PriceStyle			=ParamStyle("Price style")|GetPriceStyle();
ColBg				=ParamToggle("Show background color","No|Yes",0);
ShowTitle			=ParamToggle("Show title","No|Yes",1);

//MAIN:
Coppock=WMA((ROC(C,ROC1Periods)+ROC(C,ROC2Periods)),WMAPeriods);
InitialCalculationLength=Max(ROC1Periods,ROC2Periods)+WMAPeriods;
for(i=0;i<BarCount;i++)
{
	if(i<InitialCalculationLength) //initial zero
	{
		Coppock[i]=0.0;
		if(ShowTradeSignal){Buy=0; Sell=0;}
	}
}
LastCoppock1=Ref(Coppock,-1);
LastCoppock2=Ref(Coppock,-2);
TradeStatus=IIf(Coppock>0,IIf(Coppock>LastCoppock1,ColBuy,IIf(Coppock<LastCoppock1,ColSell,IIf(Coppock==LastCoppock1
&& LastCoppock1>LastCoppock2,ColBuy,ColSell))),
			 
IIf(Coppock>LastCoppock1,ColBuy,IIf(Coppock<LastCoppock1,ColSell,IIf(Coppock==LastCoppock1
&& LastCoppock1>LastCoppock2,ColBuy,ColSell))));
SetChartOptions(0,chartShowDates|chartShowArrows);
if(ShowTradeSignal)
{
	CoppockIsBuy=TradeStatus==ColBuy;
	CoppockIsSell=TradeStatus==ColSell;
	CoppockBuyValue=ValueWhen(CoppockIsBuy,Coppock,1);
	CoppockSellValue=ValueWhen(CoppockIsSell,Coppock,1);
	Buy=!Ref(CoppockIsBuy,-1) && Coppock<0 && CoppockIsBuy &&
abs(CoppockBuyValue)>=CoppockFilter;
	Sell=!Ref(CoppockIsSell,-1) && Coppock>0 && CoppockIsSell &&
abs(CoppockSellValue)>=CoppockFilter;
	PlotShapes(IIf(Buy,shapeUpTriangle,shapeNone),ColBuy,0,Low,0);
	PlotShapes(IIf(Sell,shapeDownTriangle,shapeNone),ColSell,0,High,0);
	ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g (%.1f%%)\nVolume:
"+NumToStr(V,1),O,H,L,C,SelectedValue(ROC(C,1)))+"\n\nCoppock "+
			 WriteIf(Buy,"Buy Price",WriteIf(Sell,"Sell Price","Hold/Sideline"))+":
"+IIf(Buy || Sell,C,Null);
}
if(PriceOnChart) Plot(C,"",PriceColor,PriceStyle|styleNoTitle);
if(ColBg)
SetChartBkGradientFill(ParamColor("BgTop",colorWhite),ParamColor("BgBottom",colorTeal));
if(ShowTitle) Title=Name()+" -
"+EncodeColor(PriceColor)+"Coppock"+_PARAM_VALUES()+" =
"+WriteVal(Coppock,1.4);

_SECTION_END();

Comments:


About | Privacy | Terms of Use | Contact information
Copyright © 2001 AMIBROKER.COM