BardParticipant
Master
Hi Nicolas,
Because you’re English is very good I might have a chance here in the UK forum to understand your last Italian to English reply.
Re: The Belkhayate Indicator and the DPO and past data: ( https://www.prorealcode.com/topic/center-of-gravity/page/2/#post-92378 )
I would like to know if the Belkhayate indicator that uses the DPO can be modified to prevent or minimise the redrawing problem which changes the information it is displaying about past data as new data comes in, as per:
https://www.prorealcode.com/topic/dpo/#post-8862
https://www.prorealcode.com/topic/detrended-price-ocillator/#post-8266
I think I get that you’re saying it can’t be modified but I’m not sure why now as I’m now confused by the post ==> #8862 and that the DPO can be calculated using future or past data?
(From the Italian forum reply you’re reply was difficult to fully understand:
“just use the money”?
Bard Sorry, I think you have not understood what I explained in my previous post.
The Belkhayate indicator uses the same DPO, the ProRealTime version uses the DPO indicator and reversed to know the price of the future (because the data protection agent knows this). Therefore, it is not logical to use the DPO of the data passed in this case, just use the money and you will get a similar channel to many others on the web site.
The center of gravity is popular because it surprised everyone as to its accuracy by knowing the future? Then change its formula would use any other channel indicator! )
Re: De-trending data, from the DPO page: https://www.prorealcode.com/documentation/dpo/
Then it is necessary to move back the data of this average of n/2+1) days ago.
I don’t see the point of the “+1” because the data is already half the “n” value i.e. it’s been pulled right back into the past by the n/2 and so is not at the current “n” value.
I just hoped that those Belkhayate bands could be made to be more realistic and not such an amazing fit with the past (even if the current version of the indicator does give you a great sense of the current trend and it’s impending flattening or reversal).
Saluti! (This was an attempt to use the Italian for “Cheers” but the website converted it, I had no idea… I’ve been copying and pasting from Google translate!)
If you want a non repainting COG, just add standard deviation bands (multiplied by the golden ratio) to a linear regression of the same period. The COG is similar to any other channels, the Belkahyate version had gain popularity because it was accurate on history due to its repainting behavior. So, asking for a non repainting version makes no sense since it will be like any other price channel, a mean with upper and lower bands.
BardParticipant
Master
Right, got it, thanks for taking the time to clarify.
Belkhayate’s “accuracy”… you must have been around long enough to have seen it all! 😁
I’ll see if I can “add standard deviation bands (multiplied by the 1.618 golden ratio) to a linear regression” with my “cut and paste” coding skills..
…Didn’t end up looking like I expected, the bands are very wide?
//Parameters:
Length = 30
//Golden Ratio = 1.618 0339887
//LRMinus4 = 1.618*3*-std[length](totalprice)+LRCentre
LRMinus3 = 1.618*2*-std[length](totalprice)+LRCentre
LRMinus2 = 1.618*-std[length](totalprice)+LRCentre
LRCentre = linearregression[length](totalprice)
LRPlus2 = 1.618*std[length](totalprice)+LRCentre
LRPlus3 = 1.618*2*std[length](totalprice)+LRCentre
//LRPlus4 = 1.618*3*std[length](totalprice)+LRCentre
RETURN LRMinus3 coloured (124,252,0)style(line,1) as "Low LR 3 Dev", LRMinus2 coloured (124,252,0)style(line,1) as "Low LR 2 Dev", LRCentre coloured (255,69,0)style(line,2), LRPlus2 coloured (255,20,147)style(line,1) as "High LR 2 Dev", LRPlus3 coloured (255,20,147)style(line,1) as "High LR 3 Dev"
Because the standard deviation is calculated with totalprice while we want to know the std of the difference between the totalprice and the mean of the channel instead (that linear regression ..). Here is the code modified:
//Parameters:
Length = 100
LRCentre = linearregression[length](totalprice)
diff= totalprice-LRcentre
stdev=std[length](diff)
//Golden Ratio = 1.618 0339887
//LRMinus4 = 1.618*3*-std[length](totalprice)+LRCentre
LRMinus3 = 1.618*2*-stdev+LRCentre
LRMinus2 = 1.618*-stdev+LRCentre
LRPlus2 = 1.618*stdev+LRCentre
LRPlus3 = 1.618*2*stdev+LRCentre
//LRPlus4 = 1.618*3*std[length](totalprice)+LRCentre
RETURN LRMinus3 coloured (124,252,0)style(line,1) as "Low LR 3 Dev", LRMinus2 coloured (124,252,0)style(line,1) as "Low LR 2 Dev", LRCentre coloured (255,69,0)style(line,2), LRPlus2 coloured (255,20,147)style(line,1) as "High LR 2 Dev", LRPlus3 coloured (255,20,147)style(line,1) as "High LR 3 Dev"
BardParticipant
Master
Nice one, thanks Nicolas.
I’ve cleaned up some of my code labels, band colours and added 2.2 and 3.6 standard deviations to reflect probability distribution reality, i.e. Cynthia Kases’ skew found after empirical research on past market data:
When these bands narrow, be warned. (See GBP/Yen screenshot with overlay of a 30 day Bollinger at 3.6 Std Devs for comparison).
//Linear Regression with Std Deviation/Golden Ratio Bands
//Golden Ratio = 1.618 0339887
//Parameters:
Length = 30
LRCentre = linearregression[length](totalprice)
diff= totalprice-LRcentre
StDev=std[length](diff)
LRMinus3 = 1.618*3.6*-StDev+LRCentre
LRMinus2 = 1.618*2.2*-StDev+LRCentre
LRMinus1 = 1.618*-StDev+LRCentre
LRPlus1 = 1.618*StDev+LRCentre
LRPlus2 = 1.618*2.2*StDev+LRCentre
LRPlus3 = 1.618*3.6*StDev+LRCentre
RETURN LRMinus3 coloured (124,252,0)style(line,1) as "Low LR 3.6 Dev", LRMinus2 coloured (124,252,0)style(line,1) as "Low LR 2.2 Dev", LRMinus1 coloured (124,252,0)style(line,1) as "Low LR 1.0 Dev", LRCentre coloured (255,0,0)style(dottedline,2) as LR Centre, LRPlus1 coloured (255,0,0)style(line,1) as "High LR 1.0 Dev", LRPlus2 coloured (255,0,51)style(line,1) as "High LR 2.2 Dev", LRPlus3 coloured (204,0,0)style(line,1) as "High LR 3.6 Dev"