//+------------------------------------------------------------------+ //| Value Of BBands.mq4 | //| Copyright © 2010, Totom Sukopratomo | //| MetaTrader_Experts_and_Indicators@yahoogroups.com | //+------------------------------------------------------------------+ //| Anyone may use this indicator without any compensation but | //| please do not remove this header. | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, Totom Sukopratomo" #property link "MetaTrader_Experts_and_Indicators@yahoogroups.com" #property indicator_chart_window //---- input parameters extern int TimeFrame=60, //0: current chart timeframe, 1: 1 minute, 5: 5 minute and so on BBandsPeriod=20, BBandsDeviation=2, BBandsShift=0, BBandsPrice=0, //0:PRICE_OPEN, 1: PRICE_HIGH , 2: PRICE_LOW , PRICE_MEDIAN Shift=0, Corner=1, //0: upper left, 1: upper right, 2: lower left, 3:lower right FontSize=10; extern color FontColor=CornflowerBlue; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators membuat_tampilan("Label","Value Of BBands @ M"+TimeFrame,Corner,FontSize,FontColor,10,10); membuat_tampilan("Upper","",Corner,FontSize,FontColor,10,30); membuat_tampilan("Middle","",Corner,FontSize,FontColor,10,50); membuat_tampilan("Lower","",Corner,FontSize,FontColor,10,70); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectDelete("Label"); ObjectDelete("Upper"); ObjectDelete("Middle"); ObjectDelete("Lower"); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double upper=iBands(Symbol(),TimeFrame,BBandsPeriod,BBandsDeviation,BBandsShift,BBandsPrice,MODE_UPPER,Shift); double lower=iBands(Symbol(),TimeFrame,BBandsPeriod,BBandsDeviation,BBandsShift,BBandsPrice,MODE_LOWER,Shift); double middle=(upper+lower)/2; ObjectSetText("Upper","Upper : "+DoubleToStr(upper,Digits),FontSize,"Calibri",FontColor); ObjectSetText("Middle","Middle : "+DoubleToStr(middle,Digits),FontSize,"Calibri",FontColor); ObjectSetText("Lower","Lower : "+DoubleToStr(lower,Digits),FontSize,"Calibri",FontColor); return(0); } //+------------------------------------------------------------------+ void membuat_tampilan(string name,string text,int Corner,int FontSize,color FontColor,int x,int y) { ObjectCreate(name,OBJ_LABEL,0,0,0); ObjectSetText(name,text,FontSize,"Calibri",FontColor); ObjectSet(name,OBJPROP_CORNER,Corner); ObjectSet(name,OBJPROP_XDISTANCE,x); ObjectSet(name,OBJPROP_YDISTANCE,y); }