Why the huge AMA difference between PRT and TW?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #130185 quote
    Bel
    Participant
    New

    Using 1440 period same fast and slow setting AMA (adaptive moving average) I get completely different results on PRT and TW. Maybe thats because on PRT i use Cash Contract and on TW its Emini futures? Tried on futures contract on PRT same thing completely different results. Any thoughts? Thanks in advance.

     

    Regards,

    Bel.

    prt_nq.png prt_nq.png tw_nq1.png tw_nq1.png
    #130188 quote
    Vonasi
    Moderator
    Master

    There can only be two reasons.

    • Different data – which you will have as they are not using the same data feeds.
    • Different calculation methods. You would need to provide the code for the TW AMA to compare with the PRT AMA.
    Bel thanked this post
    #130190 quote
    Bel
    Participant
    New

    Thanks for reply Vonasi. It’s def the code from what I can tell. Can I paste the code here to have a quick glance if time permits:)?

     

    Regards,

    Bel.

    #130194 quote
    Vonasi
    Moderator
    Master

    Yes – Nicolas is the expert on other platform codes so hopefully he will be able to look at it.

    Bel thanked this post
    #130196 quote
    Bel
    Participant
    New

    /

    /@version=3
    // Copyright (c) 2018-present, Alex Orekhov (everget)
    // Adaptive Moving Average script may be freely distributed under the MIT license.
    study("Adaptive Moving Average", shorttitle="AMA", overlay=true)
    
    length = input(title="Length", type=integer, defval=14)
    fastLength = input(title="Fast EMA Length", type=integer, defval=2)
    slowLength = input(title="Slow EMA Length", type=integer, defval=30)
    highlightMovements = input(title="Highlight Movements ?", type=bool, defval=true)
    src = input(title="Source", type=source, defval=close)
    
    fastAlpha = 2 / (fastLength + 1)
    slowAlpha = 2 / (slowLength + 1)
    
    hh = highest(length + 1)
    ll = lowest(length + 1)
    
    mltp = hh - ll != 0 ? abs(2 * src - ll - hh) / (hh - ll) : 0
    
    ssc = mltp * (fastAlpha - slowAlpha) + slowAlpha
    
    ama = 0.0
    ama := nz(ama[1]) + pow(ssc, 2) * (src - nz(ama[1]))
    
    amaColor = highlightMovements ? (ama > ama[1] ? green : red) : #6d1e7f
    plot(ama, title="AMA", linewidth=2, color=amaColor, transp=0)
    #130197 quote
    robertogozzi
    Moderator
    Master

    Be so kind to always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read. Thank you 🙂

    Bel thanked this post
    #130199 quote
    Bel
    Participant
    New

    Thats exactly what I wanted to do but read insert PRT code and thought TW won’t do:) My bad!

    Thank you.

     

    Regards,

    Bel.

    #130203 quote
    Vonasi
    Moderator
    Master

    This is the code that returns exactly the same values as the platforms built in AMA. Hopefully Nicolas can tell if their are any differences.

    Period = 9
    FastPeriod = 2
    SlowPeriod = 30
     
    Fastest = 2 / (FastPeriod + 1)
    Slowest = 2 / (SlowPeriod + 1)
    if barindex < Period+1 then
    Kama=close
    else
    Num = abs(close-close[Period])
    Den = summation[Period](abs(close-close[1]))
    ER = Num / Den
    Alpha = SQUARE(ER *(Fastest - Slowest )+ Slowest)
    KAMA = (Alpha * Close) + ((1 -Alpha)* Kama[1])
    endif
    
    return kama
    Bel thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Why the huge AMA difference between PRT and TW?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Bel @saulyte1 Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by Vonasi
5 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/06/2020
Status: Active
Attachments: 2 files
Logo Logo
Loading...