//+------------------------------------------------------------------+ //| #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_chart_window #property indicator_buffers 4 #property indicator_color1 Blue #property indicator_color2 Blue #property indicator_color3 Blue #property indicator_color4 Blue //---- input parameters //---- buffers double Buffer_M5[]; double Buffer_M15[]; double Buffer_M30[]; double Buffer_H1[]; datetime dt5[200], dt15[200], dt30[200], dth1[200]; extern string CustomIndicator = "TMA"; extern int CustomIndIndex = 0; extern int PRD_1 = 5; extern int PRD_2 = 15; extern int PRD_3 = 30; extern int PRD_4 = 60; //----------------------- extern int Periods=30; extern int ApplyTo=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Buffer_M5); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,Buffer_M15); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,Buffer_M30); SetIndexStyle(3,DRAW_LINE); SetIndexBuffer(3,Buffer_H1); IndicatorShortName("MTF_4_TMA 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(),PRD_1); ArrayCopySeries(dt15,MODE_TIME,Symbol(),PRD_2); ArrayCopySeries(dt30,MODE_TIME,Symbol(),PRD_3); ArrayCopySeries(dth1,MODE_TIME,Symbol(),PRD_4); } 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; i