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

Re: [amibroker] Re: AMA vs EMA, malfunctioning brain



PureBytes Links

Trading Reference Links




Hello,
 
See User's Guide
 
<A 
href="">http://www.amibroker.com/guide/afl/afl_view.php?name=EMA
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Dave Merrill 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Saturday, October 25, 2003 12:46 
  PM
  Subject: RE: [amibroker] Re: AMA vs EMA, 
  malfunctioning brain
  
  <SPAN 
  class=551153110-25102003>oops tomasz, you're correct, careless, and not the 
  first time, truly sorry for that.
  <SPAN 
  class=551153110-25102003> 
  <SPAN 
  class=551153110-25102003>however, I don't think that's the reason that the EMA 
  and AMA versions act differently, even with static numbers. I made the change, 
  and backtest results are still different, but only when either or both of the 
  second two EMAs are replaced by EMAx. the first one doesn't seem to make a 
  difference, at least on the data I tried.
  <SPAN 
  class=551153110-25102003> 
  <SPAN 
  class=551153110-25102003>maybe I'm doing something else carelessly, and I 
  apologize in advance if that's the case, but I don't see 
  it.
  <SPAN 
  class=551153110-25102003> 
  <SPAN 
  class=551153110-25102003>dave
  <SPAN 
  class=551153110-25102003> 
  <BLOCKQUOTE 
  >
    You should really check your code twice or more. It is really easy and 
    would save me
    hundreds of hours of answering such basic stuff.
     
    Your formula has simply a basic error:
     
    
    YOUR CODE (wrong):
    ========
    function MACDHistogram() 
    { if(using_arrays) 
     {   m = EMAx(c, 12) - EMAx(c, 26);// MACD 
    line  s = m - 
    EMAx(m, 9); // <--- WRONG !!!!!!!!!!!!!!!!   Signal line is 
    simply EMA of MACD. Not MACD - EMA( MACD) !!!!! } 
     else 
     {  m = EMA(c, 12) - EMA(c, 26);  s = 
    m - EMA(m, 9);  // <--- 
    WRONG !!!!!!!!!!!!!!!!Signal line is simply EMA of MACD. Not MACD - EMA( 
    MACD) !!!!! } hist = m - s; // 
    histogram  return hist;}
     
    CORRECTED CODE:
    
    YOUR CODE (wrong):
    ========
    function MACDHistogram() 
    { if(using_arrays) 
     {   m = EMAx(c, 12) - EMAx(c, 26);// MACD 
    line  s =  EMAx(m, 9); // <--- GOOD!   
    Signal line is simply EMA of MACD.  } 
     else 
     {  m = EMA(c, 12) - EMA(c, 26);  s 
    = EMA(m, 9);  <--- GOOD!   Signal line is simply EMA 
    of MACD.  } hist = m - s; // histogram is HERE 
    !!! return hist;}
     
    Best regards,Tomasz Janeczkoamibroker.com
    <BLOCKQUOTE 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      Dave Merrill 
      
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">amibroker@xxxxxxxxxxxxxxx 
      
      Sent: Saturday, October 25, 2003 
      10:18 AM
      Subject: RE: [amibroker] Re: AMA vs 
      EMA, malfunctioning brain
      
      <SPAN 
      class=993201508-25102003>thanks, I know about that. I just didn't want my 
      auto-optimization stuff to have to depend on that, especially since tj 
      said an AFL equivalent exists.
      <SPAN 
      class=993201508-25102003> 
      <SPAN 
      class=993201508-25102003>any other responses from anyone? 
      tj?
      <SPAN 
      class=993201508-25102003> 
      <SPAN 
      class=993201508-25102003>dave
      <SPAN 
      class=993201508-25102003> 
      <BLOCKQUOTE 
      >dave 
        if you want an EMA with varperiod download indicators.dll and use 
        scEMA(array, varperiod)stephanewrote:> I need a poke 
        in the head...> > I wanted a version of the MACD histogram 
        that can take arrays for its three> parameters. I used the 
        array-capable version of EMA provided by tomasz, but> I'm not 
        getting the same results as with the native EMA function, even 
        with> static numbers as parameters. (I said I was doing this to 
        use arrays, but> since even static numbers don't work right, 
        I used them here for> simplicity.) oddly enough, the results are 
        the same using tomasz's EMAx the> first two times, but using 
        it the third time causes a difference. that's the> one marked 
        with '<<< HERE <<<' below.> > what's 
        wrong with this picture?> > here's the code:> 
        > -----------------> function EMAx(array, period) { // use 
        for EMA when period is an array> 
              return AMA(array, 2 / (period + 
        1));> }> > function MACDHistogram() {> 
              if(using_arrays) {> 
                    m = 
        EMAx(c, 12) - EMAx(c, 26);// MACD line> 
                    s = m - 
        EMAx(m, 9);            
        // signal line;       <<< HERE 
        <<<>       } else {> 
                    m = EMA(c, 
        12) - EMA(c, 26);>       
              s = m - EMA(m, 9);> 
              }>       
        hist = m - s;      
                    
              // histogram> 
              return hist;> }> 
        -----------------> > 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. 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. 
      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. 
    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.