Stopping indicators from showing in a LRC


Category:
0
0

Pete, In reference to my question ” How to stop indicators from displaying in relation to a linear regression channels (LRC) direction”. I’ve been giving this some thought and may have an idea but still don’t know how to implement it. The attached PDf shows the unfinished Fibonacci linear regression channel I came up with and stock indicators from TOS-Bollinger band crossover, parabolic SAR, and Williams fractals. From another of your posts, I colored the paraSAR red and green.

Would there be a way to insert 2 clouds, a red from the LRC midline down and green from the LRC midline up? that way, the cloud color would minimize the color of the indicators that didn’t apply, basically noise. My signals for taking a short position would be red and in the upper portion of the channel where the green cloud would help minimize the noise of any green colored indicators. Would there be a way to adjust the opacity of the clouds? I wouldn’t necessarily want it to interfere with the color of the bars.

I don’t think this is an as elegant of solution as not having any green indicators appear above the LRC mid line and no reds below the LRC midline but may highlight any buy/sell signals.

Marked as spam
Posted by (Questions: 4, Answers: 7)
Asked on October 6, 2019 10:29 am
121 views
0
Private answer

Without your code I cannot even guess at a solution. If you do not want to publish your code in the public venue then you have two options:

  1. Configure and post a piece of code that includes only the basic elements that you don't mind sharing in a public venue.
  2. Submit this as custom project request. Our service rates are fully explained on this page of our website: https://www.hahn-tech.com/about/

Edit: Now that we have some code to work with I can add to my solution. The code provided by the author only plots the LRC and does not include any of the plots they want to hide when price is above or below the midline. So I had to make up my own. This code will plot cyan colored dots at the high of the bar when close of the bar is above the midline. Likewise it will plot magenta colored dots at the low for the opposite condition.

input price = close;
input widthOfChannel = 100.0;
input fullRange = Yes;
input length = 21;
plot MiddleLR;
if (fullRange) then {
MiddleLR = InertiaAll(price);
} else {
MiddleLR = InertiaAll(price, length);
}
def dist = HighestAll(AbsValue(MiddleLR – price)) * (widthOfChannel / 100.0);
plot UpperLR = MiddleLR + dist;
plot LowerLR = MiddleLR – dist;
plot UpperLRm1 = middleLR + dist *(-.525);
plot UpperLRm2 = middleLR + dist *.573;
plot lowerLRm1 = middlelr – dist * .577;
plot LowerLRm2 = middlelr – dist * (-.525);
MiddleLR.SetDefaultColor(GetColor(5));
UpperLR.SetDefaultColor(GetColor(5));
LowerLR.SetDefaultColor(GetColor(5));
plot highOfBar = if close > MiddleLR then high else Double.NaN;
highOfBar.SetPaintingStrategy(PaintingStrategy.POINTS);
highOfBar.SetLineWeight(4);
highOfBar.SetDefaultColor(Color.CYAN);
plot lowOfBar = if close < MiddleLR then low else Double.NaN;
lowOfBar.SetPaintingStrategy(PaintingStrategy.POINTS);
lowOfBar.SetLineWeight(4);
lowOfBar.SetDefaultColor(Color.MAGENTA);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 6, 2019 10:49 am
0
Pete, I don’t know how to post the code so it looks correct. I did post it previously on my earlier question and will try it again here too. input price = close; input widthOfChannel = 100.0; input fullRange = Yes; input length = 21; plot MiddleLR; if (fullRange) then {MiddleLR = InertiaAll(price);} else { MiddleLR = InertiaAll(price, length);} def dist = HighestAll(AbsValue(MiddleLR – price)) * (widthOfChannel / 100.0); plot UpperLR = MiddleLR + dist; plot LowerLR = MiddleLR – dist; plot UpperLRm1 = middleLR + dist *(-.525); plot UpperLRm2 = middleLR + dist *.573; plot lowerLRm1 = middlelr – dist * .577; plot LowerLRm2 = middlelr – dist * (-.525); MiddleLR.SetDefaultColor(GetColor(5)); UpperLR.SetDefaultColor(GetColor(5)); LowerLR.SetDefaultColor(GetColor(5));; it looks correct on here but when I ”save” it comes out all in a block rather than individual lines- sorry.
( at October 6, 2019 11:01 am)
0
No problem. I have a code editor that enables be to fix that in under 10 seconds. I have updated my answer to include a solution that you requested.
( at October 6, 2019 3:55 pm)
0
Hey Pete, thanks for the effort there. I'm thinking I'm having hard time explaining what I'm looking for, so this is going to be a learning event for me. The goal is, when looking at a short set up I can some how hide(with code- not showing long signals- I may be wrong but that seems more complicated) or minimize/mask those signals with a cloud of the same color. I would like to see the area between the midline and upperLR to be green and the area between the midline and the lowerLR to be red. it needs to have a level of opacity so all the colors still show but in the green cloud at the top, the green up signals are masked and the red short signals stand out better. A qualifying short set up is when the close is above the midline, that is the very first qualifier. A long set up is the close is below the midline as the first qualifier. I'm thinking all of the long signals-green, would be visually minimized when looked at through a green colored cloud allowing me to focus better on just the short indicators. Seriously- the more I type this out thinking about it, maybe I have too many indicators and need to simplify...
( at October 6, 2019 5:21 pm)
0

No, it is not simpler. It is in fact not possible. Yes you can add shading to the chart between those levels. However there is no way to adjust the opacity. It is much simpler to just hide the long singles on one side of the midline and hide the short signals on the other side. Which is exactly what I provided in my solution.

Nevertheless, here is how you would add green and red shading to your indicator:

AddCloud(upperLRm1, middleLR, Color.GREEN, Color.GRAY);
AddCloud(middleLR, lowerLRm1, Color.RED, Color.GRAY);

( at October 6, 2019 6:31 pm)
0
I love the shading Pete. it actually works better then I thought it would. I'll have to further study and play with the previous part of the solution- hiding the long/short signals- again, great job, thanks.
( at October 6, 2019 7:34 pm)