Log in

BPNN with Extrapolator

BPNN with Extrapolator
By JohnLast 4070 days ago Comments (57)
От 22 септември 2011


This is a BPNN with the extrapolator. Here I do not use linear extrapolation. We use 0 bars ahead of linear extrapolation and we plot the extrapolation from the BPNN. Well I just combine two things. However you need more bars on the extrapolator than the BPNN. 

Method 1: Fourier's extrapolation; the frequencies are calculated using the Quinn-Fernandes Algorithm

Method 2: Autocorrelation Method

Method 3: Weighted Burg Method

Method 4: Burg Method with Helme-Nikias weighting function

Method 5: Itakura-Saito (geometric) method

Method 6: Modified covariance method

Methods 2-6 are the methods of linear prediction. The linear prediction is based on finding the future values as the linear functions of the past values. Assume that we have a number of prices x[0]..x[n-1] where the higher index is compliant with the recent price. The prediction of the future price x[n] is calculated as

x[n] = -Sum(a[i]*x[n-i], i=1..p)

where a[i=1..p] - coefficients of the model, p - order of the model. The listed methods 2-6 find the coefficients a[] by decreasing the mean-root-square error on the training last n-p bars. Of course, we can reach the zero error of prediction if we directly solve the set of equations mentioned above with n=2*p by the Levinson-Durbin method. Such method of prediction is called Prony Method. Its disadvantage is the instability during the prediction of the future values of the series. That's way this method has not been included.

The other input parameters are:

LastBar - the number of the last bar in the past data

PastBars - the number of past bars used for the prediction of the future values

LPOrder - the order of the linear model as a fraction from the number of the past bars (0..1)

FutBars - the number of future bars in the prediction

HarmNo - the maximum number of frequencies for the Method 1 (0 means all frequencies)

