Sphelele Sphesihle Lubanyana: I am having trouble getting the zigzag peak date or the date of the candle where the zigzag created a high or low points
This is what I have
You never read in or use any time. | datetime tt;
⋮
swing_date[zzCount] = tt; |
No need for the CopyTime Simplify | swing_date[zzCount] = iTime(NULL,0, i); |
I finally cracked it.. I hope this helps someone else...
int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //---One Time convert points to a price gap static double levelGap = InpGapPoints; DrawLevels(); if(rates_total == prev_calculated) return(rates_total); //Get the most recent <lookback> peaks double zz = 0; datetime tt; double zzPeaks[]; int zzCount = 0; ArrayResize(zzPeaks, InpLookBack); ArrayInitialize(zzPeaks,0.0); int count = CopyBuffer(Handle, 0, 0,rates_total, Buffer); if(count < 0) { int err = GetLastError(); return(0); } for(int i = 1; i < rates_total && zzCount < InpLookBack; i++) { zz = Buffer[i]; if(zz != 0&& zz != EMPTY_VALUE) { zzPeaks[zzCount] = zz; zzCount++; for(int i = 1; i < rates_total ; i++) { if(zzPeaks[zzCount-1] == low[i]) Print(time[i]); } } } //--- return value of prev_calculated for next call return(rates_total); }
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
Hi, I am having trouble getting the zigzag peak date or the date of the candle where the zigzag created a high or low points
I have gone through all threads i found talking about the zigzag.
This is what I have