gus
April 30, 2026, 7:23pm
1
I want to draw a line on a chart from one pivot to another pivot, and then see on the chart a statement which says 'x cents per bar' or similar. Can this be done?
nsm51
May 1, 2026, 7:52am
2
you can start from here.
You are missing Math 101. Your formula is wrong. The internet is wide and open LinRegSlope is described precisely in Wikipedia. Really, Google is your friend. https://en.wikipedia.org/wiki/Linear_regression
Also take Excel and do the same and you will get the same result.
Copy paste this code
Plot( C, "Price", colorDefault );
period = 20;
Plot( LinearReg( C, period ), "LR", colorBlue );
bi = BarIndex();
sbi = SelectedValue( bi );
b = SelectedValue( LinRegIntercept( C, period ) );
a = Seleā¦
If you share the code for the pivot array(s) and use gfx to draw your lines, or you can also use BarsSince() and calculate Rate_of_change() too.
AFL Function Reference - LINEARRAY can plot lines with this too!
Plotting lines for specific array values only - AFL Programming - AmiBroker Community Forum