Location: PHPKode > projects > Finasystem > fs_ta/medprice.php
<?php
/**
* Finasystem version 0.4 Lin Hai - Technical Analysis Library in PHP
 *Release: 14/10/2006
 *Copyright (C) 2006 Rudy Zuck
 *mailto:rudy[-at-]zuck.fr
 *web:http://sourceforge.net/projects/finasystem
 *
 *This program is free software; you can redistribute it and/or
 *modify it under the terms of the GNU General Public License
 *as published by the Free Software Foundation; either version 2
 *of the License, or any later version.
 *
 *This program is distributed in the hope that it will be useful,
 *but WITHOUT ANY WARRANTY; without even the implied warranty of
 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *GNU General Public License for more details.
 *
 *You should have received a copy of the GNU General Public License
 *along with this program; if not, write to the Free Software
 *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA  
 */

/**
 * Median Price (medprice)
 *
 *<p>The Median Price indicator is simply the midpoint of each day's price. 
 *The Typical Price and Weighted Close are similar indicators. The Median Price 
 *indicator provides a simple, single-line chart of the day's "average price." 
 *This average price is useful when you want a simpler view of prices.</p>
 *
 *<p>Formula:</p>
 *
 * - MP= (high+low)/2
 *
 * @author Rudy Zuck <rudy[-at-]zuck.fr>
 * @copyright Copyright, 2006, Rudy Zuck
 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
 * @version 0.4
 * @package fs_ta
 */
class medprice{
	
	/**
	 * @var double[]
	 */
	private $medprice;
	
	/**
     * @param double[] $high
	 * @param double[] $low
	 * @return double[]
     */
	function get($high,$low){
		$size_data = count($high);	
		for ($i=0; $i<$size_data; $i++){
			$this->medprice[$i] = ($high[$i] + $low[$i])/2;
		}
		return $this->medprice;
	}	
}
?>
Return current item: Finasystem