How to convert to local system time?

Created at 18 Aug 2017, 13:32
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
YC

ycomp

Joined 16.10.2013

How to convert to local system time?
18 Aug 2017, 13:32


I need to write this in the local system time of my computer. How do I do that?

 

position.EntryPrice

 


@ycomp
Replies

Spotware
18 Aug 2017, 15:05

Dear ycomp,

Thanks for your question but it is not very clear what you ask. What you have posted is the entry price. Do you mean the entry time? If you want to convert the position's entry time to your timezone, you can use something similar to the following code

 ExecuteMarketOrder(TradeType.Sell, Symbol, 1000);
 var timeDifference = DateTime.Now - DateTime.UtcNow;
 Print(Positions[0].EntryTime + timeDifference);

Best Regards,

cTrader Team


@Spotware

ycomp
18 Aug 2017, 15:10

yes, thanks I copied the wrong line from my code - I meant entry time


@ycomp