Traduction du code CORA WAVE

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #211726 quote
    MadrosatMadrosat
    Participant
    Master

    Voici le code, si qq’un veut essayer de le traduire [merci]

    //@version=4
    // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
    // © RedKTrader

    study(“Comp_Ratio_MA”, shorttitle = “CoRa Wave”, overlay = true, resolution =””)

    // ======================================================================
    // Compound Ratio Weight MA function
    // Compound Ratio Weight is where the weight increases in a “logarithmicly linear” way (i.e., linear when plotted on a log chart) – similar to compound ratio
    // the “step ratio” between weights is consistent – that’s not the case with linear-weight moving average (WMA), or EMA
    // another advantage is we can significantly reduce the “tail weight” – which is “relatively” large in other MAs and contributes to lag
    //
    // Compound Weight ratio r = (A/P)^1/t – 1
    // Weight at time t A = P(1 + r)^t
    // = Start_val * (1 + r) ^ index
    // Note: index is 0 at the furthest point back — num periods = length -1
    //
    f_adj_crwma(source, length, Start_Wt, r_multi) =>
    numerator = 0.0, denom = 0.0, c_weight = 0.0
    //Start_Wt = 1.0 // Start Wight is an input in this version – can also be set to a basic value here.
    End_Wt = length // use length as initial End Weight to calculate base “r”
    r = pow((End_Wt / Start_Wt),(1 / (length – 1))) – 1
    base = 1 + r * r_multi
    for i = 0 to length -1
    c_weight := Start_Wt * pow(base,(length – i))
    numerator := numerator + source[i] * c_weight
    denom := denom + c_weight
    numerator / denom
    // ====================================================================== ==

    data = input(title = “Source”, type = input.source, defval = hlc3)
    length = input(title = “length”, type = input.integer, defval = 20, minval = 1)
    r_multi = input(title = “Comp Ratio Multiplier”, type = input.float, defval = 2.0, minval = 0, step = .1)
    smooth = input(title = “Auto Smoothing”, type = input.bool, defval = true, group = “Smoothing”)
    man_smooth = input(title = “Manual Smoothing”, type = input.integer, defval = 1, minval = 1, step = 1, group = “Smoothing”)

    s = smooth ? max(round(sqrt(length)),1) : man_smooth
    cora_raw = f_adj_crwma(data, length, 0.01, r_multi)
    cora_wave = wma(cora_raw, s)

    c_up = color.new(color.aqua, 0)
    c_dn = color.new(#FF9800 , 0)
    cora_up = cora_wave > cora_wave[1]
    plot(cora_wave, title=”Adjustible CoRa_Wave”, color = cora_up ? c_up : c_dn, linewidth = 3)

    #211769 quote
    NicolasNicolas
    Keymaster
    Legend

    L’indicateur Cora Wave a été traduit, tu peux le télécharger sur cette page: RedK Compound Ratio Moving Average (CoRa_Wave)

    cora-wave-moving-average.png cora-wave-moving-average.png
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Traduction du code CORA WAVE


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Madrosat @madrosat Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by NicolasNicolas
3 years, 6 months ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 03/19/2023
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...