Log in

BPNN Predictor HP: Neural network using Hodrick-Prescott filter as input

BPNN Predictor HP: Neural network using Hodrick-Prescott filter as input
By JohnLast 3116 days ago Comments (4)
image
От 22 септември 2011

This is a BPNN Predictor HP mod. This mod uses the values from the Hodrick-Prescott  filter

nobs =1000; //Number of bars to process for filter evaluation 
lambda=1600; //Higher lambda leads to the smoother data
timeframe=0;//The applied timeframe, 0=the same as chart
price =PRICE_CLOSE;//The applied price

delay =0; //Shows the result of delaying (or advancing if negative) the HP filter
trend =10; //how many consecutive filter bars to check to determine trend

future =0; //How many bars in the future to display for the HP filter

repaint =FALSE; //To repaint last bar, FALSE for faster execution

alerts =FALSE; //Enable visual alert

extern string audio ="alert.wav"; //Enable audioalert

extern int history =1000; //history bars to display on initialisation, 0 means all history

Installation:

You need to copy the extracted files in the experts folder. You need the HPMA file in order to run the BPNN Predictor with Hodrick-Prescott  filter. This file is included in the zip file.

Comments

  • JohnLast 3044 days ago

    I updated the files with the library dll file, you need to copy/paste bpnn.dll int experts/libraries folder.

  • jaguar1637 3044 days ago

    Yep, I tested it, it seems to work, but not always. I am not convinced by Hodrick-Prescott

  • JohnLast 3044 days ago
    image
    От 22 септември 2011

     

    image
    От 22 септември 2011

    One of the big questions  with HP is what lambda to use? This is the most cited article for defining the appropriate lamda but for Forex it does not make sense, as the filter has been used for econometric analysis when plotting quartely data.

    Hodrick and Prescott (1980) favored the choice of = 1600
    based on the argument that a 5 percent deviation from trend per quarter is relatively
    moderate as is an eighth percentage change in the trend component. They show
    that can be interpreted as the variance of the business cycle component divided by
    the variance of the acceleration in the trend component if the cycle component and
    the second dierence of trend component are mean zero i.i.d. normally distributed
    variables. For Hodrick and Prescott's (1980) prior then follows as 5^2/(1/8)^2 = 1600.
     

    For the last 1 h trend from 20 november I would say that rougly we have 9 percent of deviation of trend. So for lamda I would use 5000. In that way we can adjust the filter to the trend filtering out the cyclic component. In the picture this appears quite successfull. And the forecast by the common HP and the Neural net is the same. However this is only trend forecast do not forget the deviation from trend ;).

     

     

  • JohnLast 3044 days ago

    The whole idea here is to popularize the available instruments and make them available to everybody. 

    Two years ago we had a conversation at another forum and one friend there said, I am too old for that, neural nets are far too complicated to be used, maybe in another life.

    I feeled a deep sadness by those word and I wanted to make everything possible to popularize those intruments and how they could be used by technical traders.

    I allow myself an analogy, with the fighter pilots, they know what are the basic principles of aerodynamics the avionics, but their job is to fight. They have to know jow to use the plane. If they need to know in detail the inner working of their plane, there would be no one to fly. 

    That is the job of the engeneers. A fighter pilot has just a basic understanding his job is different.

    The same goes for the quant trading. The big brains quant based strategies have lost more money than any other kind of analysis on a historical basis. They are not holy grails. 

    Now I think I had made an effort to make those intruments popular. Well, neural nets are just dumb calculators. 

    Here we use Hodrick Prescott filter as an input for the neural net. In this example for the Hodrick Prescott filter it is critical to have the correct lamda. 

    In this case the calculations were 9 % percent deviation from trend, and I use the standard eight of a percentage change in the trend component. 

     

    So I get for lamda 9^2/(1/8)^2= 5184  

    This formula looks important because it would allow us to make an adaptation of the Hodrick Prescott filter to the current market state of the trend.

    For example if you have Trending and quiet market state you would have a lower value for the percent deviation from trend.

    On the other hand if you have Trending and volatile you would have a higher percentage deviation from trend.

    Basically you have some kind of guidance how to tune the filter. The SSA Caterpilar makes the same job but there you have no practical guidance of this kind.