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

Re: [amibroker] 95% Channel formula



PureBytes Links

Trading Reference Links




Chris
 
Why do think it important for the upper and lower 
channels to be equidistant from the EMA?  Stocks often fall a lot quicker 
than they rise - and that might argue for a tighter lower band.  In an 
uptrend, the upper band will expand and the lower one will contract, and 
vice-versa.
 
One indicator I've heard of that had different 
coefficients is called Bomar Bands - apparently the product of Bob Brogan and 
Mark Chaiken  (i.e. BOb and MARk).  There are two versions.  The 
first is based on a 21-day SMA and captures 83% of the price action based on a 
lookback period of 185 days (it may be shorter than this - not sure).  In 
other words, these bands are supposed to stop the stock price at one of the 
bands  5 out of 6 times.  
 
There is a second intermediate one designed to stop 
prices 90% of the time (9 out of 10 times) plotted around a 50-day SMA and a 
lookback period of 12 months (240 days).
 
In MetaStock (dare I mention that on this site) 
plugin, John Bollinger mentions Bomar Bands.  He says the bands are shifted 
up 3% and down 2% - but I tried that solution and the bands do not resemble 
samples of the bands I've been able to find on the web.  (I subscribed to 
Signalwatch at one point, which uses Bomar Bands).
 
So a challenge to the mathematicians in the 
group.  How do you create an algorithm that uses the price history to 
automatically calculate these bands.
Rick
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  indiana0352 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Thursday, September 18, 2003 7:31 
  PM
  Subject: [amibroker] 95% Channel 
  formula
  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> > <A 
  href="">http://groups.msn.com/ASXShareTrading> 
  > <A 
  href="">http://groups.msn.com/FMSAustralia> 
  > > > > > -----Original Message-----> > From: 
  indiana0352 [mailto:cs_winn@xxxx] > > 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 (<A 
  href="">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.> > <A 
  href="">http://www.c1tracking.com/l.asp?cid=5511> 
  > <A 
  href="">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: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)> 
  > --------------------------------------------> > Check group FAQ 
  at:> > <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  > > > > Your use of Yahoo! Groups is subject to > 
  <A 
  href="">http://docs.yahoo.com/info/terms/Send 
  BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to 
  suggest@xxxxxxxxxxxxx-----------------------------------------Post 
  AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT 









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 the Yahoo! Terms of Service.