Compound Ratio Weighted Moving Average

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #210933 quote
    Johnsteed
    Participant
    Junior

    As I couldn’t find it yet – is anyone aware that a PRT version of the MA according to the concept described in

    https://www.tradingview.com/script/NgLjvBWA-RedK-Compound-Ratio-Moving-Average-CoRa-Wave/

    or in an extended form described in

    https://www.tradingview.com/script/6uNRzTkr-CoRA-Ribbon-Multiple-Compound-Ratio-Weighted-Moving-Averages/

    is available?

    Thank you for hints.

    #211069 quote
    JS
    Participant
    Senior

    Hi @Johnsteed

    I don’t think this indicator is present in PRT, when you have all the data (formulas, screenshots, etc.) you can ask if this indicator can be created or converted…

    #211078 quote
    Johnsteed
    Participant
    Junior
    Thank you JS for the feedback. It appears as an interesting concept which has been implemented and sold in other very popular trading platforms already. So far I’ve not more information than being available via the links I shared. I’m not aware how one could ask for an implementation of the concept. Looking at the formulars I may overkook something, but to me the information appears as being incomplete. Need to see if and how to move on …
    #211080 quote
    GraHal
    Participant
    Master
    Here is more information – including the code (expand at the bottom) if anybody wants to pursue it further? Looks a useful and new (to us) moving average? https://www.tradingview.com/script/NgLjvBWA-RedK-Compound-Ratio-Moving-Average-CoRa-Wave/
    #211111 quote
    Madrosat
    Participant
    Master
    hello Grahal can you translate the code en prt?? Have a good day Madrosat
    #211144 quote
    GraHal
    Participant
    Master
    No, I am not able to translate the code to PRT, sorry. If you make it easy (for others) by posting the code on here then I’m sure sombody will have a go?
    #211157 quote
    Madrosat
    Participant
    Master
    Here the code
    if somebody have a go
    //@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)
    #211349 quote
    Madrosat
    Participant
    Master
    Hello Nicolas  can you translate this code ,ou somebody can make it  . Have a good day Madrosat
    #211771 quote
    Nicolas
    Keymaster
    Master
    This indicator has been translated, you can download it here: RedK Compound Ratio Moving Average (CoRa_Wave)
    Johnsteed, GraHal and Razz thanked this post
    #211864 quote
    Johnsteed
    Participant
    Junior
    Hello Nicholas and the forum users having engaged here, thank you very much for this achievement! Being an infrequent user of the forum, I wasn’t sure how to manage to get this implemented. Great work! I like to add that the indicator is recommened to be used in multiple-data setup to create bands. These bands are said to provide even more useful information about the market situation and to support trading activities. This is likely to be evaluated yet. Just as a reminder, I included the link describing the band appeal already in my initial post: https://www.tradingview.com/script/6uNRzTkr-CoRA-Ribbon-Multiple-Compound-Ratio-Weighted-Moving-Averages/ In the material therein, one finds a comparison with other moving averages. That one might be interesting to those trying to use moving averages to provide trade signals, as CoRA is said have less lag than other moving averages. It is a subject of study to see if CoRA is indeed in a way superior in regards of lower lag while effectively smoothen insignificant price variations in the trend to avoid false trend change signals. So everyone open to explore new things might see a new action item.
    GraHal thanked this post
    #211874 quote
    Nicolas
    Keymaster
    Master
    Ok, for the record, just add multiple times the indicator on the price chart in order to form a band (with different length period of course).
    Razz thanked this post
    #211903 quote
    Razz
    Participant
    Master
    Good morning Nicolas Thank you for the indicator . It would be good if the indicator had the 5 lines as in the original and it would be best if a buy and sell signal is displayed if all 5 lines have the same direction/color. Don’t know how to implement that if I insert the indicator 5 times? Best regards
    #211907 quote
    Nicolas
    Keymaster
    Master
    Each moving average has its own color following their values comparison, ascending is green, descending is red. You can CALL multiple times the indicator and check if each of one is ascending or not: CALLMA1>CALLMA1[1] Create a boolean that check all 5 MA ascending:
    buycondition = CALLMA1>CALLMA1[1] and CALLMA2>CALLMA2[1] and ........up to 5
    #211917 quote
    Razz
    Participant
    Master
    Good morning Nicolas Thanks for your answer, but I don’t understand it and it’s beyond my programming skills. If I insert the indicator 5 times, the difference will be changed in the variables (e.g. 20,50,70,90,120). will then probably watch the whole first manually.
    #211919 quote
    Razz
    Participant
    Master
    I’ve tried it like this but it doesn’t show any changes?
    Callma1 = CALL "PRC_Adjustible CoRa_Wave"[20, 2, 1, 1](close)
    Callma2 = CALL "PRC_Adjustible CoRa_Wave"[50, 2, 1, 1](close)
    Callma3 = CALL "PRC_Adjustible CoRa_Wave"[70, 2, 1, 1](close)
    Callma4 = CALL "PRC_Adjustible CoRa_Wave"[90, 2, 1, 1](close)
    Callma5 = CALL "PRC_Adjustible CoRa_Wave"[120, 2, 1, 1](close)
    
    If  CALLMA1>CALLMA1[1] and CALLMA2>CALLMA2[1] and CALLMA3>CALLMA3[1] and CALLMA4>CALLMA4[1] and CALLMA5>CALLMA5[1] then
    buycondition =1
    endif
    
    return  buycondition
Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.

Compound Ratio Weighted Moving Average


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Johnsteed @johnsteed Participant
Summary

This topic contains 16 replies,
has 6 voices, and was last updated by Razz
2 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/05/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...