Indicators: Fourier extrapolation of price - page 2

 
pawulo #:
Please how do I get the indicator??

https://www.mql5.com/en/code/download/130/fourier_extrapolator_of_price.mq5 if you go to the top of the indicator posted there is a file with .mq5

 

HI,

I like the incicator. However, when I create a iCustom EA using it, it stops working during the backtest, tester freezes.

For instance, when I do a backtest of EURUSD for the last year, it hangs after 1 month of backtest.

See images too for settings, the graph is where it hangs. Compter is fine, but tester is frozen but can be stopped without issue.

Any ideas?

 
gardee005 #:

Any ideas?

Run it under debugger. Look into the logs.

 

It looks promising except for a tiny detail.

It redraw/repaint/recalculate on new data entirely .

Normally indicators  shouldnt do that (despite applying whathever regression model to preset number of data/bars).

Can somebody please fix it to change indicator value at last bar  only ?

Thanks.

 
Robert72 #:

It looks promising except for a tiny detail.

It redraw/repaint/recalculate on new data entirely .

Normally indicators  shouldnt do that (despite applying whathever regression model to preset number of data/bars).

Can somebody please fix it to change indicator value at last bar  only ?

Your requirement is unclear. Due to specificity of the approach with Fourier transform, the indicator will completely redraw on new data - no matter if it's a bar or a tick.

If you like, you can add the line into OnCalculate:

if(rates_total == prev_calculated) return prev_calculated;
 
Stanislav Korotky #:

Your requirement is unclear. Due to specificity of the approach with Fourier transform, the indicator will completely redraw on new data - no matter if it's a bar or a tick.

If you like, you can add the line into OnCalculate:

Hello Stanislav. 
Firstly, sorry for late and delayed replay. 
You also should excuse for my only superficial knowledge about Fourier transform mathematics and it specificity. 
I am not sure what remained unclear. 
Just for example this indicator:
behave exactly as required i.e. it redraw/flotting on last bar only. The produced curve behind current point remain"fixed". 
This indicator:
 however behave different. It redraw entire curve on new received data while using the same  fitting concept.
Different behavior most than be hidden in a different coding not in a applied model and/or mathematical approach. 
So for titled indicator first behavior (...20480) is not possible because of"specificity of the approach with Fourier transform"? 
And cant be" fixed" with coding it differently?
I will try (posting this from mobile ! ) insert code line you provided but its not likely to catch the issues or solve it. 
Thanks. 


 
Robert72 #:
I am not sure what remained unclear. 
Just for example this indicator:
behave exactly as required i.e. it redraw/flotting on last bar only. The produced curve behind current point remain"fixed". 
This indicator:
 however behave different. It redraw entire curve on new received data while using the same  fitting concept.
Different behavior most than be hidden in a different coding not in a applied model and/or mathematical approach. 
So for titled indicator first behavior (...20480) is not possible because of"specificity of the approach with Fourier transform"? 
And cant be" fixed" with coding it differently?
I will try (posting this from mobile ! ) insert code line you provided but its not likely to catch the issues or solve it. 

Yes, you can run Fourier transform (or nonlinear regression reconstruction) through entire history of the chart and take each last value of result and draw them in a dedicated buffer. You'll get a kind of static MA, which is less informative than dynamic forecasts - they are considered a positive feature of algorithms like Fourier/Wavelets/etc, and you're asking to downgrade them and cut off the forecasts in order to get MA-like curve, if I understand you correctly.

 

Here is an example of Fourier traces on history in the tester, but I'm not sure this is what you mean.

Fourier traces on history

The source code is attached.

 
Stanislav Korotky #:

Here is an example of Fourier traces on history in the tester, but I'm not sure this is what you mean.

The source code is attached.

Yes, you understand correctly. 
I need coding solution for that static curve. 
My initial idea was that trigonometric fitting better "represents" the price action compared to say nonlinear/polynomial fitting. Looking at your picture - blue line (fourier extrapolator) does it almoust perfectly. For sure much better than this:
Only issue is that entire curve change at new data arrival. 
As i understand  from your post - static curve wont be so precize in following price movement and future predictions will be eliminated? 
They arent exactly to much accurate and predictive (mostly) anyway. 
Smoothness will also deteriorate i supose?
What rapresent yellow(ish) curve on your example? 
Thanks for posting source code but i already have it. Or you modify something that produce yellow curve instead of original blue one? 
Thanks. 



 
Robert72 #:
Yes, you understand correctly. 
I need coding solution for that static curve. 
My initial idea was that trigonometric fitting better "represents" the price action compared to say nonlinear/polynomial fitting. Looking at your picture - blue line (fourier extrapolator) does it almoust perfectly. For sure much better than this:
Only issue is that entire curve change at new data arrival. 
As i understand  from your post - static curve wont be so precize in following price movement and future predictions will be eliminated? 
They arent exactly to much accurate and predictive (mostly) anyway. 
Smoothness will also deteriorate i supose?
What rapresent yellow(ish) curve on your example? 
Thanks for posting source code but i already have it. Or you modify something that produce yellow curve instead of original blue one? 

Of course I modified something - you said that I understood correctly, but from your next words it looks like you did not understand what I did. So the orange line is the trace of the point where blue and red curves connect to each other - the static estimation of fitting over time. Technically you can take a snapshot of any point on the curves, or even "freeze" all the curves.