//+------------------------------------------------------------------+ //| _MAX_Stops_Multi_v1.0.mq4 | //| Copyright © 2009 | //| Written by Massimo Gentili | //| whitehawk71@hotmail.com | //| Freely inspired from ATR Stops by Agorad | //+------------------------------------------------------------------+ #property copyright "Copyright Massimo Gentili © 2009 " #property indicator_color1 Red #property indicator_color2 Blue #property indicator_chart_window #property indicator_buffers 2 #property indicator_width1 0 #property indicator_width2 0 double Buffer_Up[],Buffer_Dn[];//buffers double alertBar; extern double OverBoost = 0.065; extern double Kv=0.05; extern double Kz=0.0; extern int Precision = 7; extern string Valid_TF = "_______ CUR, M1, M5, M30, H1, H4, D1, W1, MN1 _______"; extern string TimeFrame="CUR"; // CUR, M1, M5, M30, H1, H4, D1, W1, MN1 extern bool AlertEnabled=false; int TF=0; int LastAlertBarTime; //int LastAlertType = 0; // 0 - is never alerted, 1 - buy breakout, 2 - sell breakout //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators // Uncomment if you want to show lines // comment if you want to show dots // SetIndexStyle(0,DRAW_LINE); // SetIndexStyle(1,DRAW_LINE); // comment if you want to show lines // Uncomment if you want to show dots SetIndexStyle(0,DRAW_ARROW,STYLE_DOT); SetIndexStyle(1,DRAW_ARROW,STYLE_DOT); SetIndexArrow(0,159); SetIndexArrow(1,159); SetIndexBuffer(0,Buffer_Up); SetIndexBuffer(1,Buffer_Dn); IndicatorShortName("MAX_Stops_Multi"); SetIndexLabel(0,"MAX_Stops_(" + TimeFrame + ") Up Dir"); SetIndexLabel(1,"MAX_Stops_(" + TimeFrame + ") Down Dir"); SetIndexDrawBegin(0,2); SetIndexDrawBegin(1,2); //---- if ( TimeFrame == "CUR" ) TF = 0; else if ( TimeFrame == "M1" ) TF = 1; else if ( TimeFrame == "M5" ) TF = 5; else if ( TimeFrame == "M15" ) TF = 15; else if ( TimeFrame == "M30" ) TF = 30; else if ( TimeFrame == "H1" ) TF = 60; else if ( TimeFrame == "H4" ) TF = 240; else if ( TimeFrame == "D1" ) TF = 1440; else if ( TimeFrame == "W1" ) TF = 10080; else if ( TimeFrame == "MN1" ) TF = 43200; return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { datetime TimeArray[]; int i,y=0; // Plot defined time frame on to current time frame ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TF); int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit--; for(i=0,y=0;i