//+------------------------------------------------------------------+ //| All_TF_v04.mq4 | //+------------------------------------------------------------------+ #property copyright "Inkov Evgeni ew123@mail.ru" #property link "+7-918-600-11-33" //+------------------------------------------------------------------+ // добавлены объёмы // введена МА //+------------------------------------------------------------------+ #define Gran_UP 1.3 #define Gran_DW -0.4 //+------------------------------------------------------------------+ #property indicator_separate_window #property indicator_minimum Gran_DW #property indicator_maximum Gran_UP extern string sym = "EURUSD"; extern int nom_bar = 25; extern int order_TF = 234567; extern color color_up = Red; extern color color_dw = Black; extern color color_0 = RoyalBlue; extern color color_txt = Green; extern color color_activ = Red; extern color color_line = Gray; extern color color_volum_up = Green; extern color color_volum_dw = Red; extern string s1____________ = "-------------------------"; extern bool ind_MA = true; extern color color_MA = Blue; extern int width_MA = 1; extern int period = 40; extern int ma_shift = 0; extern int ma_method = 0; extern int applied_price = 0; //-------------------- int win; int TF; int width=3; int Step; int mas_TF[9]; //+------------------------------------------------------------------+ int init() { del_all(); string str=DoubleToStr(order_TF,0); int len=StringLen(str); ArrayInitialize(mas_TF,0); string s; int k=8; for (int i=len-1;i>=0;i--) { s=StringSubstr(str,i, 1); if (k<0)break; mas_TF[k]=StrToInteger(s); k--; } IndicatorDigits(Digits); IndicatorShortName("All_TF "+sym); win=WindowFind("All_TF "+sym); Step=nom_bar+3; return(0); } //+------------------------------------------------------------------+ int deinit() { del_all(); return(0); } //+------------------------------------------------------------------+ int start() { int sdvig; int n; for (int i=9;i>=1;i--) { n=mas_TF[i-1]; if (n==0)break; TF=nom_TF(n); if (i<9)out_line(str_TF(TF),win,sdvig); sdvig=(9-i)*Step; out_graf(TF,win,sdvig); out_volum(TF,win,sdvig); out_txt(TF,win,sdvig); } return(0); } //+------------------------------------------------------------------+ void del_all() { for (int i=9;i>=1;i--) { TF=nom_TF(i); for (int j=0;jmax || max==0)max=H; if (Lmax || max==0)max=V; if (Vpr2) col=color_dw; else col=color_up; put_rect(sym+DoubleToStr(TF,0)+"_"+DoubleToStr(bar,0)+"_1",win, bar+sdv, width, pr1, pr2, col); // Open, Close put_rect(sym+DoubleToStr(TF,0)+"_"+DoubleToStr(bar,0)+"_2",win, bar+sdv, 1, pr3, pr4, col); // Low, High } //----------------------------------------- void out_MA(int TF, int win,int bar,double max, double min, int sdv) { double ma0,ma1; double d,pr0,pr1; color col; ma0=iMA (sym,TF,period,ma_shift,ma_method,applied_price,bar); ma1=iMA (sym,TF,period,ma_shift,ma_method,applied_price,bar+1); d=max-min; pr0=(ma0-min)/d; pr1=(ma1-min)/d; put_TL(sym+DoubleToStr(TF,0)+"_"+DoubleToStr(bar,0)+"_M",win, bar+sdv, width_MA, pr0, pr1, color_MA); } //----------------------------------------- void out_vol(int TF, int win,int bar,double max, double min, int sdv) { double V,V1; double d, pr1; color col; V =iVolume (sym,TF,bar); V1=iVolume (sym,TF,bar+1); d=max-min; pr1=(V-min)/d*(MathAbs(Gran_DW)-0.1)+Gran_DW; if (V>=V1) col=color_volum_up; else col=color_volum_dw; put_rect(sym+DoubleToStr(TF,0)+"_"+DoubleToStr(bar,0)+"_V",win, bar+sdv, width, Gran_DW, pr1, col); } //----------------------------------------- void put_rect(string name,int win, int bar, int width, double pr1, double pr2, color col) { if (ObjectFind(name)<0)ObjectCreate(name,OBJ_TREND,win,0,0,0,0); ObjectSet(name,OBJPROP_TIME1,Time[bar]); ObjectSet(name,OBJPROP_TIME2,Time[bar]); ObjectSet(name,OBJPROP_PRICE1,pr1); ObjectSet(name,OBJPROP_PRICE2,pr2); ObjectSet(name,OBJPROP_WIDTH,width); ObjectSet(name,OBJPROP_RAY,false); ObjectSet(name,OBJPROP_COLOR,col); } //------------------------------ void put_TL(string name,int win, int bar, int width, double pr1, double pr2, color col) { if (ObjectFind(name)<0)ObjectCreate(name,OBJ_TREND,win,0,0,0,0); ObjectSet(name,OBJPROP_TIME1,Time[bar]); ObjectSet(name,OBJPROP_TIME2,Time[bar+1]); ObjectSet(name,OBJPROP_PRICE1,pr1); ObjectSet(name,OBJPROP_PRICE2,pr2); ObjectSet(name,OBJPROP_WIDTH,width); ObjectSet(name,OBJPROP_RAY,false); ObjectSet(name,OBJPROP_COLOR,col); } //------------------------------ double ND(double n) { return(NormalizeDouble(n,Digits)); } //---------------------------- int nom_TF(int n) { switch(n) { case 1: return(PERIOD_M1); case 2: return(PERIOD_M5); case 3: return(PERIOD_M15); case 4: return(PERIOD_M30); case 5: return(PERIOD_H1); case 6: return(PERIOD_H4); case 7: return(PERIOD_D1); case 8: return(PERIOD_W1); case 9: return(PERIOD_MN1); } return(0); } //---------------------------- string str_TF(int n) { if (n==0)n=Period(); switch(n) { case PERIOD_M1: return ("M1"); case PERIOD_M5: return ("M5"); case PERIOD_M15: return ("M15"); case PERIOD_M30: return ("M30"); case PERIOD_H1: return ("H1"); case PERIOD_H4: return ("H4"); case PERIOD_D1: return ("D1"); case PERIOD_W1: return ("W1"); case PERIOD_MN1: return ("MN1"); } return("TF?"); } //----------------------------