double ArrayBuffer[]; int counted_bars = 20; int doloop() { ArrayFree( ArrayBuffer ); int value = ArrayResize( ArrayBuffer, counted_bars ); if( value == counted_bars ) for(int i=0; i<counted_bars; i++) ArrayBuffer[i]=iMA(NULL,PERIOD_M30,10,0,MODE_SMMA,PRICE_CLOSE,i); return value; } void OnTick(void) { if( doloop() != counted_bars ) return; double MaxValue = ArrayBuffer[ ArrayMaximum(ArrayBuffer) ], MinValue = ArrayBuffer[ ArrayMinimum(ArrayBuffer) ]; if(MaxValue>MinValue) { // Fails: not true } }
Konstantin Nikitin:
Thank you. Most appreciated.

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
I am trying to retrieve the value of the highest point and lowest point of a moving average over the last 20 bars.
Simple, if this was an excel spreadsheet.
This is as close as I have been able to get. No Errors, but when MaxValue>MinValue is used as a BUY or SELL condition, it prevents all orders.
Any help would be much appreciated.