iLowest() can return the LOWEST VALUE, but i want the bar index of this value instead of the value itself. Is there a function to perfom this?
- First EA- Simple example --phase 1
- How to detect pullback of market in MQL4 EA?
- Whats wrong with my stop loss?
// method smoothed spikes HiLo int count_bars=10,p,cb,sk; double hib,lob,bar=0,AvgBar=0.0,HiLo[2]; HiLo[1]=Close[0]; for(int pb=0;pb<2;pb++) { p=0;cb=0;sk=0; while(cb<count_bars+1) { hib=High[p]; lob=Low[p]; p++; if(hib-lob<0.0 || (2*bar<hib-lob && pb>0)) {sk++;} else if(pb<1) { bar+=hib-lob; cb++; } else { cb++; AvgBar+=hib-lob; if((hib+lob)*0.5>HiLo[0]) { HiLo[0]=(hib+lob)*0.5; hi=p; } if((hib+lob)*0.5<HiLo[1]) { HiLo[1]=(hib+lob)*0.5; lo=p; } } if(sk>count_bars*count_bars)break; } if(pb<1) {if(cb>0) bar*=1.0/cb;} else if(cb>0) AvgBar*=1.0/cb; } string info= "\nskippedSpikes: " +sk+ "\ncountedBarsForAverage: "+cb+ "\navrBar: " +avgBar+ "\navgHi: " +HiLo[0]+"|barIndexHi: "+hi+ "\navgLo: " +HiLo[1]+"|barIndexLo: "+lo+ "";If it helps you in anyway.
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