FreqTOL - the imprecision of the frequeincies calculation for the Method 1 (if it is >0.001 it can't converge)

BurgWin - the number of the weighting function for the Method 2 (0=Rectangular 1=Hamming 2=Parabolic)

The indicator draws two lines: the blue line shows the prices of the model on the training bars, the red line shows the predicted future prices.

Trading strategy:

But keep in mind that this is just a forecast and not an entry signal. That is why I plot on the chart another indicator that is giving trading directionnal signal.

On the lowest window there is the iVAR (You can also use the FGDI). This is a fracal dimension index. The neural net is having better chance to give a precise forecast when you ask it when the fractal dimension is low.


  • CamaRon 4069 days ago


  • jaguar1637 4069 days ago

    Hi Theo. In fact, I worked a lot on this extrapolator indicator and I will provide better parameters for the settings.

    I test all AR algo provided inside the code.The best is method 4, w/ parabolic.

    I will modify the both indicators and upload them here after


  • JohnLast 4069 days ago

    I will be very thankfull. The key is to input the right sampling period.

  • Jack1 4069 days ago

    Hi, John,

    This is my feel. If got good parameters for these extrapolators. The extraolator may have the same performance with NN. NN use similar process inside, of course, different, but, theorical view or macro view, both processes inside them are similar.

    If use the result of extrapolator for NN, then, this may be a 2nd order process or 2nd time regression(what is the terminology? I confused).

    I found number of coeff and past data are needed to be selected, too big or too small will flat the resulted output line.

    I am trying(testing idea) to predict open price and close price by using AR on H1 on eur-usd. If predicted next bar's close price > open price, then, next bar is bullish bar; then, we can look for the low within bar(M1 or M5), and bid the low to scalp pips. See attached chart.

    I got problem to insert a chart image???



  • Jack1 4069 days ago



  • JohnLast 4069 days ago

    Can you just copy paste the link. 


  • JohnLast 4069 days ago

    Yes when applied on the same sample sometimes the NN and the linear models are the same. It is not easy indeed. Well it depend  how you will set up the net: the number of neurones, the number of layers etc. There are several general rules of thumb. But the more important for me is the sampling.

    Anyway for me the ouput is not really a forecast. For me the ouput is how a machine see the things. And as more and more volume are driven by the machines their point of view is really important. A human cannot understand how a machine thinks and the machines cannot understant humans.

    So and this is very strange opinion:

    Technical analysis = human mass psychology

    Neural net (and all the machines learning methods) = machine view.

    This is very strange as opinion I know. The general thesis is that there is a function we try to approximate if there is a trend we would like to approximate the trend.


  • JohnLast 4069 days ago
    От 23 септември 2011

    The shot from Jack


  • Jack1 4069 days ago


  • JohnLast 4069 days ago

    I apologize as this software is not intuitive. It is new for me and for my friends programmers. The only think that worked is to use the html tam and copy paste the code that is generated in embed pictures from picassa. On the other hand that is not as bad because it leaves to everybod the freedom to share or not to share. I hate when I want to delete something on some forum and I cannot do it. Because it does not belong to me but to the forum.



  • Jack1 4069 days ago

    Thank John for upload the chart. I still can't do.

    In NN theory, NN is a completely different computing, I know. But, in some case, if a trend persist, eg, 4 to 8 up candles, I found linear extraoplator may work well. I ran on strategy test to find out this sample. See two charts.

    NN need good samples for good training (or best fitting, the same thing) to work well. But, the market is dynamics for good consistent, good samples to feed NN. These area may be a challenge for NN, which is same issue for optimalize of coeff and past data for extrapolators, I believe, but, I am not expert in this field.



  • JohnLast 4069 days ago

    I just wanted to share all the ideas I have. For the time being this crazy conception of Elliott ware works quite well. But on the scren shot I plotted other things and those things are based on other thing. The neural net are just forecasts. I love forcasts. It is emotionnal too. 


  • JohnLast 4069 days ago
    От 23 септември 2011

    The firsts picute


    The second.

    От 23 септември 2011
  • JohnLast 4069 days ago

    Really the sampling period is key. I think smoothing helps but there are very serious contrarian opinions.


  • francisfinley 4068 days ago

    this looks neat!


  • Jack1 4068 days ago

    This is shot of chart before European open, in middle of Asian session. AR forecast open price and close price lines for next 100 bars.  Top/bottom double yellow lines are today's range or Resist/suppt.

    I am testing it, and not sure if the forecast will unfold in future.

    Try insert a link to a chart, work or not?

  • Jack1 4068 days ago

    AR forecast for 19/10/2011

  • JohnLast 4068 days ago

    If you have a gmail account you have a picassa. Just upload to picassa and share the download link.

    I am workining on uploading pictures, but for the moment we are a small community and I do not think my server capacities are enough to handle a lot of stuff.

    Can you look at two things the way you think it is and according to elliottware. I mean to train to the number of the current trending pattern

    And just one more thing I do not believe in the forecast many bars in the future. The market is chaotic and it loose information with every bar.

    With the Lyapunov exponent you can know exactly how much  bars ahead your predictive horizon can be. The predictability is calculated as a value  = 1.0 / L(Lyapunov exponent).This is my favorite article on the subject. Very concise right to the point.

    The calculation of Hurst exponent or fractal dimension enables us to evaluate how chaotic the time series is.  The calculation of Lyapunov exponent or predictability enables us to evaluate the reliability of prediction. If the chaos analyses provide us with good results (the time series has a memory effect and high predictability) it would be advisable to continue with calculations of predictions of time series.

  • JohnLast 4068 days ago
    От 23 септември 2011

    THe last update from Jack 1


  • JohnLast 4068 days ago

    We are entering into a sideways market. We are there. I do not think we can predict with this tool the range market. Range market is very complicated for effective prediction with BPNN. 

    I would not give difficult tasks to the BPNN.


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

    The outlook is very bearish with the tool. so we have a bearish forecast. For training range I set the last 440 bars where the market makes a very volatile trend behaviour. But still this tool gives only forecasts. It is not an entry signal.

  • jaguar1637 4068 days ago


    regarding the settings on BPNN, I got this kind of settings

    SmoothPer 3
    numLayers 5
    numInputs 17
    numNeurons1   17
    NumNeurons2  13
    NumNeurons3   7
    NumNeurons 4  5
    NumNeurons 5  3

    ntr             1000

  • CamaRon 4068 days ago

    Let's trim this for Eur/CHF 5m.

    EA is up 130% by the way.

  • jaguar1637 4068 days ago

    EA w/  WPR ??


    Would you like a Regression w/WPR or aBPNN w/ WPR ??

  • francisfinley 4068 days ago

    i like this bpnn thing so far - where can i read more John?

    its like a new ssa - its exciting. I did play with extrapolator a long while back - but it was crap. this one seems to behave better.

    camaron - im not getting anywhere near the results you are with that ea