Digital Signal Processing – Defining & Using the Difference Equation

Viewing 15 posts - 1 through 15 (of 30 total)
  • Author
    Posts
  • #172558 quote
    GraHal
    Participant
    Master

    JS please can you provide a link to an Indicator or script that provides the ‘difference equation’ of price action?

    Preferably not a link to reams of theory on Digital Signal Processing. I have scan read such (sincc you mentioned DSP on another Topic) and it has similarities to the theory of radar circuitry (wave frequencies, bandpass filters etc) .

    Is there anything on this website that we can use to give us the ‘difference equation’?

    Is DSP something new (to us?) that we should try out and you are the man who is going to lead us onward and upward by pointing us to a practicable and usable source of the ‘difference equation’?? 🙂

    #172559 quote
    JS
    Participant
    Senior

    Hi GraHal,

    I hope you understand that I can’t reveal my algorithm because it took me 20 years to come to this point but you are in the right direction, it has similarities to the theory of wave frequencies and filters.

    Black and Scholes also used a difference equation for  option pricing (only continue instead of discreet).

    I can tell you that ALL price action is discreet, lineair and time invariant. Such a system is called a LTD -system.

    The general difference equation for a LTD -system is:

    {\displaystyle y[n]=\sum _{k=0}^{N}a_{k}\,x[n-k]+\sum _{i=1}^{M}b_{i}\,y[n-i]}

    It is not that hard, if i can do it you can do it.

    GraHal thanked this post
    #172561 quote
    GraHal
    Participant
    Master

    Mods

    To save hijacking jebus89 Topic any further, please could you transfer the last 2 posts above – mine and JS – to a new Topic named:

    Digital Signal Processing – Defining & Using the ‘Difference Equation’

    #172565 quote
    robertogozzi
    Moderator
    Master

    Done.

    GraHal thanked this post
    #172568 quote
    Eric
    Participant
    Master

    3 trades a year using 5 min timeframe seems odd?

    #172570 quote
    JS
    Participant
    Senior

    Hi Eric,

    The system is Time Invariant so it doesn’t matter what timeframe your on.

    You can use 5 min, 15 min, 1 hour, etc. and the system will open exactly the same amount of trades…

    Schermafbeelding-2021-06-27-om-16.54.42.png Schermafbeelding-2021-06-27-om-16.54.42.png Schermafbeelding-2021-06-27-om-16.55.38.png Schermafbeelding-2021-06-27-om-16.55.38.png Schermafbeelding-2021-06-27-om-16.56.45.png Schermafbeelding-2021-06-27-om-16.56.45.png
    #172694 quote
    JS
    Participant
    Senior

    Positions opened by the system at this moment…

    Posities-29-06-2021.png Posities-29-06-2021.png
    #172697 quote
    GraHal
    Participant
    Master

    So can PRT handle / calculate y[n] using the formula below?

    Are you going to tell us (or direct us to a source) what the letters stand for when related to Price of an Instrument?

    {\displaystyle y[n]=\sum _{k=0}^{N}a_{k}\,x[n-k]+\sum _{i=1}^{M}b_{i}\,y[n-i]}

    #172726 quote
    JS
    Participant
    Senior

    Hi GraHal,

    Have you any idea how PRT works, what happens when you (for example) use a simple moving average and how it is calculated by PRT?

    This is how PRT calculate a SMA:

    N = number of samples (or time period)

    Xi = Close[n]

    Mu or y[n] is the variable

    GraHal and druby thanked this post
    Mu.png Mu.png
    #172758 quote
    Finning
    Participant
    Veteran

    Hi GraHal,

    this might be an interesting read

    https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Book%3A_Signals_and_Systems_(Baraniuk_et_al.)/12%3A_Z-Transform_and_Discrete_Time_System_Design/12.08%3A_Difference_Equations

    GraHal and druby thanked this post
    #172784 quote
    GraHal
    Participant
    Master
    Hahaha … nice one!  The link casts ‘light on the wizardry’! 🙂 From the definition below of Difference Equation … it sounds similar to momentum?

    An equation that shows the relationship between consecutive values of a sequence and the differences among them.  

    #174270 quote
    JS
    Participant
    Senior
    https://www.tradingview.com/chart/GBPUSD/WLP5849o-Digital-Filters-And-DSP/ Interesting article on trading view, shows that a SMA is the basis of a filter…
    #232869 quote
    SnorreDK
    Participant
    Junior
    I used ChatGTP to create a DSP (LCCDE) – code, but no trades. Any Ideas?  
    DEFPARAM CumulateOrders = False
    // Definiera koefficienterna för skillnadsekvationen
    a0 = 0.5
    a1 = 0.3
    b1 = -0.2
    
    // Inledande värden
    y = close
    
    // Beräkning av DSP-filter
    y = a0 * close + a1 * close[1] + b1 * y[1]
    
    
    SET STOP %loss 1
    // Handel logik
    IF NOT ONMARKET THEN
    IF y > close THEN
    BUY 1 CONTRACT AT MARKET
    
    ELSIF y < close THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    ENDIF
    set target %profit 1
    #232885 quote
    robertogozzi
    Moderator
    Master
    Changing line 12 made it work, but I don’t know if that’s what you wanted:
    DEFPARAM CumulateOrders = False
    
    // Definiera koefficienterna för skillnadsekvationen
    a0 = 0.5
    a1 = 0.3
    b1 = -0.2
     
    // Inledande värden
    y = close
     
    // Beräkning av DSP-filter
    y = a0 * close + a1 * close[1] + b1 * close[2]  //changed
     
     
    SET STOP %loss 1
    // Handel logik
    IF NOT ONMARKET THEN
       IF y > close THEN
          BUY 1 CONTRACT AT MARKET
       ELSIF y < close THEN
          SELLSHORT 1 CONTRACT AT MARKET
       ENDIF
    ENDIF
    set target %profit 1
    graph y
    #232950 quote
    SnorreDK
    Participant
    Junior
    Hi Eric, The system is Time Invariant so it doesn’t matter what timeframe your on. You can use 5 min, 15 min, 1 hour, etc. and the system will open exactly the same amount of trades… You dont use the code timeframe(x..) in the code?
Viewing 15 posts - 1 through 15 (of 30 total)
  • You must be logged in to reply to this topic.

Digital Signal Processing – Defining & Using the Difference Equation


General Trading: Market Analysis & Manual Trading

New Reply
Author
Summary

This topic contains 29 replies,
has 10 voices, and was last updated by justisan
1 year, 1 month ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 06/27/2021
Status: Active
Attachments: 6 files
Logo Logo
Loading...