Amibroker question

Discussion in 'Trading Software' started by eacherlunch, Jul 5, 2005.

  1. I have an issue with building a custom exponential MA in amibroker. The formula for an EMA is (close*ratio)+(prevEMA*(1-ratio)). With amibroker formula language, is there a good way to recall the prevEMA (which would be the value calculated on the previous bar)? This would also tie back to intializing the calculation in the first place. (an example is that a 20 period EMA would need about 20 bars of data to become a true EMA assuming a SMA was used as the starting point.) Hope that makes sense. Thanks in advance.
     
  2. WarEagle

    WarEagle Moderator

    You should be able to replace "prevEMA" in your code with "Ref(EMA,-1)" to get the previous bars EMA value. If you need to go further back, just change the -1 to however many bars you need.