Fractal-Based Trendlines

Posted By: edu

Fractal-Based Trendlines - 04/05/17 13:15

Hi!

I am trying to display trendlines, that join the two last fractals.
I created a static var, that joins the last fractals, but it does not join the points diagonally, but takes the last non-zero fractal value. Any idea?

Here's the code:

function run()
{
set(PLOTNOW);
StartDate = EndDate = 2010;

var FH = FractalHigh(series(price()),5);

if (FH>0 or FH<0) plot("FH", FH, DOT, GREEN);

static var TrendLine; if(FH>0 or FH<0) {TrendLine = FH;}
plot("TrendLine", TrendLine, LINE, PURPLE);
}
Posted By: edu

Re: Fractal-Based Trendlines - 04/24/17 17:28


I get a line that connects the green dots as in steps, any idea about how to connect dots with a straight line?

Here's what I get:
https://drive.google.com/file/d/0Byj3F1NtSWtLOHJrUkR2ZjhtNms/view?usp=sharing
Posted By: jcl

Re: Fractal-Based Trendlines - 04/26/17 12:41

You can find an example in indicators.c, look for the code of the ZigZag indicator.
© 2024 lite-C Forums