Here's the code:
Now, when I call the ObjectGetValueByShift(name,i) function, I get the first price coordinate. Why? Can anyone help me out on this one?
Also, for some reason, this won't redraw when a new tick comes in (or a new candle is formed).
Inserted Code
#property copyright "Copyright © 2010, Nondisclosure007" #property link "[url]http://no.link.yet[/url]" #property indicator_chart_window #property indicator_buffers 2 double floor[]; double ceiling[]; int init() { IndicatorBuffers(2); IndicatorDigits(Digits); SetIndexBuffer(0,floor); SetIndexLabel(0,"Lower Angle"); SetIndexBuffer(1,ceiling); SetIndexLabel(1,"Upper Angle"); SetIndexEmptyValue(0,0.0); SetIndexEmptyValue(1,0.0); ArraySetAsSeries(floor,true); ArraySetAsSeries(ceiling,true); return(0); } int deinit() { ObjectDelete("LowerAngle");ObjectDelete("UpperAngle"); return(0); } int start() { int i, k, limit, counted_bars=IndicatorCounted(); limit = Bars-counted_bars-1; double varLowMACurrent, varLowMALast, varHighMALast, varHighMACurrent; datetime varTime; for(i=0; i<limit; i++) { varLowMACurrent=iMA(NULL,0,34,0,MODE_EMA,PRICE_LOW,i+1); varLowMALast=iMA(NULL,0,34,0,MODE_EMA,PRICE_LOW,i+2); varHighMACurrent=iMA(NULL,0,34,0,MODE_EMA,PRICE_HIGH,i+1); varHighMALast=iMA(NULL,0,34,0,MODE_EMA,PRICE_HIGH,i+2); if (ObjectFind("LowerAngle")==-1) {ObjectCreate("LowerAngle",OBJ_TRENDBYANGLE,0,Time[i+2],varLowMALast); ObjectSet("LowerAngle",OBJPROP_ANGLE,330);} ObjectSet("LowerAngle",OBJPROP_ANGLE,330); ObjectSet("LowerAngle",OBJPROP_STYLE,STYLE_DOT); ObjectSet("LowerAngle",OBJPROP_COLOR,Magenta); ObjectSet("LowerAngle",OBJPROP_RAY,true); floor[i]=ObjectGetValueByShift("LowerAngle",i); if (ObjectFind("UpperAngle")==-1) {ObjectCreate("UpperAngle",OBJ_TRENDBYANGLE,0,Time[i+2],varHighMALast); ObjectSet("UpperAngle",OBJPROP_ANGLE,30);} ObjectSet("UpperAngle",OBJPROP_ANGLE,30); ObjectSet("UpperAngle",OBJPROP_STYLE,STYLE_DOT); ObjectSet("UpperAngle",OBJPROP_COLOR,Magenta); ObjectSet("UpperAngle",OBJPROP_RAY,true); ceiling[i]=ObjectGetValueByShift("UpperAngle",i); WindowRedraw(); } return(0); } //+------------------------------------------------------------------+
Now, when I call the ObjectGetValueByShift(name,i) function, I get the first price coordinate. Why? Can anyone help me out on this one?
Also, for some reason, this won't redraw when a new tick comes in (or a new candle is formed).