//+------------------------------------------------------------------+ //| RDI_ForexForecast.mq4 | //| RDI | //| | //+------------------------------------------------------------------+ #property copyright "RDI" #property indicator_chart_window #define MaxBasePeriod 500 #define MaxForecastPeriod 100 #define MaxSamples 500 #define MaxBaseElements 10000 #define HighPriceColor Red #define LowPriceColor Green #define HighPriceStyle 217 #define LowPriceStyle 217 extern int BasePeriod=280; //Number of basement bars to forecast extern int ForecastPeriod=30; //Bars to forecast extern int Samples=2000; //Period to check similarity to current movement extern int BaseElements=20; //Number of elements to choose for forecasting double highests[MaxBaseElements][MaxBasePeriod],lowests[MaxBaseElements][MaxBasePeriod],high_forecast[MaxBaseElements][MaxForecastPeriod],low_forecast[MaxBaseElements][MaxForecastPeriod]; double temporal_high[MaxBasePeriod],temporal_low[MaxBasePeriod],temporal_high_forecast[MaxForecastPeriod],temporal_low_forecast[MaxForecastPeriod]; double correlation[MaxBaseElements],temporal_correlation; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { int i; for(i=0; i 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit-=1+BasePeriod+2; if(limit=0) { last_swap=top_index; for(i=top_index; itop_index; i--) { if(correlation[i]0) { if(correlation[j]