Hi, i want to find the maximum value for an indicator, I've had a couple of goes but hasn't worked.
| for(int i=0; i<400; i++) //Array Iteration Loop Forward BarsToCheck { double ATRB = iATR(NULL,0,7,i); double BarIndexHigh=ArrayMaximum(ATRB); // Print(StringConcatenate("BarIndex_",i," ATR: ",MaxValue())); } return MaxValue(); |
Fill the array, then find the maximum. | for(int i=0; i<400; i++) //Array Iteration Loop Forward BarsToCheck { IndicatorValues[i] = iATR(NULL,0,7,i); } int BarIndexHigh=ArrayMaximum(IndicatorValues); double valueHigh=IndicatorValues[BarIndexHigh]; // Print(StringConcatenate("BarIndex_",BarIndexHigh," ATR: ",valueHigh)); return valueHigh; |
No need for the array; simplify: | double valueMax=DBL_MIN; for(int i=0; i<400; i++){ //Array Iteration Loop Forward BarsToCheck double value = iATR(NULL,0,7,i); if(valueMax < value) valueMax=value; } return valueMax; |
William Roeder #:
| |
Fill the array, then find the maximum. | |
No need for the array; simplify: |
thanks William,
Got the; Fill the array, (then find the maximum) to work. just working on the simplified version. I appreciate your help.

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