Quote

ZigZag indicator; converts the Data series into alternating straight lines with at least the given Depth (in Data units) and Length (in bar units). ZigZag is non-predictive and can only identify trends in hindsight. Returned: rSlope (the slope of the last identified line; upwards lines have a positive slope, downwards lines a negative slope); rPeak (the bar offset of the last identified peak); rLength (the number of bars of the last zig or zag that ends with rPeak). If a nonzero Color is given, the zigzag lines are plotted in the chart. Source code in indicators.c, example in Indicatortest.c. The function internally creates series and thus must be called in a fixed order in the script.


Quote

// plot some indicatorsfunction run(){ set(PLOTNOW);
var* Price = series(price());

// plot Bollinger bands BBands(Price,30,2,2,MAType_SMA);
plot("Bollinger1",rRealUpperBand,BAND1,0x00CC00);
plot("Bollinger2",rRealLowerBand,BAND2,0xCC00FF00);
plot("SAR",SAR(0.02,0.02,0.2),DOT,RED);
ZigZag(Price,20*PIP,5,BLUE);

// plot some other indicators
plot("ATR (PIP)",ATR(20)/PIP,NEW,RED);
plot("Doji",CDLDoji(),NEW+BARS,BLUE);
plot("FractalDim",FractalDimension(Price,30),NEW,RED);
plot("ShannonGain",ShannonGain(Price,40),NEW,RED);
}


Hi, is there a way to return the zigzag series or plot multiple zigzag indicators please?

Last edited by degenerate_762; 03/26/22 05:13.