コード例 #1
0
ファイル: MQL.cs プロジェクト: jseparovic/MQL4CSharpGenerator
 /// <summary>
 /// Function: ChartSetSymbolPeriod
 /// Description: Changes the symbol and period of the specified chart. The function is asynchronous, i.e. it sends the command and does not wait for its execution completion. The command is added to chart message queue and executed only after all previous commands have been processed.
 /// URL: http://docs.mql4.com/chart_operations/chartsetsymbolperiod.html
 /// </summary>
 /// <param name="chart_id">[in] Chart ID. 0 means the current chart.</param>
 /// <param name="symbol">[in] Chart symbol. value means the current chart symbol (Expert Advisor is attached to)</param>
 /// <param name="period">[in] Chart period (timeframe). Can be one of the values. 0 means the current chart period.</param>
 public bool ChartSetSymbolPeriod (long chart_id, string symbol, ENUM_TIMEFRAMES period)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(chart_id);
     parameters.Add(symbol);
     parameters.Add(period.ToString());
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.ChartSetSymbolPeriod_1, parameters); // MQLCommand ENUM = 89
     while (MQLCommandManager.getInstance().IsCommandRunning())
     {
         //Thread.Sleep(1);
     }
     MQLCommandManager.getInstance().throwExceptionIfErrorResponse();
     return (bool) MQLCommandManager.getInstance().GetCommandResult();
 }
コード例 #2
0
ファイル: MQL.cs プロジェクト: jseparovic/MQL4CSharpGenerator
 /// <summary>
 /// Function: Bars
 /// Description: Returns the number of bars count in the history for a specified symbol and period. There are 2 variants of functions calls.
 /// URL: http://docs.mql4.com/series/barsfunction.html
 /// </summary>
 /// <param name="symbol_name">[in] Symbol name.</param>
 /// <param name="timeframe">[in] Period.</param>
 /// <param name="start_time">[in] Bar time corresponding to the first element.</param>
 /// <param name="stop_time">[in] Bar time corresponding to the last element.</param>
 public int Bars (string symbol_name, ENUM_TIMEFRAMES timeframe, DateTime start_time, DateTime stop_time)
 {
     List<Object> parameters = new List<Object>();
     parameters.Add(symbol_name);
     parameters.Add(timeframe.ToString());
     parameters.Add(start_time);
     parameters.Add(stop_time);
     MQLCommandManager.getInstance().ExecCommand(MQLCommand.Bars_2, parameters); // MQLCommand ENUM = 56
     while (MQLCommandManager.getInstance().IsCommandRunning())
     {
         //Thread.Sleep(1);
     }
     MQLCommandManager.getInstance().throwExceptionIfErrorResponse();
     return (int) MQLCommandManager.getInstance().GetCommandResult();
 }