//+------------------------------------------------------------------+ //| ATR_Multi.mq4 | //| Copyright 2012 FX_Kuraisora | //| http://goldsearch.blog24.fc2.com/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2012 FX_Kuraisora" #property link "http://goldsearch.blog24.fc2.com/" #property indicator_separate_window #property indicator_buffers 8 extern int ATRPriod = 100; extern int MaxBars = 1000; extern string sBuf2 = "EURJPY";//Market Symbol,if "" no use extern string sBuf3 = "USDJPY"; extern string sBuf4 = "GBPJPY"; extern string sBuf5 = "NZDJPY"; extern string sBuf6 = "AUDJPY"; extern string sBuf7 = "CADJPY"; extern string sBuf8 = "ZARJPY"; extern color Color1 = DodgerBlue; extern color Color2 = Red; extern color Color3 = Orange; extern color Color4 = Lime; extern color Color5 = DeepPink; extern color Color6 = Turquoise; extern color Color7 = BlueViolet; extern color Color8 = Gold; double Buf1[]; double Buf2[]; double Buf3[]; double Buf4[]; double Buf5[]; double Buf6[]; double Buf7[]; double Buf8[]; string sIndSelf = "ATR_Multi ("; string Suff; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexBuffer(0,Buf1); SetIndexBuffer(1,Buf2); SetIndexBuffer(2,Buf3); SetIndexBuffer(3,Buf4); SetIndexBuffer(4,Buf5); SetIndexBuffer(5,Buf6); SetIndexBuffer(6,Buf7); SetIndexBuffer(7,Buf8); SetIndexStyle(0,DRAW_LINE,EMPTY,1,Color1); SetIndexStyle(1,DRAW_LINE,EMPTY,1,Color2); SetIndexStyle(2,DRAW_LINE,EMPTY,1,Color3); SetIndexStyle(3,DRAW_LINE,EMPTY,1,Color4); SetIndexStyle(4,DRAW_LINE,EMPTY,1,Color5); SetIndexStyle(5,DRAW_LINE,EMPTY,1,Color6); SetIndexStyle(6,DRAW_LINE,EMPTY,1,Color7); SetIndexStyle(7,DRAW_LINE,EMPTY,1,Color8); if(sBuf2=="") SetIndexStyle(1,DRAW_NONE); if(sBuf3=="") SetIndexStyle(2,DRAW_NONE); if(sBuf4=="") SetIndexStyle(3,DRAW_NONE); if(sBuf5=="") SetIndexStyle(4,DRAW_NONE); if(sBuf6=="") SetIndexStyle(5,DRAW_NONE); if(sBuf7=="") SetIndexStyle(6,DRAW_NONE); if(sBuf8=="") SetIndexStyle(7,DRAW_NONE); IndicatorShortName(sIndSelf+ATRPriod+") "); IndicatorDigits(2); Suff=StringSubstr(Symbol(),0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int limit = Bars-IndicatorCounted(); if (MaxBars > 0) { limit = MathMax(limit, MaxBars + ATRPriod); } //---- for(int i=limit-1;i>=0;i--) { Buf1[i]=iATR(NULL,0,ATRPriod,i); Buf2[i]=iATR(sBuf2,0,ATRPriod,i); Buf3[i]=iATR(sBuf3,0,ATRPriod,i); Buf4[i]=iATR(sBuf4,0,ATRPriod,i); Buf5[i]=iATR(sBuf5,0,ATRPriod,i); Buf6[i]=iATR(sBuf6,0,ATRPriod,i); Buf7[i]=iATR(sBuf7,0,ATRPriod,i); Buf8[i]=iATR(sBuf8,0,ATRPriod,i); } //Text Object ObjectCreate(sIndSelf+"1", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"1", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"1", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"1", OBJPROP_YDISTANCE,10); ObjectSetText(sIndSelf+"1", Suff,12,"Orator Std",Color1); if(sBuf2!=""){ ObjectCreate(sIndSelf+"2", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"2", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"2", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"2", OBJPROP_YDISTANCE,30); ObjectSetText(sIndSelf+"2", sBuf2,12,"Orator Std",Color2); }else{ ObjectDelete(sIndSelf + "2"); } if(sBuf3!=""){ ObjectCreate(sIndSelf+"3", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"3", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"3", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"3", OBJPROP_YDISTANCE,50); ObjectSetText(sIndSelf+"3", sBuf3,12,"Orator Std",Color3); }else{ ObjectDelete(sIndSelf + "3"); } if(sBuf4!=""){ ObjectCreate(sIndSelf+"4", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"4", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"4", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"4", OBJPROP_YDISTANCE,70); ObjectSetText(sIndSelf+"4", sBuf4,12,"Orator Std",Color4); }else{ ObjectDelete(sIndSelf + "4"); } if(sBuf5!=""){ ObjectCreate(sIndSelf+"5", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"5", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"5", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"5", OBJPROP_YDISTANCE,90); ObjectSetText(sIndSelf+"5", sBuf5,12,"Orator Std",Color5); }else{ ObjectDelete(sIndSelf + "5"); } if(sBuf6!=""){ ObjectCreate(sIndSelf+"6", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"6", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"6", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"6", OBJPROP_YDISTANCE,110); ObjectSetText(sIndSelf+"6", sBuf6,12,"Orator Std",Color6); }else{ ObjectDelete(sIndSelf + "6"); } if(sBuf7!=""){ ObjectCreate(sIndSelf+"7", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"7", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"7", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"7", OBJPROP_YDISTANCE,130); ObjectSetText(sIndSelf+"7", sBuf7,12,"Orator Std",Color7); }else{ ObjectDelete(sIndSelf + "7"); } if(sBuf8!=""){ ObjectCreate(sIndSelf+"8", OBJ_LABEL, 1,0,0); ObjectSet(sIndSelf+"8", OBJPROP_CORNER,1); ObjectSet(sIndSelf+"8", OBJPROP_XDISTANCE,3); ObjectSet(sIndSelf+"8", OBJPROP_YDISTANCE,150); ObjectSetText(sIndSelf+"8", sBuf8,12,"Orator Std",Color8); }else{ ObjectDelete(sIndSelf + "8"); } //---- return(0); } //+------------------------------------------------------------------+