help please in andrew pitchfork drawing

 

the syntax of it is

ObjectCreate( "andrew1", 19,0, gt1t,gp1,gt2t ,gp2 ,gt3t ,gp3 ) ;

the main problem is that

gt1t

gt2t

gt3t

need to be converted from double format to datetime format as the function accept it

i have for example gt1t=17 in double format,,, it means 17 bars before the current bar

how could i get this bar in datetime format

thanks in advance

 
in other way can i convert double to datetime?
 

In the first place you are not supposed to take a symbol like OBJ_PITCHFORK and use its numerical value in a function call. That makes the code unreadable. Just use the symbol.

ObjectCreate( "andrew1", OBJ_PITCHFORK,0, gt1t,gp1,gt2t ,gp2 ,gt3t ,gp3 ) ;

In the second place, if you are having to convert from double to datetime you are probably doing something wrong.

And finally, if you do need to do it, for some really valid reason then

double val1 = 123.345;
datetime stupid = val1;
 
3ammary:

i have for example gt1t=17 in double format,,, it means 17 bars before the current bar

how could i get this bar in datetime format

thanks in advance

datetime BarTime = Time[17] or iTime(NULL, 0, 17)
 
thanks alot all i have done it :)