double K[],D[],ema[],K_t[],D_t[],K2[],D2[],EMA_1[]; for(k=1;k<=Bars-1;k++) calcDiv(k); : void calcDiv(int k){ : bool isHighTurn = D[k]>D[k+1] && D[k]<D[k-1],
- D[] has no size, so D[k] is array exceeded. When k == Bars-1, D[k+1] is D[Bars] which would never exist even if you resized it to Bars.
RegularBullD = D[y]>D[y+1] && D[y]<D[y-1] && Low[z]>Low[y],
Y has no value so you are accessing random elements which likely don't exist- Z is undeclared. Don't post unless your code compiles.
int limit=Bars-calcBars-1; for(int i=Bars-1;i>=limit;i--){ calcSto(i); }
Will Only calculate the oldest bar. Do it right, your lookback is k+1#define LOOKBACK 1 for(int i=Bars-1-MathMax(calcBars, LOOKBACK) ;i>=0;i--){ // All bars calcSto(i); }

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 all, I have a problem with a newly written indicator that basically detects four different divergences explained on this site: http://www.babypips.com/school/high-school/trading-divergences/divergence-cheat-sheet.html
My problem is that I want to make a second for loop running inside the start function every first, newly appearing bar on the chart. Unfortunately whenever I try to start and test the indicator, it automatically exits. Is there a problem with my switch operator maybe?
Any suggestions?
Thank you in advance!