Moving Average function also suits for averages
int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars<0) return(-1); if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- calcolo entry_long for(int i=0; i<limit; i++) Histogram[i] = iMA(_Symbol,_Period,Periodo,0,MODE_SMA,PRICE_HIGH,i)- iMA(_Symbol,_Period,Periodo,0,MODE_SMA,PRICE_LOW,i); return(0); } //---- done
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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 all, I wrote this code to calculate the average range between high and low.
Could you tell me if it's ok or have you got a suggestion on how to improve it?
Thank you
Where Periodo is an external int.