Period separators (MT4) showing Monday - page 2

 

That will not compile

Post real code. Code that compiles. Code that you have attempted to debug. And then the nature of your problem.

 
WHRoeder:

That will not compile

Post real code. Code that compiles. Code that you have attempted to debug. And then the nature of your problem.


//+------------------------------------------------------------------+
//|                                                Vertical Line.mq4 |
//|                              Copyright © 2006, fxid10t@yahoo.com |
//|                               http://www.forexprogramtrading.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, fxid10t@yahoo.com"
#property link      "http://www.forexprogramtrading.com"
#property indicator_chart_window

extern int Place.Line.Bars.Back=1;
extern color Line.Color=Orange;
extern int Line.Style=1;
extern int Line.Width=1;
extern bool Draw.as.Background=true;
extern datetime When=D'2013.03.18 10:00:00';
extern int t=1;

int init(){return(0);}
int deinit(){ObjectDelete("V-Line"); return(0);}
int start(){
ObjectDelete("V-Line");
ObjectCreate("V-Line",OBJ_VLINE,0,When+(3600*t),0);
ObjectSet("V-Line",OBJPROP_COLOR,Line.Color);
ObjectSet("V-Line",OBJPROP_STYLE,Line.Style);
ObjectSet("V-Line",OBJPROP_WIDTH,Line.Width);
ObjectSet("V-Line",OBJPROP_BACK,Draw.as.Background);}
return(0);
//+------------------------------------------------------------------+
 
Ok here is one that compiles. This draws one line only, I can't loop it so it shows more than one line. The idea is to set the date to a monday 5 years back and add 1 week and it draws every week.
 
mrchilled: This draws one line only, I can't loop
  1. Why not? Have you gone through the lessons or the book? Do your homework.
  2. Code that you have attempted to debug. And then the nature of your problem.
    There are no slaves here. We are not going to code it for you. If you are too lazy to put any effort into your code, I'm certainly not going to bother replying to your postings.
 
WHRoeder:
  1. Why not? Have you gone through the lessons or the book? Do your homework.
  2. Code that you have attempted to debug. And then the nature of your problem.
    There are no slaves here. We are not going to code it for you. If you are too lazy to put any effort into your code, I'm certainly not going to bother replying to your postings.



//+------------------------------------------------------------------+
//|                                                Vertical Line.mq4 |
//|                              Copyright © 2006, fxid10t@yahoo.com |
//|                               http://www.forexprogramtrading.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, fxid10t@yahoo.com"
#property link      "http://www.forexprogramtrading.com"
#property indicator_chart_window

extern int Place.Line.Bars.Back=1;
extern color Line.Color=Orange;
extern int Line.Style=1;
extern int Line.Width=1;
extern bool Draw.as.Background=true;
//extern datetime When=D'2013.02.18 10:00:00';
extern int t=1;
extern int u=5;
extern int Hours = 2;

int init(){return(0);}
int deinit(){ObjectDelete("V-Line"); return(0);}
int start(){
int i;
datetime LineTime;

//ObjectDelete("V-Line");
for(i=0; i<13; i++) 
{
LineTime = iTime( NULL, PERIOD_H1, 0 ) + Hours*3600*i;
ObjectCreate("V-Line",OBJ_VLINE,0,LineTime,0);
ObjectSet("V-Line",OBJPROP_COLOR,Line.Color);
ObjectSet("V-Line",OBJPROP_STYLE,Line.Style);
ObjectSet("V-Line",OBJPROP_WIDTH,Line.Width);
ObjectSet("V-Line",OBJPROP_BACK,Draw.as.Background);}
}
return(0);
//+------------------------------------------------------------------+
 
Yes, I have gone through the book and documents and many forum thread here and elsewhere and I'm having a go but I have no programming skills so almost going in blindly. I can draw a vertical line on a monday but I can't figure out how to draw multiple vertical lines so any hint on the command or what I am doing wrong would be appreciated. Thanks
 
mrchilled:
Yes, I have gone through the book and documents and many forum thread here and elsewhere and I'm having a go but I have no programming skills so almost going in blindly. I can draw a vertical line on a monday but I can't figure out how to draw multiple vertical lines so any hint on the command or what I am doing wrong would be appreciated. Thanks

//+------------------------------------------------------------------+
void vLine(string name, datetime T0, color clr, int STYLE, int WIDTH){    
    static double Prev.vLineTime;
    if (T0 <= Prev.vLineTime)  return;
         ObjectDelete(name);
         ObjectCreate(name, OBJ_VLINE, 0, T0, 0);
         ObjectSet(name, OBJPROP_COLOR, clr);
         ObjectSet(name, OBJPROP_STYLE, STYLE);
         ObjectSet(name, OBJPROP_WIDTH, WIDTH);
         ObjectSet(name, OBJPROP_BACK, true);          
}
//+------------------------------------------------------------------+

function for drawing vertical lines    

call it inside your indicator and remember every object has its unique name.... 

Reason: