Compound Ratio Weighted Moving Average
Forums › ProRealTime English forum › ProBuilder support › Compound Ratio Weighted Moving Average
- This topic has 16 replies, 6 voices, and was last updated 1 year ago by Razz.
-
-
03/05/2023 at 4:27 PM #210933
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
is available?
Thank you for hints.
03/08/2023 at 7:27 AM #211069Hi @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…
03/08/2023 at 9:56 AM #211078Thank 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 …
03/08/2023 at 10:24 AM #211080Here 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/
03/08/2023 at 2:06 PM #21111103/08/2023 at 7:08 PM #21114403/08/2023 at 11:24 PM #21115712345678910111213141516171819202122232425262728293031323334353637383940414243444546Here the codeif 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/// © RedKTraderstudy("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))) - 1base = 1 + r * r_multifor i = 0 to length -1c_weight := Start_Wt * pow(base,(length - i))numerator := numerator + source[i] * c_weightdenom := denom + c_weightnumerator / 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_smoothcora_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)03/11/2023 at 9:08 AM #21134903/20/2023 at 9:51 AM #21177103/21/2023 at 10:30 AM #211864Hello 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:
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.
1 user thanked author for this post.
03/21/2023 at 1:25 PM #21187403/22/2023 at 7:13 AM #211903Good 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
03/22/2023 at 9:04 AM #211907Each 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:
1buycondition = CALLMA1>CALLMA1[1] and CALLMA2>CALLMA2[1] and ........up to 503/22/2023 at 11:06 AM #211917Good 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.
03/22/2023 at 11:18 AM #211919I’ve tried it like this but it doesn’t show any changes?
1234567891011Callma1 = 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] thenbuycondition =1endifreturn buycondition -
AuthorPosts
Find exclusive trading pro-tools on