mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-23 23:58:08 +00:00
Issue #122: Implemented UnlockTicks function in MtApi (MT5)
This commit is contained in:
@@ -53,6 +53,7 @@ namespace MtApi5
|
||||
_mtEventHandlers[Mt5EventTypes.OnBookEvent] = ReceivedOnBookEvent;
|
||||
_mtEventHandlers[Mt5EventTypes.OnTick] = ReceivedOnTickEvent;
|
||||
_mtEventHandlers[Mt5EventTypes.OnTradeTransaction] = ReceivedOnTradeTransaction;
|
||||
_mtEventHandlers[Mt5EventTypes.OnLastTimeBar] = ReceivedOnLastTimeBar;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
@@ -3057,6 +3058,18 @@ namespace MtApi5
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Backtesting functions
|
||||
|
||||
///<summary>
|
||||
///The function unlock ticks in backtesting mode.
|
||||
///</summary>
|
||||
public void UnlockTicks()
|
||||
{
|
||||
SendCommand<object>(Mt5CommandType.UnlockTicks, null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion // Public Methods
|
||||
|
||||
#region Properties
|
||||
@@ -3104,6 +3117,7 @@ namespace MtApi5
|
||||
public event EventHandler<Mt5ConnectionEventArgs> ConnectionStateChanged;
|
||||
public event EventHandler<Mt5TradeTransactionEventArgs> OnTradeTransaction;
|
||||
public event EventHandler<Mt5BookEventArgs> OnBookEvent;
|
||||
public event EventHandler<Mt5TimeBarArgs> OnLastTimeBar;
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
@@ -3216,6 +3230,12 @@ namespace MtApi5
|
||||
QuoteUpdate?.Invoke(this, new Mt5QuoteEventArgs(quote));
|
||||
}
|
||||
|
||||
private void ReceivedOnLastTimeBar(int expertHandler, string payload)
|
||||
{
|
||||
var e = JsonConvert.DeserializeObject<OnLastTimeBarEvent>(payload);
|
||||
OnLastTimeBar?.Invoke(this, new Mt5TimeBarArgs(expertHandler, e.Instrument, e.Rates));
|
||||
}
|
||||
|
||||
private void Connect(string host, int port)
|
||||
{
|
||||
var client = new MtClient(host, port);
|
||||
|
||||
Reference in New Issue
Block a user