Buff Averages by Buff DormeierThis month in Traders' Tips, we'll be buffing up your moving averages using the volume-weighting method presented in Buff Dormeier's article in this issue, "Buff Up Your Moving Averages." The weighting formula has been created as a function in EasyLanguage so that it can be referenced from any analysis technique or strategy. In addition, a simple two-line volume-weighted average indicator that references the function has also been included. The name of the volume-weighted average function is "BuffAverage." The function has two inputs, price and length. The price input represents the price value upon which the average calculation is based. The length input represents the number of bars that are used in the calculation of the average. Here is the EasyLanguage for the function: Typ : Function, Name : BuffAverage Inputs: Price(Numeric), Length(Numeric); Variables: VolSum(0), Buff(0); VolSum = Summation(Volume, Length); Buff = 0; If VolSum <> 0 Then Begin For value1 = 0 To Length - 1 Begin Buff = Buff + ((Price[value1] * Volume[value1]) / VolSum); End; End; BuffAverage = Buff; The two-line volume-weighted average indicator for EasyLanguage is named Buff averages. This indicator has three inputs. The price input represents the price value upon which the average calculation is based. The FastAvg input represents the number of bars to use in the fast volume-weighted average calculation. The SlowAvg input represents the number of bars to use in the slow volume-weighted average calculation. A simple alert criteria has also been included to provide an alert when the two lines cross. Below is the EasyLanguage for this indicator. The recommended properties for the indicator are presented after the EasyLanguage code. Typ : Indicator, Name : Buff Averages Inputs: Price(Close), FastAvg(5), SlowAvg(20); Plot1(BuffAverage(Price, FastAvg), "FastBuff"); Plot2(BuffAverage(Price, SlowAvg), "SlowBuff"); If Plot1 Crosses Above Plot2 Then Alert("Buff Averages Bullish Crossover."); If Plot1 Crosses Below Plot2 Then Alert("Buff Averages Bearish Crossover."); Chart style: PlotName Style Weight FastBuff Line Thinnest SlowBuff Line Thinnest Chart color: PlotName Color FastBuff Magenta SlowBuff Cyan Scaling: Same as symbol. The EasyLanguage code for the Buff average function and indicator are also available for download from the EasyLanguage portion of the support section at Omega Research's website. The name of the file is "BuffAvg.Els" for use in TradeStation and ProSuite 2000i. ![]()
Пока комментариев нет
|
|