SEE HERE
ORIGINAL FORMULA BY R. Bertematto 
//Keywords: donchian channel
// Level: basic
// Flags: indicator
// Formula URL: http://www.amibroker.com/library/formula.php?id=285
// Details URL: http://www.amibroker.com/library/detail.php?id=285
//
//------------------------------------------------------------------------------
//
// This plots a Donchian Channel, similar to a Bollinger Band but based on
// highs and lows. Good for support/resistance.
//
//------------------------------------------------------------------------------
// Plots a 20 period Donchian channel
pds=20;
DonchianUpper =HHV(Ref(H,-1),pds);
DonchianLower = LLV(Ref(L,-1),pds);
DonchianMiddle = (DonchianUpper+DonchianLower)/2;
 
Plot(DonchianUpper,"DU",colorBlue,styleLine);
Plot(DonchianMiddle,"DM",colorGreen,styleLine);
Plot(DonchianLower,"DL",colorRed,styleLine);
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, 
Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
 
JUST ADD TIMEFRAME IN CORRECT WAY
ford

--- On Wed, 8/11/10, warbaby33x <warbaby...@yahoo.com.au> wrote:


From: warbaby33x <warbaby...@yahoo.com.au>
Subject: [amibroker] Donchian 4 week high, 2 week low plot
To: amibroker@yahoogroups.com
Date: Wednesday, August 11, 2010, 4:40 AM


  



Have been trying to plot the original Donchian 4 week/2 week system instead of 
the usual 20 period/10 period channels. However, every time I plot them, and go 
to the 'daily' chart, the chart seemed to be 'displaced' to the right? What am 
I doing wrong?

TimeFrameSet( inWeekly );
DHigh = Ref(HHV(H, 4), -1);
DLow = Ref(LLV(L, 2), -1);
TimeFrameRestore();

DHighW = TimeFrameExpand( DHigh, inWeekly );
DLowW = TimeFrameExpand( DLow, inWeekly );

Plot(C, "Price", colorBlack, styleCandle);
Plot(DHighW, "Weekly AvgLevel", colorGreen, styleThick );
Plot(DLowW, "Weekly AvgLevel", colorRed, styleThick );

I also tried,

DHigh = HHV(H, 4);
DLow = LLV(L, 2);

...but didn't get far. Any help please?









      

Reply via email to