OBJ_HLINE starting point

 
Is it possible to have a OBJ_HLINE starting point shifted say 20 bars back etc .
Or is there any method or code for assigning a starting point to a OBJ_HLINE ?

Thanks...
 
Mpfx,

The OBJ_HLINE it's just a line without start/end.
You have to use OBJ_TREND to create a line with a defined start and end

   
   ObjectCreate("Line1", OBJ_TREND, 0, Time[20], Low[20], Time[0], Low[20]);
   ObjectSet("Line1", OBJPROP_COLOR, Blue );
   ObjectSet("Line1",  OBJPROP_RAY, 0 );

   ObjectCreate("Line2", OBJ_TREND, 0, Time[20], High[20], Time[0], High[0]);
   ObjectSet("Line2", OBJPROP_COLOR, Red );
   ObjectSet("Line2",  OBJPROP_RAY, 0 );



Hope this help.
Matias Romeo
Custom Metatrader Systems
matiasdotromeoatgmail.com

 
Thanks Matias,

Much apprieciated, will try it out.....
 
Hi again Matias,

For my starting point of OBJ_TREND I am using D'2005.05.09' which is start of this week.

How can I minus 7 , 14, 21 days etc, from this so I can find the week before , 2 weeks ago and so on...

Thanks
 
mpfx,

Since datetime variables represents the numbers of seconds since 00:00 January 1, 1970.
You can substract the numbers of seconds that a day represents ( 86400 = 24*60*60 ) times n (n=7).
Below is a script sample.

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+

int start()
{
  datetime date = D'2005.05.09';
  date -= 7*24*60*60;
  Print( TimeToStr(date) );
  
  return(0);
}



Hope this help

Matias Romeo
Custom Metatrader Systems
matiasdotromeoatgmail.com

 
Matias,
Once again a big Thank You, it was exactly what I needed, your help has been very much apprieciated :)
Good Trading to you..........
Reason: