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

RE: [amibroker] AFL formula for CCI



PureBytes Links

Trading Reference Links




<SPAN 
class=994332404-12102003>forgot to say why removing the loop is 
important.
<SPAN 
class=994332404-12102003> 
<SPAN 
class=994332404-12102003>if the period parameter is an array, the loop version 
gives this error:
<SPAN 
class=994332404-12102003> 
<SPAN 
class=994332404-12102003>"Error 3. Condition in IF, WHILE, FOR statements has to 
be Numeric or Boolean type. You can not use array here, please use [] (array 
subscript operator) to access array elements."
<SPAN 
class=994332404-12102003> 
<SPAN 
class=994332404-12102003>dave
<BLOCKQUOTE 
>re 
  the earlier discussion of using arrays as paremters to built-inindicators, 
  I need a version of the CCI that can take an array for 
  itsperiod.here's a description of how the 20-period CCI is 
  calculated, fromStockCharts.com:  1) Calculate today's Typical 
  Price (TP) = (H+L+C)/3 where H = high; L =low, and C = close.  2) 
  Calculate today's 20-day Simple Moving Average of the Typical 
  Price(SMATP).  3) Calculate today's Mean Deviation. First, 
  calculate the absolute valueof the difference between today's SMATP and 
  the typical price for each ofthe past 20 days. Add all of these absolute 
  values together and divide by 20to find the Mean Deviation.  4) 
  The final step is to apply the Typical Price (TP), the Simple 
  MovingAverage of the Typical Price (SMATP), the Mean Deviation and a 
  Constant(.015) to the following formula:      
  CCI = (Typical Price - SMATP) / (.015 x Mean Deviation)according to my 
  tests, this matches the built-in CCI exactly:  MD = 
  0;      // MD is Mean Deviation  for(i = 0; 
  i < period; i++) {    MD = MD + Abs(SMATP - Ref(avg, 
  -i));  }  MD = MD / period;can anyone see how to do 
  the same thing with AFL array processing instead ofthe 
  loop?thanks,daveSend 
  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












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.