How to initialize extern datetime with current time? - page 2

 
Why not? User can enter any datetime and it works fine. If you want a calendar pop up, you're going to have to have a GUI coded.
 
WHRoeder:
Why not? User can enter any datetime and it works fine. If you want a calendar pop up, you're going to have to have a GUI coded.
The reason is because i need to make things easy for users... just that!
 

Use this code


extern datetime t = D'';
 
cooper47:

Use this code


Nope. This will initialized the parameter with compilation date, not current time.
 
Alain Verleyen:
Nope. This will initialized the parameter with compilation date, not current time.

 

Try this

input datetime DT = D'00:00';
It will put you on current date at midnight
 
Daniel Lewis:

 

Try this

It will put you on current date at midnight

Try it tomorrow.

Maybe I was not clear enough ? Using this

extern datetime t = D'';

or this

input datetime DT = D'00:00';

or whatever other way you could find to express it, will use the compilation date. Of course, today, you compile, so it's the same, but on the future it will be the same date, I mean the compilation date which will not be any more "today" (the day you run it).

 
Alain Verleyen:

Try it tomorrow.

Maybe I was not clear enough ? Using this

or this

or whatever other way you could find to express it, will use the compilation date. Of course, today, you compile, so it's the same, but on the future it will be the same date, I mean the compilation date which will not be any more "today" (the day you run it).


Sorry my delay.... try this and works... thanks!

 

extern datetime pivotDay;


int dayIndex;


int start()

  {

   if(pivotDay == 0)

   {

      pivotDay = TimeCurrent();

   }


   dayIndex = iBarShift(NULL,PERIOD_D1,pivotDay);

.................................................................

Reason: