5/30/2023 0 Comments Mql code examples![]() If you use Alpari NZ terminal and connect to an "Alpari-ECN-Demo" server, then Time array contains GMT datetimes in MQL.This is the simplest, just call: date.ToUniversalTime() Let's say you want to convert a date that's returned by TimeLocal() into GMT.If you are comparing dates returned from the same source, this is not a problem, but if you want to compare dates returned from different sources, or save a date in a known format to be used by another program, you'll have to convert it into a certain time zone (for example GMT). All MQL functions and MqlDateTime class return dates as a DateTime in unknown time zone (DateTimeKind.Unspecified). In case you need to convert, the NQuotes library provides the API - MqlDateTime class.īe careful about time zones. When you want to add or subtract some seconds to a date value, you can use "TimeSpan.FromSeconds(n)" method. Normally you don't use this, and you manipulate datetime variables using datetime functions. In MQL datetime can be seemlessly converted to integer and back. The syntax for arrays is similar, but has a small differences.Īrray access and initialization is the same. Most of the primitive types have their C# equivalents.Ĭheck out the language primitive types comparison table. Most operations, operators, expressions are identical in both languages and will work without a change. Both MQL and C# share the basic C language syntax, which makes it easy to migrate from MQL4 to C#.
0 Comments
Leave a Reply. |