Download MetaTrader 5
To add comments, please log in or register
Read the interviews of the Automated Trading Championship participants
mostafalotfi
185
mostafalotfi 2014.01.15 10:21 

Hi guys

Could you please advise me about the below case?

i want to draw some VLINE to seperate the whole week in H4 in 3 par

tMQL4

could you please advise how can i do that? i can draw fix VLINE with ObjectCreate(), but i dono how can i set it to draw for current week

Ubzen
Moderator
5394
Ubzen 2014.01.15 11:22  
mostafa:

Hi guys

Could you please advise me about the below case?

i want to draw some VLINE to seperate the whole week in H4 in 3 par

t

could you please advise how can i do that? i can draw fix VLINE with ObjectCreate(), but i dono how can i set it to draw for current week

Where's your codes ... What have you tried?
mostafalotfi
185
mostafalotfi 2014.01.15 11:34  
ubzen:
Where's your codes ... What have you tried?


hi

at the moment i put the date manually

ObjectCreate  ("خط عمودي", OBJ_VLINE, 0,D'2014.01.15 00:00',0) ;
Ubzen
Moderator
5394
Ubzen 2014.01.15 11:37  
mostafa: at the moment i put the date manually
The bars are being drawn every Ten_H4 bars ... is that what you're having problems with?
mostafalotfi
185
mostafalotfi 2014.01.15 11:52  
ubzen:
The bars are being drawn every Ten_H4 bars ... is that what you're having problems with?

yes i want to draw VLINE every Ten bar, i can make it only appear in H4 then that would be great.

is it possible to draw it only after Bar[1] ??

Ubzen
Moderator
5394
Ubzen 2014.01.15 12:18  
mostafa:

yes i want to draw VLINE every Ten bar, i can make it only appear in H4 then that would be great.

is it possible to draw it only after Bar[1] ??

Yeah, draw it on Bar[2] and then every Ten bars back. Like bar 12 && 22. Remember the 1st bar on the chart is bar[0] and not bar 1.
whroeder1
13602
whroeder1 2014.01.15 14:42  
  1. mostafa: i want to draw some VLINE to seperate the whole week in H4 in 3 par
    ObjectCreate  ("خط عمودي", OBJ_VLINE, 0,D'2014.01.15 00:00',0) ;
    Won't work because you use one object name which means one object. You need unique names like name+time.
  2. yes i want to draw VLINE every Ten bar,
    Not every ten bars. Won't adjust for bars before the week end, nor holidays, nor short Sunday bar (server TZ dependent.)
  3. i can make it only appear in H4 then that would be great.
    RTFM. Why ONLY? wouldn't you want them to appear on lower timeframe charts also?
  4. is it possible to draw it only after Bar[1] ??
    iLAST_BAR 2
Not compiled, not tested.
#define iDIST_BAR 10 // Distance between H4 markers
#define iLAST_BAR 0  // Last bar done.
datetime H4MarkerLast;  void OnInitH4Marker(){  H4MarkerLast=0;   }
void     OnTickH4Marker(){ // Per tick or per bar
   for(iBar = iBarShift(NULL,0, H4MarkerLast) - 1; iBar >= iLAST_BAR; iBar--){
      if(H4MarkerLast == 0)   datetime nextSeperator  = 0x6FFFFFFF;
      else                             nextSeperator  = H4MarkerLast
                                                   + iDIST_BAR * PERIOD_H4 * 60;
      int   dowPre = TimeDayOfWeek( Time[iBar+1] ),
            dowCur = TimeDayOfWeek( Time[iBar  ] );
      if(dowCur < dowPre)  nextSeperator = Time[iBar];   // Beginning of week.
      if(Time[iBar] < nextSeperator)   continue;
      H4MarkerLast = Time[iBar];
      string name = "خط عمودي" + H4MarkerLast;
      ObjectCreate  (name, OBJ_VLINE, 0, H4MarkerLast,0);
      ObjectSet(name, OBJPROP_TIMEFRAMES, OBJ_PERIOD_M1 + OBJ_PERIOD_M5
               + OBJ_PERIOD_M15 + OBJ_PERIOD_M30 + OBJ_PERIOD_H1 + OBJ_PERIOD_H4);
   }
}
Not compiled, not tested.
mostafalotfi
185
mostafalotfi 2014.01.15 18:53  
WHRoeder:
  1. mostafa: i want to draw some VLINE to seperate the whole week in H4 in 3 par
    Won't work because you use one object name which means one object. You need unique names like name+time. [ML] if i understand correctly you mean that i need three object in this way
  2. yes i want to draw VLINE every Ten bar,
    Not every ten bars. Won't adjust for bars before the week end, nor holidays, nor short Sunday bar (server TZ dependent.) [ML] you are right if we have a holiday then it doesn't work properly, actually what i need is to divide the current time frame in 3 equal part (time base)
  3. i can make it only appear in H4 then that would be great.
    RTFM. Why ONLY? wouldn't you want them to appear on lower timeframe charts also? [ML] In my strategy im analyzing one week (last week), then based on the result i will put my orders in current week.. for confirmation of my weekly analysis i need these lines only appear in H4 (and only for current week) for example enclosed picture
    ObjectSet("خط عمودی", OBJPROP_TIMEFRAMES, OBJ_PERIOD_H4);
  4. is it possible to draw it only after Bar[1] ??
Not compiled, not tested. Not compiled, not tested. [ML] thank you for this code, i will try to find way to draw this lines and i will update you here

Thanks
whroeder1
13602
whroeder1 2014.01.15 19:58  
mostafa: [ML] thank you for this code, i will try to find way to draw this lines and i will update you here
Excuse me? Are you hard of reading? You will "try to find a way" I gave you the code. Just call the two functions (one from init, one from start.)
mostafalotfi
185
mostafalotfi 2014.01.15 20:44  
WHRoeder:
Excuse me? Are you hard of reading? You will "try to find a way" I gave you the code. Just call the two functions (one from init, one from start.)


:) yes, and i really appreciate it (i mean it).... im not professional :) i just start few days back ... and understanding your code is little bit hard for me because im newbie :D i dont want to just copy past your code, i have to read lots of thing for each line of your code.

if you found this part of my comment offensive, and I deeply apologize.

mostafalotfi
185
mostafalotfi 2014.01.15 20:47  
mostafa:


:) yes, and i really appreciate it (i mean it).... im not professional :) i just start few days back ... and understanding your code is little bit hard for me because im newbie :D i dont want to just copy past your code, i have to read lots of thing for each line of your code.

if you found this part of my comment offensive, and I deeply apologize.

i dono why i cannot compile your code..

/
To add comments, please log in or register