private TreeMap<Float, Float> makeAverageListFromPricePair(
			TreeMap<Float, java.awt.geom.Point2D.Float> priceByDate, int id,
			int neighborsToCount) {

		//ensure values for start/end points 
		TreeMap<Float, Float> pts = makeListFromPricePair(priceByDate,id) ;

		ArrayList<Float> days = new ArrayList<Float>(priceByDate.keySet());
		ArrayList<java.awt.geom.Point2D.Float> prices = new ArrayList<java.awt.geom.Point2D.Float>(
				priceByDate.values());
 
		
		for (int J = neighborsToCount; J < (days.size() - neighborsToCount); J++) {
			float sum = 0;
			int n = 0;
			for (int L = J - neighborsToCount; L <= J + 1 + 2 * neighborsToCount && L<prices.size(); L++) {
n++;
				switch (id) {
				case 0:
					//pts.put(days.get(L),  prices.get(L).x);
					sum += prices.get(L).x;
					break;
				case 1:// market
					//pts.put(days.get(L),  prices.get(L).y);
					sum += prices.get(L).y;
					break;
				}
			}
			float average = sum/n; 
			pts.put(days.get(J), average);
		}
		return pts;
	}