Hi,
I took some code from someone's indicator for drawing vertical lines. I've used the code in an EA and want to run the EA purely to draw the lines over a six month period so that I can look at the chart afterwards for manual backtesting purposes.
The problem is that when a new line is drawn (at a market open) the previous line is deleted, which is no good for backtesting. I tried commenting out the first line:
ObjectDelete("MMl"+DoubleToStr(i,0));
But that wasn't successful. I'd appreciate any help please. I'll paste the function below, as well as where I call it from the start() function. Thanks.
int VerticalLine(string s,int i,int st,int Col)
{
ObjectDelete("MMl"+DoubleToStr(i,0));
val1=Low[Lowest(NULL,0,MODE_LOW,BarsPerWindow(),0)];
val2=High[Highest(NULL,0,MODE_HIGH,BarsPerWindow(),0)];
ObjectCreate("MMl"+DoubleToStr(i,0),OBJ_TREND,0,Time[i],0,Time[i],900);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_COLOR,Col);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_WIDTH,2);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_STYLE,st);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_RAY,0);
ObjectDelete("MMt"+DoubleToStr(i,0));
ObjectCreate("MMt"+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],val2+Point*3);
ObjectSetText("MMt"+DoubleToStr(i,0),s,10,"Arial",Col);
ObjectSet("MMt"+DoubleToStr(i,0), OBJPROP_ANGLE, 90); //Rotates text 90 degrees
ObjectsRedraw();
return(0);
}
//======================================
int start()
{
h=TimeHour(Time[0]);
m=TimeMinute(Time[0]);
if ((h==7) && (m==0)) {VerticalLine("LO",0,STYLE_SOLID,Aqua);}
if ((h==13) && (m==30)) {VerticalLine("NYO",0,STYLE_SOLID,Orange);}
return(0);
}
//=================
Thanks people
I took some code from someone's indicator for drawing vertical lines. I've used the code in an EA and want to run the EA purely to draw the lines over a six month period so that I can look at the chart afterwards for manual backtesting purposes.
The problem is that when a new line is drawn (at a market open) the previous line is deleted, which is no good for backtesting. I tried commenting out the first line:
ObjectDelete("MMl"+DoubleToStr(i,0));
But that wasn't successful. I'd appreciate any help please. I'll paste the function below, as well as where I call it from the start() function. Thanks.
int VerticalLine(string s,int i,int st,int Col)
{
ObjectDelete("MMl"+DoubleToStr(i,0));
val1=Low[Lowest(NULL,0,MODE_LOW,BarsPerWindow(),0)];
val2=High[Highest(NULL,0,MODE_HIGH,BarsPerWindow(),0)];
ObjectCreate("MMl"+DoubleToStr(i,0),OBJ_TREND,0,Time[i],0,Time[i],900);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_COLOR,Col);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_WIDTH,2);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_STYLE,st);
ObjectSet("MMl"+DoubleToStr(i,0),OBJPROP_RAY,0);
ObjectDelete("MMt"+DoubleToStr(i,0));
ObjectCreate("MMt"+DoubleToStr(i,0),OBJ_TEXT,0,Time[i],val2+Point*3);
ObjectSetText("MMt"+DoubleToStr(i,0),s,10,"Arial",Col);
ObjectSet("MMt"+DoubleToStr(i,0), OBJPROP_ANGLE, 90); //Rotates text 90 degrees
ObjectsRedraw();
return(0);
}
//======================================
int start()
{
h=TimeHour(Time[0]);
m=TimeMinute(Time[0]);
if ((h==7) && (m==0)) {VerticalLine("LO",0,STYLE_SOLID,Aqua);}
if ((h==13) && (m==30)) {VerticalLine("NYO",0,STYLE_SOLID,Orange);}
return(0);
}
//=================
Thanks people