AvgPrice

See Also...

Related Topics

 

 

Description

This formula calculates an average price for a bar by multiplying the sum of the open, high, low, and last prices by .25.

 

 

Formula

AvgPrice(instrument, index)=begin

  targetBar = index - 1

  retval = (Sum(vchart(instrument.open[targetBar]), vchart(instrument.high[targetBar]), vchart(instrument.low[targetBar]), vchart(instrument.last[targetBar])) ) * .25

end

 

 

Parameters

instrument

The instrument you want to average.

 

index

The bar, as oriented with the current bar, you want to average.

 

 

Return Value

An average of the four prices comprising a bar (open, high, low, last).

 

 

Examples

...

  for i = 0 to (Length - 1) begin

    avp = AvgPrice(instrument, i)

    pavp = AvgPrice(instrument, (i + 1))

    volVal = avp + GetVolume(instrument, i)

    if avp > pavp then pmf = pmf + volVal + avp else nmf = nmf + volVal

  end

...

 

 

Comments

This formula has a specialized role in the calculation of the MoneyFlow study.

 

©2008 Aspen Research Group, Ltd. All rights reserved. Terms of Use.