double ZigLatestHigh =iCustom(symbol,timeframe,"ZigZag",???,???); double ZigLatestLow =iCustom(symbol,timeframe,"ZigZag",???,???);
Are you actually looking at other "symbol,timeframe"s? Simplify, trade the current chart (otherwise you can't use Bars, High[], etc.)
ZigZag has only 1 buffer to read.
for(int iBar = 1; iBar < Bars; iBar++) if( iCustom(NULL,0, "ZigZag", 0, iBar) != 0) break; int iZig1 = iBar; for(iBar--; iBar < Bars; iBar++) if( iCustom(NULL,0, "ZigZag", 0, iBar) != 0) break; int iZig2 = iBar; double h1 = High[iZig1], h2 = High[iZig2]; double ZigLatestHigh = (h1 > h2) ? h1 : h2, ZigLatestLow = (h1 > h2) ? Low[iZig2] : Low[iZig1];
Hi WHRoeder,
Thanks a lot, that "Ternary Operator ?" is so sleek! - good to learn new things ;)
Many thanks for support!
D.
WHRoeder:
Are you actually looking at other "symbol,timeframe"s? Simplify, trade the current chart (otherwise you can't use Bars, High[], etc.)
ZigZag has only 1 buffer to read.
for(int iBar = 1; iBar < Bars; iBar++) if( iCustom(NULL,0, "ZigZag", 0, iBar) != 0) break; int iZig1 = iBar; for(iBar--; iBar < Bars; iBar++) if( iCustom(NULL,0, "ZigZag", 0, iBar) != 0) break; int iZig2 = iBar; double h1 = High[iZig1], h2 = High[iZig2]; double ZigLatestHigh = (h1 > h2) ? h1 : h2, ZigLatestLow = (h1 > h2) ? Low[iZig2] : Low[iZig1];
Should iBar-- be iBar++ ?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello Boys
I am trying to extract the latest high and latest low painted on the chart by the ZigZag indicator at any moment. Unlike other indicators, the problem with this fellow is that... the number of bars to be counted back is not fixed, it can also skip to Bar0 and start moving again within Bar0 if previous high/low is crossed.
is iCustom the way to do it?
Any tips much appreciated.
D.