I am printing a dot on the chart to illustrate the offset issue...
You can see where the arrow is highlighting... the first number in the object name is correct, but then the actual price it uses is different!!!! Grrrr!!!
Any thoughts?
In troubleshooting I tried:
This is not just a printing to chart issue as the values ARE actually different (see circled values in image)
Tried about 4 different bands indicators which all produce the same lines, obviously)
Tried iCustom with Bands indi which also produced different values to chart indi's
These value differences range in value. ie not just 100 different for each bar
Values are not returning for the wrong bar... it is value to bar accurate
Here is the code I am using for iBands:
Code: Select all
iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,i);Code: Select all
void DrawDot(int barr, double price) {
string objName = objPrefix + barr + " " + price;
ObjectCreate(objName, OBJ_TEXT, 0, Time[barr], price);
ObjectSetText(objName, CharToStr(159), 24, "Wingdings", Red);
}the entire indi:
Code: Select all
#property indicator_chart_window
string objPrefix = "printBB_";
int init()
{
for (int i=1;i<100;i++){
DrawDot(i,iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,i));
}
return(0);
}
int deinit(){
deleteObjects();
return(0);
}
int start() {
if (IsNewBar()) DrawDot(1,iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,1));;
}
void DrawDot(int barr, double price) {
string objName = objPrefix + barr + " " + price;
ObjectCreate(objName, OBJ_TEXT, 0, Time[barr], price);
ObjectSetText(objName, CharToStr(159), 24, "Wingdings", Red);
}
bool IsNewBar() {
static datetime lastbar;
datetime curbar = Time[0];
if(lastbar!=curbar){
lastbar=curbar;
return (true);
}
else{
return(false);
}
}
void deleteObjects(){
for(int i=ObjectsTotal();i >= 0;i--){
if(StringSubstr(ObjectName(i),0,StringLen(objPrefix))==objPrefix)
ObjectDelete(ObjectName(i));
}
}