diff --git a/MtApi5/Mt5CommandType.cs b/MtApi5/Mt5CommandType.cs index 0a5691a6..d64712fa 100755 --- a/MtApi5/Mt5CommandType.cs +++ b/MtApi5/Mt5CommandType.cs @@ -81,6 +81,8 @@ internal enum Mt5CommandType CopySpread = 49, CopySpread1 = 1049, CopySpread2 = 1149, + iOpen = 500, + iClose = 501, //Market Information SymbolsTotal = 50, diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index 80bf3490..09e4e1f8 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -1024,6 +1024,32 @@ public int CopyRates(string symbolName, ENUM_TIMEFRAMES timeframe, DateTime star return ratesArray?.Length ?? 0; } + /// + ///Returns the Open price of the bar (indicated by the 'shift' parameter) on the corresponding chart. + /// + ///The symbol name of the financial instrument. NULL means the current symbol. + ///Period. It can be one of the values of the ENUM_TIMEFRAMES enumeration. 0 means the current chart period. + ///The index of the received value from the timeseries (backward shift by specified number of bars relative to the current bar). + public double iOpen(string symbolName, ENUM_TIMEFRAMES timeframe, int shift) + { + var commandParameters = new ArrayList { symbolName, (int)timeframe, shift }; + + return SendCommand(Mt5CommandType.iOpen, commandParameters); + } + + /// + ///Returns the Close price of the bar (indicated by the 'shift' parameter) on the corresponding chart. + /// + ///The symbol name of the financial instrument. NULL means the current symbol. + ///Period. It can be one of the values of the ENUM_TIMEFRAMES enumeration. 0 means the current chart period. + ///The index of the received value from the timeseries (backward shift by specified number of bars relative to the current bar). + public double iClose(string symbolName, ENUM_TIMEFRAMES timeframe, int shift) + { + var commandParameters = new ArrayList { symbolName, (int)timeframe, shift }; + + return SendCommand(Mt5CommandType.iClose, commandParameters); + } + /// ///The function gets to time_array history data of bar opening time for the specified symbol-period pair in the specified quantity. It should be noted that elements ordering is from present to past, i.e., starting position of 0 means the current bar. /// diff --git a/TestClients/MtApi5TestClient/MainWindow.xaml b/TestClients/MtApi5TestClient/MainWindow.xaml index 78729d34..0fd5928e 100755 --- a/TestClients/MtApi5TestClient/MainWindow.xaml +++ b/TestClients/MtApi5TestClient/MainWindow.xaml @@ -413,6 +413,10 @@