♥ 0 |
Opinions aside on value derived from LinReg studies.. (this is small piece of a larger puzzle) Beginning with LinearRegCh100, we add one line to the bottom. #================================== input price = close; plot MiddleLR = InertiaAll(price); MiddleLR.setDefaultColor(GetColor(5)); plot pricelineCurrentManual = (dist * .88) + MiddleLR; #======================== When we apply the study to SPY 1 Year/Daily chart. We get a line parallel to the MiddleLR at 88% away from MiddleLR. See image 1. This is EXACTLY what I want my final result to look like. (Today 1/17/20, 88% of dist is approximately where the priceline would be) I’m looking for a way to pass ONLY the current price variable (percentage away from MiddleLR) into “plot pricelineCurrentManual = (dist * .88) + MiddleLR;” and have it plot the line based on that value only (not evaluated for every bar) Attempting if/then/else fails. Result is about what I expected, I’m headed down a wrong path. #==================================== input price = close; plot MiddleLR = InertiaAll(price); MiddleLR.SetDefaultColor(GetColor(5)); #plot pricelineCurrentManual = (dist * .88) + MiddleLR; def lastClose = HighestAll(if IsNaN(close[-1]) then close else Double.NaN); def percentageCurrent = Round((lastClose – MiddleLR) / dist, 3); def offsetCurrent25; plot plcurrent90; #========================================= I wind up with a shortened plot. See image 2. Which seems to be evaluating ranges of bars, then falling out of my loop, rather than using the current day’s value. As I slept on this last night I recalled a LinReg extendToLeft variable, on doing some reading on it, I ran across this, and it may be my answer?? https://www.hahn-tech.com/ans/how-to-extend-point-of-control-into-the-rest-of-the-chart/ Ok, I have already provided the answer to this follow up question but here it is again. The lines on the study are plots. Not trend lines. Plots cannot be extended the way a hand drawn trend line can be. It is not possible. Not under any circumstances or through any method. My next thought was trying “fold” but thought I would ask for feedback/direction first. RESOLVED
Marked as spam
|
Please log in to post questions.