stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Days Between Orders
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5011
Page 1 of 1
Author:  OmarSM [ Wed Dec 07, 2016 4:13 pm ]
Post subject:  Days Between Orders

Hi,

Please help coding the days between two orders.

I can't help myself around this. :arrrg: I can find the dates, but don't know how to add/subtract to other dates and finally get the number of days between them.

Thanks in advance for the help.

Omar
Author:  afeudale [ Wed Dec 07, 2016 4:59 pm ]
Post subject:  Days Between Orders

OmarSM » Wed Dec 07, 2016 11:13 am wrote:Hi,

Please help coding the days between two orders.

I can't help myself around this. :arrrg: I can find the dates, but don't know how to add/subtract to other dates and finally get the number of days between them.

Thanks in advance for the help.

Omar
Hi Omar,

How about if you get the dates as an integer instead of datetime? Then the values will be in seconds. You can subtract one from the other and divide by 86,400 (seconds in a day) to get the number of days? Then you can MathRound or other Normalize function if you want a whole number.
Author:  OmarSM [ Fri Dec 09, 2016 3:53 pm ]
Post subject:  Days Between Orders

afeudale » Wed Dec 07, 2016 12:59 pm wrote:
OmarSM » Wed Dec 07, 2016 11:13 am wrote: Hi Omar,

How about if you get the dates as an integer instead of datetime? Then the values will be in seconds. You can subtract one from the other and divide by 86,400 (seconds in a day) to get the number of days? Then you can MathRound or other Normalize function if you want a whole number.
:good:
Thanks for the tips, Got it working!!
Author:  SteveHopwood [ Sat Dec 10, 2016 12:27 am ]
Post subject:  Days Between Orders

OmarSM » Fri Dec 09, 2016 3:53 pm wrote:
:good:
Thanks for the tips, Got it working!!
Did you avoid those, "possible loss of data due to type conversion" warnings? The answer is 'Yes' if you haven't a clue what I am talking about and I will explain.

:xm:
All times are UTC Page 1 of 1