Fourier transform and moving averages

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #236193 quote
    herchell
    Participant
    New

    With Python I can put the moving averages into the Fourier transform and compare them with the normal signal after the signal is received and do a back test. Do you think this is possible?

    #236197 quote
    robertogozzi
    Moderator
    Master

    Yes, you have to code a strategy, using the ProRealTime (often named ProBuilder) language, and backtest it.

    #236198 quote
    herchell
    Participant
    New

    I don’t know how to do it, can you suggest me a road map for this?Thank you.

    #236199 quote
    GraHal
    Participant
    Master
    #236200 quote
    PeterSt
    Participant
    Master

    With Python I can put the moving averages into the Fourier transform and compare them with the normal signal after the signal is received and do a back test. Do you think this is possible?

    Yes, with Python you do this with a couple of lines of code. With PRT (ProBuilder) it is sheer impossible (but theoretically can be done).
    Most probably you will never get an answer from your code because all will be way too slow.

    FFT

    #236204 quote
    JS
    Participant
    Senior

    Hi,

    The library contains this indicator “Fourier Transform” …

    https://www.prorealcode.com/prorealtime-indicators/fourier-transform/

    I understand that you want to convert the time domain to a frequency domain using the Fourier Transform, but what added value does this have on average…?

    The characteristics of an average are fully captured in the time domain by means of the impulse response… (here the frequency domain has no added value)

    What you can do in PRT, as Roberto points out, is code your system (with average) in PRT and then back test it…

    A simple strategy with average:

     // Moving Average type

    //0=SMA, 1=EMA, 2=WMA, 3=Wilder, 4=Triangular, 5=End point, 6=TimeSeries Forecast, 7=Hull, 8=ZeroLag

    DefParam CumulateOrders=False

    Once SlowPeriod=20

    Once FastPeriod=10

    MASlow=Average[SlowPeriod,MAtype]

    MAFast=Average[FastPeriod,MAtype]

    If MAFast crosses over MASlow then

    Buy 1 contract at Market

    EndIf

    If MAFast crosses under MASlow then

    SellShort 1 contract at Market

    EndIf

    You can then back test the above system in PRT…

    #236206 quote
    herchell
    Participant
    New
    First of all, thank you, When I finished the course, I was given real world project. The topic I have been given is to take the normal signal of the moving averages and then take the signal by putting it into the Fourier transform. Finally I compare these signals and do a backtest.I have searched various sites, books to understand this issue. For 3 weeks
    #236208 quote
    JS
    Participant
    Senior

    Hi,

    Just out of curiosity and to learn…

    Take a Signal=Average[10](Close)

    In the time domain, the impulse response, for the above signal, gives a rectangular impulse with a length of 10 units and a (constant) amplitude of 0.1…

    What kind of signal did you get back from the Fourier Transform…?

    #236220 quote
    Quino
    Participant
    Average
    Hi, It’s curious that we want to assimilate the curve of an action to an electrical signal (for example) and do a Fourier transform? This is nonsense. An electrical signal is completely defined by mathematics (physical science) where you can work in a spectral domain as well in time domain, while trading is closer to the human sciences where profit is the driving force of stock movements (curve not defined by mathematical functions).
    #236223 quote
    JS
    Participant
    Senior

    Hi,

    Many (famous) traders and hedge funds, use mathematical and statistical functions to define the characteristics of the price signal…  Is that all nonsense?

    According to you, “the profit is the driving force of stock movements” …

    How do you describe this relation between the profit and stock movements?

    p.s. is not all sciences human sciences?

    #236224 quote
    PeterSt
    Participant
    Master
    Hello @Quino, Although I never used anything of it for real**, I myself am sort of convinced that a lot of Electrical Engineering can be applied to Price Signals as well. Just for fun : look at the “development” of a steep electrical signal, which as you may know is build from sines – all electrical signals are build from sines – also perceived squares. **): Not by means of the math meant for it but for Fx I most certainly apply the Entries exactly like that (wait for the signal (= Price) to “evolve”). There is much more to this and Jaap (JS) knows this better than me, and I think he even attempted to create technical signals around this. Jaap, how did you fare with this ? you started out with that over here in PRT – I think you thought I was making fun of it, but I was not at all and I really think this is an approach (for technical systems/strategies). I suppose @herchell got this “real world project” because it just might be one; I am not the type of reading “trader” books – or internet pages for that matter – but I think II can see how an (inverse) FFT can bring sensical data from frequency to time and vise versa (the FFT is all about that). For example, I think you will be able to dig up the similarities per instrument, if you only compare them by FFT means. What to do with that ? no idea; I can’t cope with all the idea I have and working them out, to begin with. 🙂 Edit: cross-posted with JS.
    #236226 quote
    GraHal
    Participant
    Master
    Jaap, how did you fare with this ? you started out with that over here in PRT
    Over where?? 🙂 Was ‘here’ supposed to be a clickable link?
    #236227 quote
    PeterSt
    Participant
    Master
    His first posts … Edit : in this forum.
    GraHal thanked this post
    #236228 quote
    PeterSt
    Participant
    Master
    This is from about the first Google result I ran into : Handling Stock Data using the Fast Fourier Transform I only read a little into it, but I think it is a good read. The website presenting this, heads it under “Physics”. Nice eh ? Anyway, to work this out in a workable fashion, requires quite come coding, line for the “bins” in order (this will be about filtering out noise).
    KumoNoJuzza thanked this post
    #236230 quote
    JS
    Participant
    Senior

    Hi @PeterSt

    System finally runs well (after 3 years) …

    System is based on statistics, such as the standard deviation and the normal distribution …

    Key features:

    1. Time frame 1 second (to be as close as possible to the “tick data”)
    2. Trailing Stop
    3. Only “Long”
    4. Only RTH (Real Trading Hours)
    5. Only Dow Jones (IG & IB)
    KumoNoJuzza thanked this post
Viewing 15 posts - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.

Fourier transform and moving averages


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
herchell @herchell Participant
Summary

This topic contains 21 replies,
has 7 voices, and was last updated by KumoNoJuzza
1 year, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 08/07/2024
Status: Active
Attachments: 1 files
Logo Logo
Loading...