slope between anchors = (anchor2price - anchor1price) / (anchor2bar - anchor1bar) (slope = (y2 - y1)/(x2 - x1)) yintercept = slope * (CurrentBar - anchor1bar) (yintercept = slope * (x2 - x1))
x1bbar = Bars.GetBar(subWave.TrendStartAnchor.Time); y1 = subWave.TrendStartAnchor.Price; y2 = subWave.TrendEndAnchor.Price; y3 = subWave.ParallelStartAnchor.Price; [B] y4 = (y1 - y3) / 2 + y3; // this is trying to figure midpoint (50 Value)[/B] x1 = CurrentBar - Bars.GetBar(subWave.TrendStartAnchor.Time); x2 = CurrentBar - Bars.GetBar(subWave.TrendEndAnchor.Time); x3 = CurrentBar - Bars.GetBar(subWave.ParallelStartAnchor.Time); x2bbar = Bars.GetBar(subWave.ParallelStartAnchor.Time); // First calculate the slope of trend channel trendSlope = (subWave.TrendEndAnchor.Price - subWave.TrendStartAnchor.Price) / (Bars.GetBar(subWave.TrendEndAnchor.Time) - Bars.GetBar(subWave.TrendStartAnchor.Time)); // Now project the slope to a new bar yintercept = trendSlope * (CurrentBar - x1bbar); yinterceptParallel = trendSlope * (CurrentBar - x2bbar); [B] yinterceptMid = ???[/B] // To demonstrate that we know where the trend channel line is Draw.Dot (this, "t1"+CurrentBar, true, 0, yintercept + y1, Brushes.Gold); // To demonstrate that we know where the parallel channel line is Draw.Dot (this, "t5"+CurrentBar, true, 0, yinterceptParallel + y3, Brushes.Gold); // To demonstrate that we know where the mid channel line is Draw.Dot (this, "t6"+CurrentBar, true, 0, [B]trendSlope * (y1 - y3) / 2 + y3[/B], Brushes.Gold);
Comment