//+------------------------------------------------------------------+ //| #MTF_4_CoeffoLine.mq4 | //| Copyright © 2005, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_separate_window #property indicator_minimum -1 #property indicator_maximum 6 #property indicator_buffers 8 #property indicator_color1 MediumSeaGreen #property indicator_color2 MediumSeaGreen #property indicator_color3 MediumSeaGreen #property indicator_color4 MediumSeaGreen #property indicator_color5 IndianRed #property indicator_color6 IndianRed #property indicator_color7 IndianRed #property indicator_color8 IndianRed //---- input parameters //---- buffers double UpBuffer_M5[]; double UpBuffer_M15[]; double UpBuffer_M30[]; double UpBuffer_H1[]; double DownBuffer_M5[]; double DownBuffer_M15[]; double DownBuffer_M30[]; double DownBuffer_H1[]; datetime dt5[200], dt15[200], dt30[200], dth1[200]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,254); SetIndexBuffer(0,UpBuffer_M5); SetIndexEmptyValue(0,-40.0); SetIndexStyle(1,DRAW_ARROW); SetIndexArrow(1,254); SetIndexBuffer(1,UpBuffer_M15); SetIndexEmptyValue(1,-40.0); SetIndexStyle(2,DRAW_ARROW); SetIndexArrow(2,254); SetIndexBuffer(2,UpBuffer_M30); SetIndexEmptyValue(2,-40.0); SetIndexStyle(3,DRAW_ARROW); SetIndexArrow(3,254); SetIndexBuffer(3,UpBuffer_H1); SetIndexEmptyValue(3,-40.0); SetIndexStyle(4,DRAW_ARROW); SetIndexArrow(4,253); SetIndexBuffer(4,DownBuffer_M5); SetIndexEmptyValue(4,-40.0); SetIndexStyle(5,DRAW_ARROW); SetIndexArrow(5,253); SetIndexBuffer(5,DownBuffer_M15); SetIndexEmptyValue(5,-40.0); SetIndexStyle(6,DRAW_ARROW); SetIndexArrow(6,253); SetIndexBuffer(6,DownBuffer_M30); SetIndexEmptyValue(6,-40.0); SetIndexStyle(7,DRAW_ARROW); SetIndexArrow(7,253); SetIndexBuffer(7,DownBuffer_H1); SetIndexEmptyValue(7,-40.0); IndicatorShortName("MTF_4_CoeffofLine M5,M15,M30,M60"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int limit, shift; if(counted_bars<0) return(-1); if (counted_bars==0) limit=Bars-1; // limit = Bars-MinBars-1; //---- last counted bar will be recounted if(counted_bars>0) limit=Bars-counted_bars; limit--; int i5 = 0, i15 = 0, i30 = 0, ih1 = 0; static bool fft = true; //if (NewBar()) // Update array every 15 minutes { ArrayCopySeries(dt5,MODE_TIME,Symbol(),PERIOD_M5); ArrayCopySeries(dt15,MODE_TIME,Symbol(),PERIOD_M15); ArrayCopySeries(dt30,MODE_TIME,Symbol(),PERIOD_M30); ArrayCopySeries(dth1,MODE_TIME,Symbol(),PERIOD_H1); } if ((fft) && (Symbol() == "EURUSD")) { fft = false; datetime d = iTime(NULL, PERIOD_D1, 0); for (int j=0; j<80; j++) { Print(j,") ",dt5[j]-d," ",dt15[j]-d, " ", dt30[j]-d," ", dth1[j]-d); } } for(int i=0; iCOG5S) UpBuffer_M5[i] = 1; if (COG5 COG15S) UpBuffer_M15[i] = 2; if (COG15 COG30S) UpBuffer_M30[i] = 3; if (COG30 COGH1S) UpBuffer_H1[i] = 4; if (COGH1