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

[amibroker] Re: 95% Channel formula



PureBytes Links

Trading Reference Links

Is there any reason you're not using the Bollinger Bands? They're 
supposed to provide you exactly the same thing you're seeking, unless 
I'm missing something in your question.

Having said that, I myself once tried to implement Elder's channel 
profit strategy a while ago (I'm assuming you're trying to do 
something similar), and did not use BBands to calculate the channel 
heights because I thought they were too sensitive to occasional peaks 
that were not "normal". I used something like following -

1. Calculate past "n" peak values (peak can be defined several ways; 
there're some past discussions about it on the board)
2. Calculate EMA or SMA of past n peak values
3. That MA - current MA of the price determines the channel height. 
Multiply on both sides.

This way, it doesn't necessarily contain 95% of all values, but if 
your peak definition is decent, then it gives pretty good results.

I don't have that code translated to AB yet, but plan to do that 
soon. I'll post it once that's done, if anyone's interested.

Jitu

PS: Did anyone find it odd that throughout the book, Dr. Elder talked 
about taking channel profits (as in buy when it touches EMA and then 
sell when it hits the channel target), but none of the trades that he 
showed at the end of the book were based on that strategy? If I 
remember correctly, they were all based on Force Index divergences 
and what not, where he essentially predicted short term reversals of 
ongoing trend. Doing that and comparing the profit made to the 
percentage of channel height didn't really make any sense to me.

--- In amibroker@xxxxxxxxxxxxxxx, "indiana0352" <cs_winn@xxxx> wrote:
> OK I want to pose this problem to the rest of the board now because 
> I seem to have maxxed out my programming skills.
> 
> Basically, I want to be able to draw channels that are equidistant 
> from the EMA. The original formula goes like this:
> 
> ----------
> Upper channel line = EMA + (EMA * Channel coefficient)
> Lower channel line = EMA - (EMA * Channel coefficient)
> 
> "A well-drawn channel contains the bulk of prices, with only a few 
> extremes poking out. Adjust the coefficient until the channel 
> contains approximately 95 percent of all prices for the past 
several 
> months. Mathematicians call the "second standard deviation 
channel". 
> Most software packages make this adjustment very easy."
> ----------
> 
> I've written some straightforward code to do your own channels. It 
> is:
> 
> --------------------------
> Chancoeff = Param ("Channel Coefficient", 0.1, 0.0, 0.3, 0.005);
> 
> Upchannel = EMA(Close, EMAShort) + (EMA(Close, EMAShort) * 
> Chancoeff);
> 
> Downchannel = EMA(Close, EMAShort) - (EMA(Close, EMAShort) * 
> Chancoeff);
> 
> Plot (Upchannel, "", colorBlack, styleLine);
> 
> Plot (Downchannel, "", colorBlack, styleLine);
> 
> ---------------------------
> 
> That's the easy part. You adjust the channels manually with the 
> param function and "eyeball" when you think that the channels 
> include 95% of prices.
> 
> Basically what I want is to be able to have AB calculate the 
channel 
> coefficient for me. I've done some work on this and here's what I 
> have:
> 
> -------------------------------
> Lookback = Param ("Channel Lookback", 45, 1, 100, 1); /*lookback 
> period for channels*/
> 
> ChannelPercent = Param ("Channel %", 95, 80, 100, 0.5); /*what % of 
> prices within channel in specified lookback period*/
> 
> Highsum = Sum (High, Lookback); /*sum of high values in lookback 
> period*/
> 
> Lowsum = Sum (Low, Lookback); /*sum of all low values in lookback 
> period*/
> 
> PriceRange = Highsum - Lowsum; /*total of daily range within entire 
> lookback period*/
> 
> PercentPrice = PriceRange * ChannelPercent / 100; /*value to be 
> included in channel*/
> --------------------------------
> 
> From here I'm stuck. I somehow need to take the value of 
> PercentPrice and convert it to the channel coefficient. 
> 
> Any ideas?
> 
> TIA,
> Chris
> 
> 
> 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > > The same percent of the high prices will be greater in dollars 
> > than the % of
> > > lows. I suggest use % of average price (H+L)/2 to get the 
> > bandwidth.
> > > 
> > > Cheers,
> > > Graham
> > > http://groups.msn.com/ASXShareTrading
> > > http://groups.msn.com/FMSAustralia
> > > 
> > > 
> > > -----Original Message-----
> > > From: indiana0352 [mailto:cs_winn@x...] 
> > > Sent: Monday, 15 September 2003 12:55 PM
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Subject: [amibroker] Re: channel width, in dr. elder's sense
> > > 
> > > 
> > > Hmm this seems like a good start but the formula below seems to 
> > base 
> > > the channels on closing proces rather than high and low prices, 
> so 
> > > the lines would be:
> > > 
> > > Value2 = HHV(High,Lookback);
> > > 
> > > Value3 = LLV(Low,Lookback);
> > > 
> > > This corrects part of the problem but the bottom channel line 
is 
> > > still not the same distance from the EMA as the top as it 
should 
> > be.
> > > 
> > > I'll work on this tomorrow but for now I need to go to bed...
> > > 
> > > Chris
> > > 
> > > 
> > > --- In amibroker@xxxxxxxxxxxxxxx, "Anthony Faragasso" 
> > <ajf1111@xxxx> 
> > > wrote:
> > > > Lookback=45;
> > > > 
> > > > PerCent=95;
> > > > 
> > > > x=C;
> > > > 
> > > > Osc=x; /*insert variable by Identifier*/
> > > > 
> > > > /****************************************/
> > > > 
> > > > /*Value of Osc*/
> > > > 
> > > > Value1 = Osc;
> > > > 
> > > > /*Highest AND Lowest Values of Osc during Lookback Period*/
> > > > 
> > > > Value2 = HHV(Value1,Lookback);
> > > > 
> > > > Value3 = LLV(Value1,Lookback);
> > > > 
> > > > /*Range of Osc during Lookback Period*/
> > > > 
> > > > Value4 = Value2 - Value3;
> > > > 
> > > > /*Define PerCent of Range to determine OB AND OS levels*/
> > > > 
> > > > Value5 = Value4 * (PerCent / 100);
> > > > 
> > > > /*Calculate OB AND OS levels*/
> > > > 
> > > > Value6 = Value3 + Value5;
> > > > 
> > > > Value7 = Value2 - Value5;
> > > > 
> > > > baseline=(value2 + value3)/2;
> > > > 
> > > > Plot(C,"",colorBlack,styleCandle);
> > > > 
> > > > Plot(Value6,"",colorRed,styleLine);
> > > > 
> > > > Plot(Value7,"",colorRed,styleLine);
> > > > 
> > > > 
> > > > ---
> > > > Outgoing mail is certified Virus Free.
> > > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > > Version: 6.0.516 / Virus Database: 313 - Release Date: 
9/1/2003
> > > 
> > > 
> > > ------------------------ Yahoo! Groups Sponsor -----------------
-
> --
> > -~--> Buy
> > > Ink Cartridges or Refill Kits for Your HP, Epson, Canon or 
> Lexmark 
> > Printer
> > > at Myinks.com. Free s/h on orders $50 or more to the US & 
Canada.
> > > http://www.c1tracking.com/l.asp?cid=5511
> > > http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/GHeqlB/TM
> > > ----------------------------------------------------------------
-
> --
> > --~->
> > > 
> > > Send BUG REPORTS to bugs@xxxx
> > > Send SUGGESTIONS to suggest@xxxx
> > > -----------------------------------------
> > > Post AmiQuote-related messages ONLY to: 
amiquote@xxxxxxxxxxxxxxx 
> > > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > > --------------------------------------------
> > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> > > 
> > > Your use of Yahoo! Groups is subject to 
> > http://docs.yahoo.com/info/terms/


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Remanufactured Ink Cartridges & Refill Kits at MyInks.com for: HP $8-20. Epson $3-9, Canon $5-15, Lexmark $4-17. Free s/h over $50 (US & Canada).
http://www.c1tracking.com/l.asp?cid=6351
http://us.click.yahoo.com/0zJuRD/6CvGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/