hi..
i have a angle indicator which is using MA and inside other EA i want to call this angle indicator and want to read angle or slope value and i tried iCustom but every i tried all failed.
following is ma_angle source.
and this is icustom code what i tried.
double xx = iCustom(NULL, 0, "ma_angle",10,3,AliceBlue,21,0,0 ,0, 0);
Print("aaa "+xx);
anyone help much appreciate!
i have a angle indicator which is using MA and inside other EA i want to call this angle indicator and want to read angle or slope value and i tried iCustom but every i tried all failed.
following is ma_angle source.
Inserted Code
//+------------------------------------------------------------------+ //| ma_angle.mq4 | //| DimDimych | //| [email protected] | //| http://dimdimych.ucoz.ru | //+------------------------------------------------------------------+ #property copyright "DimDimych" #property link "http://dimdimych.ucoz.ru" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 CLR_NONE #property indicator_buffers 2 #property indicator_color2 CLR_NONE extern int ma_per = 10; extern int ma_met = 3; extern color col_ang = AliceBlue; extern int ExtDepth = 21; extern int ext = 0; extern int Complect = 0; double varMA[],value2[]; int init() { IndicatorBuffers(2); IndicatorDigits(Digits+1); SetIndexBuffer(0,varMA); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(1, value2); return(0); } int deinit() { ObjectDelete("AngleA "+Complect); ObjectDelete("AngleText "+Complect); Comment(""); return(0); } int start() { int i, limit, counted_bars=IndicatorCounted(); limit = Bars-counted_bars-1; double varMALast, varMACurrent,saveval; //Print(value); for(i=limit; i>=0; i--) { varMA[i] = iMA(NULL,0,ma_per,0,ma_met,PRICE_CLOSE,i); int nb_0 = GetExtremumZZBar(NULL, 0, ext); varMALast= varMA[i+nb_0]; varMACurrent=varMA[i+1]; if (ObjectFind("AngleA "+Complect)<0) { ObjectCreate("AngleA "+Complect,OBJ_TRENDBYANGLE,0,Time[i+nb_0],varMALast,Time[i+1],varMACurrent); ObjectSet("AngleA "+Complect,OBJPROP_STYLE,2); } if (ObjectFind("AngleText "+Complect)==-1) ObjectCreate("AngleText "+Complect,OBJ_TEXT,0,0,0); ObjectSet("AngleA "+Complect,OBJPROP_TIME2,Time[i+1]); ObjectSet("AngleA "+Complect,OBJPROP_PRICE2,varMACurrent); ObjectSet("AngleA "+Complect,OBJPROP_TIME1,Time[i+nb_0]); ObjectSet("AngleA "+Complect,OBJPROP_PRICE1,varMALast); ObjectSet("AngleA "+Complect,OBJPROP_COLOR,col_ang); double value=ObjectGet("AngleA "+Complect,OBJPROP_ANGLE); color warna; if(value>90) value = value-360; value2[i+1] = value; //Print(value2[i+1]); ObjectSetText("AngleText "+Complect,DoubleToStr(value,2),8,"Verdana",col_ang); ObjectMove("AngleText "+Complect,0,Time[0]+5*Period()*60,ObjectGetValueByShift("AngleA "+Complect,i)); } return(value2[i+1]); } int GetExtremumZZBar(string sy="", int tf=0, int ne=0) { if (sy=="" || sy=="0") sy=Symbol(); double zz; int i, k=iBars(sy, tf), ke=0; for (i=1; i<k; i++) { zz=iCustom(sy, tf, "ZigZag", ExtDepth,5,3, 0,i); if (zz!=0) { ke++; if (ke>ne) return(i); } } Print("GetExtremumZZBar():"); return(-1); }
double xx = iCustom(NULL, 0, "ma_angle",10,3,AliceBlue,21,0,0 ,0, 0);
Print("aaa "+xx);
anyone help much appreciate!