There could be some problems with your approach, new_trader: the peak may not be in the middle of the window and the magnitude of the peak may vary based on market volatility. So, minPeakSize = 4 may be too common during highly volatile trading and too rare during relatively stagnant one.
________________________________ From: new_trader <[email protected]> To: JBookTrader <[email protected]> Sent: Wed, December 22, 2010 9:12:33 AM Subject: [JBookTrader] Re: peak and reversal detection -> help needed thanks for your proposal! I have also a proposal. it determines if a point between two point is bigger than the two point. here you see a little Java fragment: int windowSize = 600; int minPeakSize = 4; int minTension = 15; MovingWindow window = new MovingWindow(windowSize); int detectReversalPattern(double tension){ boolean bullish = true; window.add(tension); if(!window.isFull()) return 0; if(Math.abs(tension) < minTension) return 0; double x0 = window.get(0); //left double x1 = window.get(windowSize/2); //middle double x2 = window.get(windowSize-1); //right // if x1 is negative then make it positive // this way it can be compared more easy with x0 and x2 if(x1 < 0){ x1*=-1; bullish = false; } // if x1 is bigger than x0(left) and x2(right) then we have a peak if(x1>(0.5*(x0+x2))) { double peakSize = x1-(0.5*(x0+x2)); if(peakSize>minPeakSize) if(bullish){ return 1; } else { return -1; } } return 0; } -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en. -- You received this message because you are subscribed to the Google Groups "JBookTrader" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jbooktrader?hl=en.
