how to draw verticle line every day specific time
Like this:
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { MqlDateTime str_start,str_end; TimeToStruct(TimeCurrent(),str_start); TimeToStruct(TimeCurrent(),str_end); str_start.hour=4; str_start.min=15; str_end.hour=8; str_end.min=15; datetime time_start,time_end; time_start=StructToTime(str_start); time_end=StructToTime(str_end); ObjectDelete(V_Line_start); ObjectDelete(V_Line_ens); ObjectCreate(V_Line_start,OBJ_VLINE,0,time_start,Bid); ObjectSet(V_Line_start,OBJPROP_COLOR,LineColor); ObjectSet(V_Line_start,OBJPROP_STYLE,LineStyle); ObjectSet(V_Line_start,OBJPROP_WIDTH,LineWidth); ObjectSet(V_Line_start,OBJPROP_BACK,DrawasBackground); ObjectCreate(V_Line_ens,OBJ_VLINE,0,time_end,Bid); ObjectSet(V_Line_ens,OBJPROP_COLOR,LineColor); ObjectSet(V_Line_ens,OBJPROP_STYLE,LineStyle); ObjectSet(V_Line_ens,OBJPROP_WIDTH,LineWidth); ObjectSet(V_Line_ens,OBJPROP_BACK,DrawasBackground); }
You need to run a cycle to create and delete multiple objects.
And yes, that should be done by a script.
im try to draw 2 vertical line every trading day in the week Monday to Friday, but i can only create only for one day, i need to draw same line line past specific days ( ex :past 20 days) like ,
vertical line every day 7:45 and 15:15 server time (My broker is GMT 0)
draw another line closing price of 7:45 and closing price of 15:15 can some one help me it's lot to me,
this is my code
#property copyright "Copyright © hi"
#property link "http://www.aaa.com"
#property indicator_chart_window
extern int PlaceLineBarsBack=1;
extern color LineColor=Orange;
extern int LineStyle=1;
extern int LineWidth=1;
extern bool DrawasBackground=true;
string V_Line_start="V-Line start 4:15";
string V_Line_ens="V-Line end 8:15";
extern datetime date_time1=D'2015.01.26 7:45';
extern datetime date_time2=D'2015.01.26 15:15';
int init()
{
return(0);
}
int deinit()
{
ObjectDelete(V_Line_start);
ObjectDelete(V_Line_ens);
return(0);
}
int start()
{
ObjectDelete(V_Line_start);
ObjectCreate(V_Line_start,OBJ_VLINE,0,date_time1,Bid);
ObjectSet(V_Line_start,OBJPROP_COLOR,LineColor);
ObjectSet(V_Line_start,OBJPROP_STYLE,LineStyle);
ObjectSet(V_Line_start,OBJPROP_WIDTH,LineWidth);
ObjectSet(V_Line_start,OBJPROP_BACK,DrawasBackground);
ObjectCreate(V_Line_ens,OBJ_VLINE,0,date_time2,Bid);
ObjectSet(V_Line_ens,OBJPROP_COLOR,LineColor);
ObjectSet(V_Line_ens,OBJPROP_STYLE,LineStyle);
ObjectSet(V_Line_ens,OBJPROP_WIDTH,LineWidth);
ObjectSet(V_Line_ens,OBJPROP_BACK,DrawasBackground);
return(0);
}