mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 52ca4fae1e | |||
| 6b327e017a | |||
| 10a758bd93 | |||
| 4a9642b60c | |||
| 6ba6496e46 | |||
| 1ffbba5ee3 | |||
| 8cdfd6fb91 | |||
| 7c3ddbabac | |||
| 83e0145a3a | |||
| f17c7cd554 | |||
| 4aefdd554b | |||
| 820ed9a631 | |||
| 95c55e90be | |||
| 486a1979a6 | |||
| faef5f7d18 | |||
| bd45c45fa1 | |||
| 29be184136 | |||
| 9bfda95cf7 | |||
| 24b881d8a0 | |||
| 07dd83f890 | |||
| 9afd30e463 | |||
| 16f454ca61 | |||
| f3a3a582fd | |||
| 93aaae86ed | |||
| bce68fd168 | |||
| 0812229538 | |||
| d0fa4af1d0 | |||
| 8eb4bcfabe | |||
| 9ea58354be | |||
| 02774d7328 | |||
| cbff71f8d0 | |||
| 951a91976c | |||
| 6a37826486 | |||
| cab2de6d24 | |||
| ec6c71607b | |||
| 0a39b69b15 | |||
| fe94ec21de | |||
| 34c78c73c0 | |||
| d7b8ef894c | |||
| 7f33cebce1 | |||
| 84740787d5 | |||
| ad6bad5187 | |||
| 0086b02bc8 | |||
| f7e06c1570 | |||
| c86a3a3752 | |||
| be8a17c0fd | |||
| 5c6751de9b | |||
| 83776f8b7a | |||
| f1c1df1e00 | |||
| d6640300f5 | |||
| c9c188f697 | |||
| 3a4f561836 | |||
| bdb30edee3 | |||
| 29f501b055 | |||
| 521d7ea2c0 | |||
| 0e5bb40a6f | |||
| 14079dc3c1 | |||
| 3600a86971 | |||
| 83e62fbff7 | |||
| 5c96aeb2fd | |||
| a238e5eb36 | |||
| 11fd5b7527 | |||
| cbe75cfbf6 | |||
| 9581431a9f | |||
| acf0c12531 |
@@ -104,6 +104,14 @@ _DLLAPI int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid,
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
_DLLAPI bool _stdcall sendEvent(int expertHandle, int eventType, wchar_t* payload, wchar_t* err)
|
||||
{
|
||||
return Execute<bool>([&expertHandle, &eventType, payload]() {
|
||||
MtAdapter::GetInstance()->SendEvent(expertHandle, eventType, gcnew String(payload));
|
||||
return true;
|
||||
}, err, false);
|
||||
}
|
||||
|
||||
_DLLAPI int _stdcall sendIntResponse(int expertHandle, int response, wchar_t* err)
|
||||
{
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
@@ -156,7 +164,7 @@ _DLLAPI int _stdcall sendStringResponse(int expertHandle, wchar_t* response, wch
|
||||
_DLLAPI int _stdcall sendVoidResponse(int expertHandle, wchar_t* err)
|
||||
{
|
||||
return Execute<int>([&expertHandle]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseObject(nullptr));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,50 @@ using log4net.Repository.Hierarchy;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class MtLog
|
||||
{
|
||||
#region ctor
|
||||
internal MtLog(Type type)
|
||||
{
|
||||
_log = LogManager.GetLogger(type);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
|
||||
public void Debug(object message)
|
||||
{
|
||||
_log.Debug(message);
|
||||
}
|
||||
|
||||
public void Error(object message)
|
||||
{
|
||||
_log.Error(message);
|
||||
}
|
||||
|
||||
public void Fatal(object message)
|
||||
{
|
||||
_log.Fatal(message);
|
||||
}
|
||||
|
||||
public void Info(object message)
|
||||
{
|
||||
_log.Info(message);
|
||||
}
|
||||
|
||||
public void Warn(object message)
|
||||
{
|
||||
_log.Warn(message);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
|
||||
private readonly ILog _log;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public class LogConfigurator
|
||||
{
|
||||
private const string LogFileNameExtension = "txt";
|
||||
@@ -48,5 +92,13 @@ namespace MTApiService
|
||||
#endif
|
||||
hierarchy.Configured = true;
|
||||
}
|
||||
|
||||
public static MtLog GetLogger(Type type)
|
||||
{
|
||||
if (type == null)
|
||||
throw new ArgumentNullException(nameof(type));
|
||||
|
||||
return new MtLog(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.28.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.28.0")]
|
||||
[assembly: AssemblyVersion("1.0.29.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.29.0")]
|
||||
@@ -994,6 +994,12 @@ namespace MtApi
|
||||
return MtApiTimeConverter.ConvertFromMtTime(commandResponse);
|
||||
}
|
||||
|
||||
public DateTime TimeGMT()
|
||||
{
|
||||
var commandResponse = SendCommand<int>(MtCommandType.TimeGMT, null);
|
||||
return MtApiTimeConverter.ConvertFromMtTime(commandResponse);
|
||||
}
|
||||
|
||||
public int TimeDay(DateTime date)
|
||||
{
|
||||
var commandParameters = new ArrayList { MtApiTimeConverter.ConvertToMtTime(date) };
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
TimeSeconds = 86,
|
||||
TimeYear = 87,
|
||||
Year = 88,
|
||||
TimeGMT = 281,
|
||||
|
||||
//Global Variables
|
||||
GlobalVariableCheck = 89,
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
namespace MtApi
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public enum ENUM_TERMINAL_INFO_STRING
|
||||
{
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.39.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.39.0")]
|
||||
[assembly: AssemblyVersion("1.0.40.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.40.0")]
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MtApi5.Events
|
||||
{
|
||||
internal enum Mt5EventTypes
|
||||
{
|
||||
OnTradeTransaction = 1,
|
||||
OnBookEvent = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MtApi5.Events
|
||||
{
|
||||
internal class OnBookEvent
|
||||
{
|
||||
public string Symbol { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MtApi5.Events
|
||||
{
|
||||
internal class OnTradeTransactionEvent
|
||||
{
|
||||
public MqlTradeTransaction Trans { get; set; }
|
||||
public MqlTradeRequest Request { get; set; }
|
||||
public MqlTradeResult Result { get; set; }
|
||||
}
|
||||
}
|
||||
+12
-8
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlBookInfo
|
||||
@@ -14,8 +10,16 @@ namespace MtApi5
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public ENUM_BOOK_TYPE type { get; private set; } // Order type from ENUM_BOOK_TYPE enumeration
|
||||
public double price { get; private set; } // Price
|
||||
public long volume { get; private set; } // Volume
|
||||
public MqlBookInfo()
|
||||
{ }
|
||||
|
||||
public ENUM_BOOK_TYPE type { get; set; } // Order type from ENUM_BOOK_TYPE enumeration
|
||||
public double price { get; set; } // Price
|
||||
public long volume { get; set; } // Volume
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"type = {type}; price = {price}; volume = {volume}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlParam
|
||||
{
|
||||
public ENUM_DATATYPE DataType { get; set; }
|
||||
public long? IntegerValue { get; set; }
|
||||
public double? DoubleValue { get; set; }
|
||||
public string StringValue { get; set; }
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
namespace MtApi5
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlTradeCheckResult
|
||||
{
|
||||
public uint Retcode { get; private set; } // Reply code
|
||||
public double Balance { get; private set; } // Balance after the execution of the deal
|
||||
public double Equity { get; private set; } // Equity after the execution of the deal
|
||||
public double Profit { get; private set; } // Floating profit
|
||||
public double Margin { get; private set; } // Margin requirements
|
||||
public double Margin_free { get; private set; } // Free margin
|
||||
public double Margin_level { get; private set; } // Margin level
|
||||
public string Comment { get; private set; } // Comment to the reply code (description of the error)
|
||||
public uint Retcode { get; set; } // Reply code
|
||||
public double Balance { get; set; } // Balance after the execution of the deal
|
||||
public double Equity { get; set; } // Equity after the execution of the deal
|
||||
public double Profit { get; set; } // Floating profit
|
||||
public double Margin { get; set; } // Margin requirements
|
||||
public double Margin_free { get; set; } // Free margin
|
||||
public double Margin_level { get; set; } // Margin level
|
||||
public string Comment { get; set; } // Comment to the reply code (description of the error)
|
||||
|
||||
public MqlTradeCheckResult(uint retcode
|
||||
, double balance
|
||||
@@ -29,5 +31,13 @@
|
||||
Margin_level = margin_level;
|
||||
Comment = comment;
|
||||
}
|
||||
|
||||
public MqlTradeCheckResult()
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Retcode={Retcode}; Comment={Comment}; Balance={Balance}; Equity={Equity}; Profit={Profit}; Margin={Margin}; Margin_free={Margin_free}; Margin_level={Margin_level}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
@@ -17,9 +19,23 @@ namespace MtApi5
|
||||
public ENUM_ORDER_TYPE Type { get; set; } // Order type
|
||||
public ENUM_ORDER_TYPE_FILLING Type_filling { get; set; } // Order execution type
|
||||
public ENUM_ORDER_TYPE_TIME Type_time { get; set; } // Order expiration type
|
||||
public DateTime Expiration { get; set; } // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
|
||||
|
||||
[JsonIgnore]
|
||||
public DateTime Expiration // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
|
||||
{
|
||||
get { return Mt5TimeConverter.ConvertFromMtTime(MtExpiration); }
|
||||
set { MtExpiration = Mt5TimeConverter.ConvertToMtTime(value); }
|
||||
}
|
||||
|
||||
public string Comment { get; set; } // Order comment
|
||||
public ulong Position { get; set; } // Position ticket
|
||||
public ulong PositionBy { get; set; } // The ticket of an opposite position
|
||||
|
||||
public int MtExpiration { get; private set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Action={Action}; Magic={Magic}; Order={Order}; Symbol={Symbol}; Volume={Volume}; Price={Price}; Stoplimit={Stoplimit}; Sl={Sl}; Tp={Tp}; Deviation={Deviation}; Type={Type}; Type_filling={Type_filling}; Type_time={Type_time}; Expiration={Expiration}; Comment={Comment}; Position={Position}; PositionBy={PositionBy}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-11
@@ -1,4 +1,6 @@
|
||||
namespace MtApi5
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlTradeResult
|
||||
{
|
||||
@@ -15,19 +17,32 @@
|
||||
Request_id = request_id;
|
||||
}
|
||||
|
||||
public uint Retcode { get; private set; } // Operation return code
|
||||
public ulong Deal { get; private set; } // Deal ticket, if it is performed
|
||||
public ulong Order { get; private set; } // Order ticket, if it is placed
|
||||
public double Volume { get; private set; } // Deal volume, confirmed by broker
|
||||
public double Price { get; private set; } // Deal price, confirmed by broker
|
||||
public double Bid { get; private set; } // Current Bid price
|
||||
public double Ask { get; private set; } // Current Ask price
|
||||
public string Comment { get; private set; } // Broker comment to operation (by default it is filled by the operation description)
|
||||
public uint Request_id { get; private set; } // Request ID set by the terminal during the dispatch
|
||||
internal MqlTradeResult(MqlTradeResult o)
|
||||
{
|
||||
Retcode = o.Retcode;
|
||||
Deal = o.Deal;
|
||||
Order = o.Order;
|
||||
Volume = o.Volume;
|
||||
Price = o.Price;
|
||||
Bid = o.Bid;
|
||||
Ask = o.Ask;
|
||||
Comment = o.Comment;
|
||||
Request_id = o.Request_id;
|
||||
}
|
||||
|
||||
public uint Retcode { get; } // Operation return code
|
||||
public ulong Deal { get; } // Deal ticket, if it is performed
|
||||
public ulong Order { get; } // Order ticket, if it is placed
|
||||
public double Volume { get; } // Deal volume, confirmed by broker
|
||||
public double Price { get; } // Deal price, confirmed by broker
|
||||
public double Bid { get; } // Current Bid price
|
||||
public double Ask { get; } // Current Ask price
|
||||
public string Comment { get; } // Broker comment to operation (by default it is filled by the operation description)
|
||||
public uint Request_id { get; } // Request ID set by the terminal during the dispatch
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Retcode={Retcode}; Deal={Deal}; Order={Order}; Volume={Volume}; Price={Price}; Bid={Bid}; Ask={Ask}; Comment={Comment}; Request_id={Request_id}";
|
||||
return $"Retcode={Retcode}; Comment={Comment}; Deal={Deal}; Order={Order}; Volume={Volume}; Price={Price}; Bid={Bid}; Ask={Ask}; Request_id={Request_id}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlTradeTransaction
|
||||
{
|
||||
public ulong Deal { get; set; } // Deal ticket
|
||||
public ulong Order { get; set; } // Order ticket
|
||||
public string Symbol { get; set; } // Trade symbol name
|
||||
public ENUM_TRADE_TRANSACTION_TYPE Type { get; set; } // Trade transaction type
|
||||
public ENUM_ORDER_TYPE OrderType { get; set; } // Order type
|
||||
public ENUM_ORDER_STATE OrderState { get; set; } // Order state
|
||||
public ENUM_DEAL_TYPE DealType { get; set; } // Deal type
|
||||
public ENUM_ORDER_TYPE_TIME TimeType { get; set; } // Order type by action period
|
||||
|
||||
[JsonIgnore]
|
||||
public DateTime TimeExpiration // Order expiration time
|
||||
{
|
||||
get { return Mt5TimeConverter.ConvertFromMtTime(MtTimeExpiration); }
|
||||
set { MtTimeExpiration = Mt5TimeConverter.ConvertToMtTime(value); }
|
||||
}
|
||||
|
||||
public double Price { get; set; } // Price
|
||||
public double PriceTrigger { get; set; } // Stop limit order activation price
|
||||
public double PriceSl { get; set; } // Stop Loss level
|
||||
public double PriceTp { get; set; } // Take Profit level
|
||||
public double Volume { get; set; } // Volume in lots
|
||||
public ulong Position { get; set; } // Position ticket
|
||||
public ulong PositionBy { get; set; } // Ticket of an opposite position
|
||||
|
||||
public int MtTimeExpiration { get; private set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Deal={Deal}; Order={Order}; Symbol={Symbol}; Type={Type}; OrderType={OrderType}; OrderState={OrderState}; DealType={DealType}; TimeType={TimeType}; TimeExpiration={TimeExpiration}; Price={Price}; PriceTrigger{PriceTrigger}; PriceSl={PriceSl}; PriceTp={PriceTp}; Volume={Volume}; Position={Position}; PositionBy={PositionBy}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class Mt5BookEventArgs : EventArgs
|
||||
{
|
||||
public int ExpertHandle { get; set; }
|
||||
public string Symbol { get; set; } //Symbol of OnBookEvent event.
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
namespace MtApi5
|
||||
// ReSharper disable InconsistentNaming
|
||||
namespace MtApi5
|
||||
{
|
||||
internal enum Mt5CommandType
|
||||
{
|
||||
//NoCommand = 0
|
||||
|
||||
//trade operations
|
||||
OrderSend = 1,
|
||||
//OrderSend = 1,
|
||||
OrderCalcMargin = 2,
|
||||
OrderCalcProfit = 3,
|
||||
OrderCheck = 4,
|
||||
//OrderSendAsync = 5,
|
||||
PositionsTotal = 6,
|
||||
PositionGetSymbol = 7,
|
||||
@@ -16,6 +16,7 @@
|
||||
PositionGetDouble = 9,
|
||||
PositionGetInteger = 10,
|
||||
PositionGetString = 11,
|
||||
PositionGetTicket = 4,
|
||||
OrdersTotal = 12,
|
||||
OrderGetTicket = 13,
|
||||
OrderSelect = 14,
|
||||
@@ -94,20 +95,18 @@
|
||||
SymbolInfoSessionTrade = 59,
|
||||
MarketBookAdd = 60,
|
||||
MarketBookRelease = 61,
|
||||
MarketBookGet = 62,
|
||||
//MarketBookGet = 62,
|
||||
OrderCloseAll = 63,
|
||||
|
||||
//CTrade
|
||||
PositionClose = 64,
|
||||
PositionOpen = 65,
|
||||
PositionOpenWithResult = 1065,
|
||||
//PositionOpenWithResult = 1065,
|
||||
|
||||
//Backtesting
|
||||
BacktestingReady = 66,
|
||||
IsTesting = 67,
|
||||
|
||||
Print = 68,
|
||||
|
||||
//Requests
|
||||
MtRequest = 155,
|
||||
|
||||
@@ -170,6 +169,72 @@
|
||||
iTriX = 123,
|
||||
iWPR = 124,
|
||||
iVIDyA = 125,
|
||||
iVolumes = 126
|
||||
iVolumes = 126,
|
||||
|
||||
//Date and Time
|
||||
TimeCurrent = 127,
|
||||
TimeTradeServer = 128,
|
||||
TimeLocal = 129,
|
||||
TimeGMT = 130,
|
||||
|
||||
IndicatorRelease = 131,
|
||||
|
||||
//Chart Operations
|
||||
ChartId = 206,
|
||||
ChartRedraw = 207,
|
||||
ChartApplyTemplate = 236,
|
||||
ChartSaveTemplate = 237,
|
||||
ChartWindowFind = 238,
|
||||
//ChartTimePriceToXY = 239,
|
||||
//ChartXYToTimePrice = 240,
|
||||
ChartOpen = 241,
|
||||
ChartFirst = 242,
|
||||
ChartNext = 243,
|
||||
ChartClose = 244,
|
||||
ChartSymbol = 245,
|
||||
ChartPeriod = 246,
|
||||
ChartSetDouble = 247,
|
||||
ChartSetInteger = 248,
|
||||
ChartSetString = 249,
|
||||
ChartGetDouble = 250,
|
||||
ChartGetInteger = 251,
|
||||
ChartGetString = 252,
|
||||
ChartNavigate = 253,
|
||||
ChartIndicatorDelete = 254,
|
||||
ChartIndicatorName = 255,
|
||||
ChartIndicatorsTotal = 256,
|
||||
ChartWindowOnDropped = 257,
|
||||
ChartPriceOnDropped = 258,
|
||||
ChartTimeOnDropped = 259,
|
||||
ChartXOnDropped = 260,
|
||||
ChartYOnDropped = 261,
|
||||
ChartSetSymbolPeriod = 262,
|
||||
ChartScreenShot = 263,
|
||||
ChartIndicatorAdd = 280,
|
||||
ChartIndicatorGet = 281,
|
||||
|
||||
// Terminal Operations
|
||||
TerminalCompany = 68,
|
||||
TerminalName = 69,
|
||||
TerminalPath = 70,
|
||||
|
||||
//Checkup
|
||||
GetLastError = 132,
|
||||
TerminalInfoString = 153,
|
||||
TerminalInfoInteger = 204,
|
||||
TerminalInfoDouble = 205,
|
||||
|
||||
//Common Functions
|
||||
Alert = 136,
|
||||
Comment = 137, //TODO
|
||||
GetTickCount = 138, //TODO
|
||||
GetMicrosecondCount = 139, //TODO
|
||||
MessageBox = 140, //TODO
|
||||
PeriodSeconds = 141, //TODO
|
||||
PlaySound = 142, //TODO
|
||||
Print = 68,
|
||||
ResetLastError = 143,
|
||||
SendNotification = 144, //TODO
|
||||
SendMail = 145 //TODO
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace MtApi5
|
||||
{
|
||||
public class Mt5ConnectionEventArgs: EventArgs
|
||||
{
|
||||
public Mt5ConnectionState Status { get; private set; }
|
||||
public string ConnectionMessage { get; private set; }
|
||||
public Mt5ConnectionState Status { get; }
|
||||
public string ConnectionMessage { get; }
|
||||
|
||||
public Mt5ConnectionEventArgs(Mt5ConnectionState status, string message)
|
||||
{
|
||||
|
||||
+167
-11
@@ -1,4 +1,6 @@
|
||||
namespace MtApi5
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
|
||||
// Chart Constants:
|
||||
@@ -34,6 +36,96 @@
|
||||
#endregion //Chart Timeframes
|
||||
|
||||
|
||||
#region Charts Properties
|
||||
|
||||
public enum ENUM_CHART_PROPERTY_DOUBLE
|
||||
{
|
||||
CHART_SHIFT_SIZE = 3,
|
||||
CHART_FIXED_POSITION = 41,
|
||||
CHART_FIXED_MAX = 8,
|
||||
CHART_FIXED_MIN = 9,
|
||||
CHART_POINTS_PER_BAR = 11,
|
||||
CHART_PRICE_MIN = 108,
|
||||
CHART_PRICE_MAX = 109
|
||||
}
|
||||
|
||||
public enum ENUM_CHART_PROPERTY_INTEGER
|
||||
{
|
||||
CHART_SHOW = 46,
|
||||
CHART_IS_OBJECT = 111,
|
||||
CHART_BRING_TO_TOP = 35,
|
||||
CHART_CONTEXT_MENU = 50,
|
||||
CHART_CROSSHAIR_TOOL = 49,
|
||||
CHART_MOUSE_SCROLL = 42,
|
||||
CHART_EVENT_MOUSE_WHEEL = 48,
|
||||
CHART_EVENT_MOUSE_MOVE = 40,
|
||||
CHART_EVENT_OBJECT_CREATE = 38,
|
||||
CHART_EVENT_OBJECT_DELETE = 39,
|
||||
CHART_MODE = 0,
|
||||
CHART_FOREGROUND = 1,
|
||||
CHART_SHIFT = 2,
|
||||
CHART_AUTOSCROLL = 4,
|
||||
CHART_KEYBOARD_CONTROL = 47,
|
||||
CHART_QUICK_NAVIGATION = 45,
|
||||
CHART_SCALE = 5,
|
||||
CHART_SCALEFIX = 6,
|
||||
CHART_SCALEFIX_11 = 7,
|
||||
CHART_SCALE_PT_PER_BAR = 10,
|
||||
CHART_SHOW_OHLC = 12,
|
||||
CHART_SHOW_BID_LINE = 13,
|
||||
CHART_SHOW_ASK_LINE = 14,
|
||||
CHART_SHOW_LAST_LINE = 15,
|
||||
CHART_SHOW_PERIOD_SEP = 16,
|
||||
CHART_SHOW_GRID = 17,
|
||||
CHART_SHOW_VOLUMES = 18,
|
||||
CHART_SHOW_OBJECT_DESCR = 19,
|
||||
CHART_VISIBLE_BARS = 100,
|
||||
CHART_WINDOWS_TOTAL = 101,
|
||||
CHART_WINDOW_IS_VISIBLE = 102,
|
||||
CHART_WINDOW_HANDLE = 103,
|
||||
CHART_WINDOW_YDISTANCE = 110,
|
||||
CHART_FIRST_VISIBLE_BAR = 104,
|
||||
CHART_WIDTH_IN_BARS = 105,
|
||||
CHART_WIDTH_IN_PIXELS = 106,
|
||||
CHART_HEIGHT_IN_PIXELS = 107,
|
||||
CHART_COLOR_BACKGROUND = 21,
|
||||
CHART_COLOR_FOREGROUND = 22,
|
||||
CHART_COLOR_GRID = 23,
|
||||
CHART_COLOR_VOLUME = 24,
|
||||
CHART_COLOR_CHART_UP = 25,
|
||||
CHART_COLOR_CHART_DOWN = 26,
|
||||
CHART_COLOR_CHART_LINE = 27,
|
||||
CHART_COLOR_CANDLE_BULL = 28,
|
||||
CHART_COLOR_CANDLE_BEAR = 29,
|
||||
CHART_COLOR_BID = 30,
|
||||
CHART_COLOR_ASK = 31,
|
||||
CHART_COLOR_LAST = 32,
|
||||
CHART_COLOR_STOP_LEVEL = 33,
|
||||
CHART_SHOW_TRADE_LEVELS = 34,
|
||||
CHART_DRAG_TRADE_LEVELS = 43,
|
||||
CHART_SHOW_DATE_SCALE = 36,
|
||||
CHART_SHOW_PRICE_SCALE = 37,
|
||||
CHART_SHOW_ONE_CLICK = 44,
|
||||
CHART_IS_MAXIMIZED = 115,
|
||||
CHART_IS_MINIMIZED = 116
|
||||
}
|
||||
|
||||
public enum ENUM_CHART_PROPERTY_STRING
|
||||
{
|
||||
CHART_COMMENT = 20,
|
||||
CHART_EXPERT_NAME = 113,
|
||||
CHART_SCRIPT_NAME = 114
|
||||
}
|
||||
|
||||
public enum ENUM_CHART_POSITION
|
||||
{
|
||||
CHART_BEGIN = 0, // Chart beginning (the oldest prices)
|
||||
CHART_CURRENT_POS = 1, // Current position
|
||||
CHART_END = 2 // Chart end (the latest prices)
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// Environment State:
|
||||
|
||||
#region Client Terminal Properties
|
||||
@@ -580,16 +672,16 @@
|
||||
public enum ENUM_TRADE_TRANSACTION_TYPE
|
||||
{
|
||||
TRADE_TRANSACTION_ORDER_ADD = 0, //Adding a new open order
|
||||
TRADE_TRANSACTION_ORDER_UPDATE = 1, //Updating an open order
|
||||
TRADE_TRANSACTION_ORDER_DELETE = 2, //Removing an order from the list of the open ones
|
||||
TRADE_TRANSACTION_DEAL_ADD = 6, //Adding a deal to the history
|
||||
TRADE_TRANSACTION_DEAL_UPDATE = 7, //Updating a deal in the history
|
||||
TRADE_TRANSACTION_DEAL_DELETE = 8, //Deleting a deal from the history
|
||||
TRADE_TRANSACTION_HISTORY_ADD = 3, //Adding an order to the history as a result of execution or cancellation
|
||||
TRADE_TRANSACTION_HISTORY_UPDATE = 4, //Changing an order located in the orders history
|
||||
TRADE_TRANSACTION_HISTORY_DELETE = 5, //Deleting an order from the orders history
|
||||
TRADE_TRANSACTION_POSITION = 9, //Changing a position not related to a deal execution
|
||||
TRADE_TRANSACTION_REQUEST = 10 //Notification of the fact that a trade request has been processed by a server and processing result has been received
|
||||
TRADE_TRANSACTION_ORDER_UPDATE = 1, //Updating an open order. The updates include not only evident changes from the client terminal or a trade server sides but also changes of an order state when setting it (for example, transition from ORDER_STATE_STARTED to ORDER_STATE_PLACED or from ORDER_STATE_PLACED to ORDER_STATE_PARTIAL, etc.).
|
||||
TRADE_TRANSACTION_ORDER_DELETE = 2, //Removing an order from the list of the open ones. An order can be deleted from the open ones as a result of setting an appropriate request or execution (filling) and moving to the history.
|
||||
TRADE_TRANSACTION_DEAL_ADD = 6, //Adding a deal to the history. The action is performed as a result of an order execution or performing operations with an account balance.
|
||||
TRADE_TRANSACTION_DEAL_UPDATE = 7, //Updating a deal in the history. There may be cases when a previously executed deal is changed on a server. For example, a deal has been changed in an external trading system (exchange) where it was previously transferred by a broker.
|
||||
TRADE_TRANSACTION_DEAL_DELETE = 8, //Deleting a deal from the history. There may be cases when a previously executed deal is deleted from a server. For example, a deal has been deleted in an external trading system (exchange) where it was previously transferred by a broker.
|
||||
TRADE_TRANSACTION_HISTORY_ADD = 3, //Adding an order to the history as a result of execution or cancellation.
|
||||
TRADE_TRANSACTION_HISTORY_UPDATE = 4, //Changing an order located in the orders history. This type is provided for enhancing functionality on a trade server side.
|
||||
TRADE_TRANSACTION_HISTORY_DELETE = 5, //Deleting an order from the orders history. This type is provided for enhancing functionality on a trade server side.
|
||||
TRADE_TRANSACTION_POSITION = 9, //Changing a position not related to a deal execution. This type of transaction shows that a position has been changed on a trade server side. Position volume, open price, Stop Loss and Take Profit levels can be changed. Data on changes are submitted in MqlTradeTransaction structure via OnTradeTransaction handler. Position change (adding, changing or closing), as a result of a deal execution, does not lead to the occurrence of TRADE_TRANSACTION_POSITION transaction.
|
||||
TRADE_TRANSACTION_REQUEST = 10 //Notification of the fact that a trade request has been processed by a server and processing result has been received. Only type field (trade transaction type) must be analyzed for such transactions in MqlTradeTransaction structure. The second and third parameters of OnTradeTransaction (request and result) must be analyzed for additional data.
|
||||
}
|
||||
|
||||
#endregion //Trade Transaction Types
|
||||
@@ -782,4 +874,68 @@
|
||||
}
|
||||
|
||||
#endregion //Smoothing Methods
|
||||
|
||||
#region Indicator constants
|
||||
|
||||
public enum ENUM_INDICATOR
|
||||
{
|
||||
IND_AC = 5, // Accelerator Oscillator
|
||||
IND_AD = 6, // Accumulation/Distribution
|
||||
IND_ADX = 8, // Average Directional Index
|
||||
IND_ADXW = 9, // ADX by Welles Wilder
|
||||
IND_ALLIGATOR = 7, // Alligator
|
||||
IND_AMA = 40, // Adaptive Moving Average
|
||||
IND_AO = 11, // Awesome Oscillator
|
||||
IND_ATR = 10, // Average True Range
|
||||
IND_BANDS = 13, // Bollinger Bands®
|
||||
IND_BEARS = 12, // Bears Power
|
||||
IND_BULLS = 14, // Bulls Power
|
||||
IND_BWMFI = 22, // Market Facilitation Index
|
||||
IND_CCI = 15, // Commodity Channel Index
|
||||
IND_CHAIKIN = 41, // Chaikin Oscillator
|
||||
IND_CUSTOM = 43, // Custom indicator
|
||||
IND_DEMA = 36, // Double Exponential Moving Average
|
||||
IND_DEMARKER = 16, // DeMarker
|
||||
IND_ENVELOPES = 17, // Envelopes
|
||||
IND_FORCE = 18, // Force Index
|
||||
IND_FRACTALS = 19, // Fractals
|
||||
IND_FRAMA = 39, // Fractal Adaptive Moving Average
|
||||
IND_GATOR = 20, // Gator Oscillator
|
||||
IND_ICHIMOKU = 21, // Ichimoku Kinko Hyo
|
||||
IND_MA = 26, // Moving Average
|
||||
IND_MACD = 23, // MACD
|
||||
IND_MFI = 25, // Money Flow Index
|
||||
IND_MOMENTUM = 24, // Momentum
|
||||
IND_OBV = 28, // On Balance Volume
|
||||
IND_OSMA = 27, // OsMA
|
||||
IND_RSI = 30, // Relative Strength Index
|
||||
IND_RVI = 31, // Relative Vigor Index
|
||||
IND_SAR = 29, // Parabolic SAR
|
||||
IND_STDDEV = 32, // Standard Deviation
|
||||
IND_STOCHASTIC = 33, // Stochastic Oscillator
|
||||
IND_TEMA = 37, // Triple Exponential Moving Average
|
||||
IND_TRIX = 38, // Triple Exponential Moving Averages Oscillator
|
||||
IND_VIDYA = 42, // Variable Index Dynamic Average
|
||||
IND_VOLUMES = 34, // Volumes
|
||||
IND_WPR = 35 // Williams' Percent Ranges
|
||||
}
|
||||
|
||||
public enum ENUM_DATATYPE
|
||||
{
|
||||
TYPE_BOOL = 1,
|
||||
TYPE_CHAR = 2,
|
||||
TYPE_UCHAR = 3,
|
||||
TYPE_SHORT = 4,
|
||||
TYPE_USHORT = 5,
|
||||
TYPE_COLOR = 6,
|
||||
TYPE_INT = 7,
|
||||
TYPE_UINT = 8,
|
||||
TYPE_DATETIME = 9,
|
||||
TYPE_LONG = 10,
|
||||
TYPE_ULONG = 11,
|
||||
TYPE_FLOAT = 12,
|
||||
TYPE_DOUBLE = 13,
|
||||
TYPE_STRING = 14
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
+12
-8
@@ -1,21 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MTApiService;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class Mt5Quote
|
||||
{
|
||||
public string Instrument { get; private set; }
|
||||
public double Bid { get; private set; }
|
||||
public double Ask { get; private set; }
|
||||
public string Instrument { get; }
|
||||
public double Bid { get; }
|
||||
public double Ask { get; }
|
||||
public int ExpertHandle { get; set; }
|
||||
|
||||
public Mt5Quote(string instrument, double bid, double ask)
|
||||
private Mt5Quote(string instrument, double bid, double ask)
|
||||
{
|
||||
Instrument = instrument;
|
||||
Bid = bid;
|
||||
Ask = ask;
|
||||
}
|
||||
|
||||
internal Mt5Quote(MtQuote quote)
|
||||
:this(quote.Instrument, quote.Bid, quote.Ask)
|
||||
{
|
||||
ExpertHandle = quote.ExpertHandle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class Mt5QuoteEventArgs: EventArgs
|
||||
{
|
||||
public Mt5Quote Quote { get; private set; }
|
||||
public Mt5Quote Quote { get; }
|
||||
|
||||
public Mt5QuoteEventArgs(Mt5Quote quote)
|
||||
{
|
||||
|
||||
@@ -1,32 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
class Mt5TimeConverter
|
||||
internal class Mt5TimeConverter
|
||||
{
|
||||
public static DateTime ConvertFromMtTime(int time)
|
||||
{
|
||||
DateTime tmpTime = new DateTime(1970, 1, 1);
|
||||
var tmpTime = new DateTime(1970, 1, 1);
|
||||
return new DateTime(tmpTime.Ticks + (time * 0x989680L));
|
||||
}
|
||||
|
||||
public static DateTime ConvertFromMtTime(long time)
|
||||
{
|
||||
DateTime tmpTime = new DateTime(1970, 1, 1);
|
||||
var tmpTime = new DateTime(1970, 1, 1);
|
||||
return new DateTime(tmpTime.Ticks + (time * 0x989680L));
|
||||
}
|
||||
|
||||
public static int ConvertToMtTime(DateTime time)
|
||||
public static int ConvertToMtTime(DateTime? time)
|
||||
{
|
||||
int result = 0;
|
||||
if (time != DateTime.MinValue)
|
||||
{
|
||||
DateTime tmpTime = new DateTime(1970, 1, 1);
|
||||
result = (int)((time.Ticks - tmpTime.Ticks) / 0x989680L);
|
||||
}
|
||||
var result = 0;
|
||||
if (time == null || time == DateTime.MinValue)
|
||||
return result;
|
||||
var tmpTime = new DateTime(1970, 1, 1);
|
||||
result = (int)((time.Value.Ticks - tmpTime.Ticks) / 0x989680L);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi5
|
||||
{
|
||||
public class Mt5TradeTransactionEventArgs : EventArgs
|
||||
{
|
||||
public int ExpertHandle { get; set; }
|
||||
public MqlTradeTransaction Trans { get; set; } // trade transaction structure
|
||||
public MqlTradeRequest Request { get; set; } // request structure
|
||||
public MqlTradeResult Result { get; set; } // result structure
|
||||
}
|
||||
}
|
||||
+22
-3
@@ -48,10 +48,15 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CopyTicksFlag.cs" />
|
||||
<Compile Include="Events\OnBookEvent.cs" />
|
||||
<Compile Include="Events\OnTradeTransactionEvent.cs" />
|
||||
<Compile Include="MqlBookInfo.cs" />
|
||||
<Compile Include="MqlParam.cs" />
|
||||
<Compile Include="MqlRates.cs" />
|
||||
<Compile Include="MqlTick.cs" />
|
||||
<Compile Include="MqlTradeCheckResult.cs" />
|
||||
<Compile Include="MqlTradeTransaction.cs" />
|
||||
<Compile Include="Mt5BookEventArgs.cs" />
|
||||
<Compile Include="Mt5TimeConverter.cs" />
|
||||
<Compile Include="Mt5Enums.cs" />
|
||||
<Compile Include="Mt5ConnectionEventArgs.cs" />
|
||||
@@ -59,20 +64,33 @@
|
||||
<Compile Include="MqlTradeRequest.cs" />
|
||||
<Compile Include="MqlTradeResult.cs" />
|
||||
<Compile Include="Mt5QuoteEventArgs.cs" />
|
||||
<Compile Include="Mt5TradeTransactionEventArgs.cs" />
|
||||
<Compile Include="MtApi5Client.cs" />
|
||||
<Compile Include="Mt5CommandType.cs" />
|
||||
<Compile Include="MtConverters.cs" />
|
||||
<Compile Include="ErrorCode.cs" />
|
||||
<Compile Include="ExecutionException.cs" />
|
||||
<Compile Include="Events\Mt5EventTypes.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Mt5Quote.cs" />
|
||||
<Compile Include="Requests\ChartTimePriceToXyRequest.cs" />
|
||||
<Compile Include="Requests\ChartTimePriceToXyResult.cs" />
|
||||
<Compile Include="Requests\ChartXyToTimePriceRequest.cs" />
|
||||
<Compile Include="Requests\ChartXyToTimePriceResult.cs" />
|
||||
<Compile Include="Requests\CopyTicksRequest.cs" />
|
||||
<Compile Include="Requests\ICustomRequest.cs" />
|
||||
<Compile Include="Requests\IndicatorCreateRequest.cs" />
|
||||
<Compile Include="Requests\MarketBookGetRequest.cs" />
|
||||
<Compile Include="Requests\OrderCheckRequest.cs" />
|
||||
<Compile Include="Requests\OrderCheckResult.cs" />
|
||||
<Compile Include="Requests\OrderSendRequest.cs" />
|
||||
<Compile Include="Requests\PositionOpenRequest.cs" />
|
||||
<Compile Include="Requests\RequestBase.cs" />
|
||||
<Compile Include="Requests\RequestType.cs" />
|
||||
<Compile Include="Responses\CopyTicksResponse.cs" />
|
||||
<Compile Include="Responses\ICustomResponse.cs" />
|
||||
<Compile Include="Responses\ResponseBase.cs" />
|
||||
<Compile Include="Requests\OrderSendResult.cs" />
|
||||
<Compile Include="Requests\Response.cs" />
|
||||
<Compile Include="Requests\SymbolInfoStringRequest.cs" />
|
||||
<Compile Include="Requests\SymbolInfoStringResult.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MTApiService\MTApiService.csproj">
|
||||
@@ -83,6 +101,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
+795
-59
File diff suppressed because it is too large
Load Diff
+18
-76
@@ -6,84 +6,14 @@ namespace MtApi5
|
||||
{
|
||||
internal static class MtConverters
|
||||
{
|
||||
private static readonly MtLog Log = LogConfigurator.GetLogger(typeof(MtConverters));
|
||||
|
||||
#region Values Converters
|
||||
public static Mt5Quote Parse(this MtQuote quote)
|
||||
{
|
||||
return (quote != null) ? new Mt5Quote(quote.Instrument, quote.Bid, quote.Ask) : null;
|
||||
}
|
||||
|
||||
public static bool ParseResult(this string inputString, char separator, out MqlTradeResult result)
|
||||
{
|
||||
var retVal = false;
|
||||
result = null;
|
||||
|
||||
if (string.IsNullOrEmpty(inputString) == false)
|
||||
{
|
||||
var values = inputString.Split(separator);
|
||||
if (values.Length == 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
retVal = int.Parse(values[0]) != 0;
|
||||
|
||||
var retcode = uint.Parse(values[1]);
|
||||
var deal = ulong.Parse(values[2]);
|
||||
var order = ulong.Parse(values[3]);
|
||||
var volume = double.Parse(values[4]);
|
||||
var price = double.Parse(values[5]);
|
||||
var bid = double.Parse(values[6]);
|
||||
var ask = double.Parse(values[7]);
|
||||
var comment = values[8];
|
||||
var requestId = uint.Parse(values[9]);
|
||||
|
||||
result = new MqlTradeResult(retcode, deal, order, volume, price, bid, ask, comment, requestId);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static bool ParseResult(this string inputString, char separator, out MqlTradeCheckResult result)
|
||||
{
|
||||
var retVal = false;
|
||||
result = null;
|
||||
|
||||
if (string.IsNullOrEmpty(inputString) == false)
|
||||
{
|
||||
var values = inputString.Split(separator);
|
||||
if (values.Length == 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
retVal = int.Parse(values[0]) != 0;
|
||||
|
||||
var retcode = uint.Parse(values[1]);
|
||||
var balance = double.Parse(values[2]);
|
||||
var equity = double.Parse(values[3]);
|
||||
var profit = double.Parse(values[4]);
|
||||
var margin = double.Parse(values[5]);
|
||||
var marginFree = double.Parse(values[6]);
|
||||
var marginLevel = double.Parse(values[7]);
|
||||
var comment = values[8];
|
||||
|
||||
result = new MqlTradeCheckResult(retcode, balance, equity, profit, margin, marginFree, marginLevel, comment);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
retVal = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static bool ParseResult(this string inputString, char separator, out double result)
|
||||
{
|
||||
Log.Debug($"ParseResult: inputString = {inputString}, separator = {separator}");
|
||||
|
||||
var retVal = false;
|
||||
result = 0;
|
||||
|
||||
@@ -98,18 +28,25 @@ namespace MtApi5
|
||||
|
||||
result = double.Parse(values[1]);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
retVal = false;
|
||||
Log.Error($"ParseResult: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warn("ParseResult: input srting is null or empty!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static bool ParseResult(this string inputString, char separator, out DateTime from, out DateTime to)
|
||||
{
|
||||
Log.Debug($"ParseResult: inputString = {inputString}, separator = {separator}");
|
||||
|
||||
var retVal = false;
|
||||
|
||||
from = new DateTime();
|
||||
@@ -130,12 +67,17 @@ namespace MtApi5
|
||||
var iTo= int.Parse(values[2]);
|
||||
to = Mt5TimeConverter.ConvertFromMtTime(iTo);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception ex)
|
||||
{
|
||||
retVal = false;
|
||||
Log.Error($"ParseResult: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Warn("ParseResult: input srting is null or empty!");
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.14")]
|
||||
[assembly: AssemblyFileVersion("1.0.14")]
|
||||
[assembly: AssemblyVersion("1.0.18")]
|
||||
[assembly: AssemblyFileVersion("1.0.18")]
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ChartTimePriceToXyRequest : RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.ChartTimePriceToXY;
|
||||
|
||||
public long ChartId { get; set; }
|
||||
public int SubWindow { get; set; }
|
||||
public DateTime? Time { get; set; }
|
||||
public double Price { get; set; }
|
||||
|
||||
public int MtTime => Mt5TimeConverter.ConvertToMtTime(Time);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ChartTimePriceToXyResult
|
||||
{
|
||||
public bool RetVal { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ChartXyToTimePriceRequest : RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.ChartXYToTimePrice;
|
||||
|
||||
public long ChartId { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ChartXyToTimePriceResult
|
||||
{
|
||||
public bool RetVal { get; set; }
|
||||
public int SubWindow { get; set; }
|
||||
public DateTime? Time => Mt5TimeConverter.ConvertFromMtTime(MtTime);
|
||||
public double Price { get; set; }
|
||||
|
||||
public int MtTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class IndicatorCreateRequest: RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.IndicatorCreate;
|
||||
|
||||
public string Symbol { get; set; }
|
||||
public ENUM_TIMEFRAMES Period { get; set; }
|
||||
public ENUM_INDICATOR IndicatorType { get; set; }
|
||||
public List<MqlParam> Parameters { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class MarketBookGetRequest: RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.MarketBookGet;
|
||||
|
||||
public string Symbol { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class OrderCheckRequest: RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.OrderCheck;
|
||||
|
||||
public MqlTradeRequest TradeRequest { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
public class OrderCheckResult
|
||||
{
|
||||
public bool RetVal { get; set; }
|
||||
public MqlTradeCheckResult TradeCheckResult { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class OrderSendRequest: RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.OrderSend;
|
||||
|
||||
public MqlTradeRequest TradeRequest { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class OrderSendResult
|
||||
{
|
||||
public bool RetVal { get; set; }
|
||||
public MqlTradeResult TradeResult { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class PositionOpenRequest: RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.PositionOpen;
|
||||
|
||||
public string Symbol { get; set; }
|
||||
public ENUM_ORDER_TYPE OrderType { get; set; }
|
||||
public double Volume { get; set; }
|
||||
public double Price { get; set; }
|
||||
public double Sl { get; set; }
|
||||
public double Tp { get; set; }
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,19 @@
|
||||
namespace MtApi5.Requests
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal enum RequestType
|
||||
{
|
||||
Unknown = 0,
|
||||
CopyTicks = 1,
|
||||
iCustom = 2
|
||||
Unknown = 0,
|
||||
CopyTicks = 1,
|
||||
iCustom = 2,
|
||||
OrderSend = 3,
|
||||
PositionOpen = 4,
|
||||
OrderCheck = 5,
|
||||
MarketBookGet = 6,
|
||||
IndicatorCreate = 7,
|
||||
SymbolInfoString = 8,
|
||||
ChartTimePriceToXY = 9,
|
||||
ChartXYToTimePrice = 10
|
||||
}
|
||||
}
|
||||
Executable → Regular
+4
-2
@@ -1,8 +1,10 @@
|
||||
namespace MtApi5.Responses
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ResponseBase
|
||||
internal class Response<T>
|
||||
{
|
||||
public int ErrorCode { get; set; }
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
public T Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class SymbolInfoStringRequest : RequestBase
|
||||
{
|
||||
public override RequestType RequestType => RequestType.SymbolInfoString;
|
||||
|
||||
public string SymbolName { get; set; }
|
||||
public ENUM_SYMBOL_INFO_STRING PropId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class SymbolInfoStringResult
|
||||
{
|
||||
public bool RetVal { get; set; }
|
||||
public string StringVar { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MtApi5.Responses
|
||||
{
|
||||
internal class CopyTicksResponse: ResponseBase
|
||||
{
|
||||
public List<MqlTick> Ticks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace MtApi5.Responses
|
||||
{
|
||||
internal class ICustomResponse: ResponseBase
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:mtapi5="clr-namespace:MtApi5;assembly=MtApi5"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:mtApi5TestClient="clr-namespace:MtApi5TestClient"
|
||||
Title="MainWindow" Height="700" Width="650"
|
||||
Title="MainWindow" Height="700" Width="900"
|
||||
Closing="Window_Closing">
|
||||
<Window.Resources>
|
||||
<DataTemplate x:Key="ConnectionTextBlockTemplate" DataType="{x:Type mtapi5:Mt5ConnectionState}">
|
||||
@@ -78,19 +78,48 @@
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_INTEGER_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_INTEGER"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_STRING_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_STRING"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TERMINAL_INFO_DOUBLE_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TERMINAL_INFO_DOUBLE"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_TIMEFRAMES_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_TIMEFRAMES"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
|
||||
<ObjectDataProvider x:Key="ENUM_INDICATOR_Key" MethodName="GetValues"
|
||||
ObjectType="{x:Type sys:Enum}">
|
||||
<ObjectDataProvider.MethodParameters>
|
||||
<x:Type TypeName="mtapi5:ENUM_INDICATOR"/>
|
||||
</ObjectDataProvider.MethodParameters>
|
||||
</ObjectDataProvider>
|
||||
</Window.Resources>
|
||||
|
||||
<Grid x:Name="_MainLayout">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0.65*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="0.35*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
@@ -100,311 +129,480 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Expander ExpandDirection="Right" IsExpanded="True"
|
||||
Grid.Row="0" Grid.Column="0" Margin="5">
|
||||
<Expander.Header>
|
||||
<TextBlock Text="Connection" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="Auto">
|
||||
<TextBlock.LayoutTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="-90"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.LayoutTransform>
|
||||
<TextBlock.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform ScaleX="1" ScaleY="1"/>
|
||||
<SkewTransform AngleX="0" AngleY="0"/>
|
||||
<RotateTransform Angle="0"/>
|
||||
<TranslateTransform X="0" Y="0"/>
|
||||
</TransformGroup>
|
||||
</TextBlock.RenderTransform>
|
||||
</TextBlock>
|
||||
</Expander.Header>
|
||||
<Expander.Content>
|
||||
<Grid Margin="10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Grid.Row="0" Margin="2" Visibility="Visible" BorderThickness="1" BorderBrush="DarkBlue">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host" Margin="5,2,2,2" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="2" Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port" Margin="5,2,2,2" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="2" Width="70" HorizontalAlignment="Left" Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="30,5,0,10" >
|
||||
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
||||
<Button Margin="10,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Grid.Row="3" Margin="2" Visibility="Visible" BorderThickness="1" BorderBrush="DarkBlue">
|
||||
<Grid Margin="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="150"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Host"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Host, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="Port"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="1"
|
||||
Margin="5,0,0,0"
|
||||
Text="{Binding Port, UpdateSourceTrigger=PropertyChanged}"/>
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="2" Margin="5" Orientation="Horizontal">
|
||||
<Button Content="Connect" Width="70" Command="{Binding ConnectCommand}" />
|
||||
<Button Margin="5,0,0,0" Width="70" Content="Disconnect" Command="{Binding DisconnectCommand}" />
|
||||
</StackPanel>
|
||||
<Label Grid.Row="0" Content="Quotes" Background="LightYellow" />
|
||||
<ListView Grid.Row="1" Margin="2"
|
||||
ItemsSource="{Binding Quotes}"
|
||||
SelectedItem="{Binding SelectedQuote}"
|
||||
SelectionMode="Single">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="100" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
||||
<GridViewColumn Width="70" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
||||
<GridViewColumn Width="70" Header="Ask" DisplayMemberBinding="{Binding Ask}" />
|
||||
<GridViewColumn Width="80" Header="ExpertHandle" DisplayMemberBinding="{Binding ExpertHandle}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Expander.Content>
|
||||
</Expander>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<ListView Grid.Row="0" Grid.Column="1"
|
||||
ItemsSource="{Binding Quotes}"
|
||||
SelectedItem="{Binding SelectedQuote}"
|
||||
SelectionMode="Single">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="140" Header="Instrument" DisplayMemberBinding="{Binding Instrument}" />
|
||||
<GridViewColumn Width="80" Header="Bid" DisplayMemberBinding="{Binding Bid}" />
|
||||
<GridViewColumn Width="80" Header="Ask" DisplayMemberBinding="{Binding Ask}" />
|
||||
<GridViewColumn Width="80" Header="Feeds Count" DisplayMemberBinding="{Binding FeedCount}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
<TabControl Grid.Column="1" Margin="2">
|
||||
<TabItem Header="Trade Functions">
|
||||
<ScrollViewer>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TabControl Grid.Row="1" >
|
||||
<TabItem Header="Trade Functions">
|
||||
<ScrollViewer>
|
||||
<Expander Header="MqlTradeRequest" Margin="10" IsExpanded="True">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Action"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Source={StaticResource ENUM_TRADE_REQUEST_ACTIONS_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Action}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="Magic" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="0" Text="{Binding TradeRequest.Magic}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="Order"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding TradeRequest.Order}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="1" Text="Symbol" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="1" Text="{Binding TradeRequest.Symbol}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="Volume"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding TradeRequest.Volume}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" Text="Price" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="2" Text="{Binding TradeRequest.Price}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="Stoplimit"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding TradeRequest.Stoplimit}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="3" Text="Sl" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="3" Text="{Binding TradeRequest.Sl}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="Tp"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding TradeRequest.Tp}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="4" Text="Deviation" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="4" Text="{Binding TradeRequest.Deviation}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="5" Text="Type"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="5" Text="Type_filling" Margin="10,0,0,0"/>
|
||||
<ComboBox Grid.Column="3" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_FILLING_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_filling}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="6" Text="Type_time"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="6" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_TIME_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_time}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="6" Text="Expiration" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="6" Text="{Binding TradeRequest.Expiration}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="7" Text="Comment"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" Text="{Binding TradeRequest.Comment}" Margin="5,0,0,0"/>
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="OrderCheck" Command="{Binding OrderCheckCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="PositionGetTicket" Command="{Binding PositionGetTicketCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
</StackPanel>
|
||||
|
||||
<WrapPanel>
|
||||
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryOrderGetInteger" Command="{Binding HistoryOrderGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealMethods" Command="{Binding HistoryDealMethodsCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
</WrapPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Account Information">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Expander Header="MqlTradeRequest" Margin="10">
|
||||
<Grid Margin="0,10,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ComboBox Grid.Column="0" Grid.Row="0"
|
||||
SelectedItem="{Binding AccountInfoDoublePropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_DOUBLE_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoDoubleCommand}"
|
||||
Content="AccountInfoDouble" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="1"
|
||||
SelectedItem="{Binding AccountInfoIntegerPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_INTEGER_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoIntegerCommand}"
|
||||
Content="AccountInfoInteger" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="2"
|
||||
SelectedItem="{Binding AccountInfoStringPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_STRING_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoStringCommand}"
|
||||
Content="AccountInfoString" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Terminal Information">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="0"
|
||||
SelectedItem="{Binding TerminalInfoDoublePropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_DOUBLE_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
||||
Command="{Binding TerminalInfoDoubleCommand}"
|
||||
Content="TerminalInfoDouble" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="1"
|
||||
SelectedItem="{Binding TerminalInfoIntegerPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_INTEGER_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
||||
Command="{Binding TerminalInfoIntegerCommand}"
|
||||
Content="TerminalInfoInteger" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="2"
|
||||
SelectedItem="{Binding TerminalInfoStringPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TERMINAL_INFO_STRING_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
||||
Command="{Binding TerminalInfoStringCommand}"
|
||||
Content="TerminalInfoString" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Timeseries and Indicators Access">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="1" Margin="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Row="0" Text="Symbol Name" Margin="1"/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="0" Text="TimeFrame" Margin="1" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="StartPos" Margin="1" HorizontalAlignment="Right"/>
|
||||
<TextBlock Grid.Row="3" Grid.Column="0" Text="Count" Margin="1" HorizontalAlignment="Right"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}" Margin="1"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1" Margin="1"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
||||
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}" Margin="1"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}" Margin="1"/>
|
||||
</Grid>
|
||||
|
||||
<WrapPanel Grid.Row="1" Grid.Column="0" Margin="5">
|
||||
<Button Command="{Binding CopyRatesCommand}" Margin="1"
|
||||
Content="CopyRates" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTimesCommand}" Margin="1"
|
||||
Content="CopyTimes" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyOpenCommand}" Margin="1"
|
||||
Content="CopyOpen" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyHighCommand}" Margin="1"
|
||||
Content="CopyHigh" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyLowCommand}" Margin="1"
|
||||
Content="CopyLow" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyCloseCommand}" Margin="1"
|
||||
Content="CopyClose" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTickVolumeCommand}" Margin="1"
|
||||
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyRealVolumeCommand}" Margin="1"
|
||||
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopySpreadCommand}" Margin="1"
|
||||
Content="CopySpread" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTicksCommand}" Margin="1"
|
||||
Content="CopyTicks" HorizontalAlignment="Left" />
|
||||
</WrapPanel>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="0" Text="Action"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Source={StaticResource ENUM_TRADE_REQUEST_ACTIONS_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Action}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="0" Text="Magic" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="0" Text="{Binding TradeRequest.Magic}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="Order"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding TradeRequest.Order}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="1" Text="Symbol" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="1" Text="{Binding TradeRequest.Symbol}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="Volume"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding TradeRequest.Volume}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="2" Text="Price" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="2" Text="{Binding TradeRequest.Price}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="Stoplimit"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding TradeRequest.Stoplimit}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="3" Text="Sl" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="3" Text="{Binding TradeRequest.Sl}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="4" Text="Tp"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="4" Text="{Binding TradeRequest.Tp}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="4" Text="Deviation" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="4" Text="{Binding TradeRequest.Deviation}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="5" Text="Type"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="5" Text="Type_filling" Margin="10,0,0,0"/>
|
||||
<ComboBox Grid.Column="3" Grid.Row="5" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_FILLING_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_filling}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="6" Text="Type_time"/>
|
||||
<ComboBox Grid.Column="1" Grid.Row="6" ItemsSource="{Binding Source={StaticResource ENUM_ORDER_TYPE_TIME_Key}}"
|
||||
SelectedItem="{Binding TradeRequest.Type_time}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="2" Grid.Row="6" Text="Expiration" Margin="10,0,0,0"/>
|
||||
<TextBox Grid.Column="3" Grid.Row="6" Text="{Binding TradeRequest}" Margin="5,0,0,0"/>
|
||||
|
||||
<TextBlock Grid.Column="0" Grid.Row="7" Text="Comment"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3" Text="{Binding TradeRequest}" Margin="5,0,0,0"/>
|
||||
<DockPanel Grid.Row="0" LastChildFill="True">
|
||||
<Button DockPanel.Dock="Right" Command="{Binding IndicatorCreateCommand}" Margin="2"
|
||||
Content="IndicatorCreate" HorizontalAlignment="Left" />
|
||||
<ComboBox Margin="2"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_INDICATOR_Key}}"
|
||||
SelectedItem="{Binding TimeSeriesValues.IndicatorType}"/>
|
||||
</DockPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Label Content="Indicator handle:" Margin="2"/>
|
||||
<TextBox Margin="2" Width="60" PreviewTextInput="NumberValidationTextBox" Text="{Binding TimeSeriesValues.IndicatorHandle}"/>
|
||||
<Button Command="{Binding IndicatorReleaseCommand}" Margin="2"
|
||||
Content="IndicatorRelease" HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical">
|
||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
|
||||
<ListBox Grid.Column="0" ItemsSource="{Binding TimeSeriesResults}" />
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Market Info">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
||||
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
||||
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
||||
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoString2Command}" Content="SymbolInfoString-2" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionQuoteCommand}" Content="SymbolInfoSessionQuote" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionTradeCommand}" Content="SymbolInfoSessionTrade" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookAddCommand}" Content="MarketBookAdd" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookReleaseCommand}" Content="MarketBookRelease" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookGetCommand}" Content="MarketBookGet" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="CTrade">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding PositionOpenCommand}" Content="PositionOpen" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Indicators">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding iCustomCommand}" Content="iCustom" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Chart Functions">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" Margin="5">
|
||||
<TextBlock Text="Symbol" VerticalAlignment="Center" Margin="2"/>
|
||||
<TextBox Width="100" Text="{Binding ChartFunctionsSymbolValue}" Margin="2"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
<TabItem Header="Account Information">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.4*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<WrapPanel Grid.Row="1" Orientation="Horizontal" Margin="5">
|
||||
<Button Command="{Binding ChartOpenCommand}" Content="ChartOpen" Margin="2"/>
|
||||
<Button Command="{Binding ChartTimePriceToXYCommand}" Content="ChartTimePriceToXY" Margin="2"/>
|
||||
<Button Command="{Binding ChartXYToTimePriceCommand}" Content="ChartXYToTimePrice" Margin="2"/>
|
||||
</WrapPanel>
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="0"
|
||||
SelectedItem="{Binding AccountInfoDoublePropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_DOUBLE_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoDoubleCommand}"
|
||||
Content="AccountInfoDouble" HorizontalAlignment="Left" />
|
||||
<WrapPanel Grid.Row="3" VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding ChartApplyTemplateCommand}" Content="ChartApplyTemplate" Margin="2"/>
|
||||
<Button Command="{Binding ChartSaveTemplateCommand}" Content="ChartSaveTemplate" Margin="2"/>
|
||||
</WrapPanel>
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="1"
|
||||
SelectedItem="{Binding AccountInfoIntegerPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_INTEGER_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="1" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoIntegerCommand}"
|
||||
Content="AccountInfoInteger" HorizontalAlignment="Left" />
|
||||
|
||||
<ComboBox Grid.Column="0" Grid.Row="2"
|
||||
SelectedItem="{Binding AccountInfoStringPropertyId}"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_ACCOUNT_INFO_STRING_Key}}"/>
|
||||
<Button Grid.Column="1" Grid.Row="2" Margin="10,0,0,0"
|
||||
Command="{Binding AccountInfoStringCommand}"
|
||||
Content="AccountInfoString" HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
<Grid Margin="10" Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox Grid.Column="0" Text="{Binding MessageText}" Margin="5"/>
|
||||
<Button Grid.Column="1" Content="Print" Command="{Binding PrintCommand}" Margin="5"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Timeseries and Indicators Access">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox Grid.Row="0" Text="symbolName"/>
|
||||
<TextBox Grid.Row="1" Grid.Column="0" Text="timeframe"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="0" Text="startPos"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="0" Text="count"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding TimeSeriesValues.SymbolValue}"/>
|
||||
<ComboBox Grid.Row="1" Grid.Column="1"
|
||||
ItemsSource="{Binding Source={StaticResource ENUM_TIMEFRAMES_Key}}"
|
||||
SelectedItem="{Binding TimeSeriesValues.TimeFrame}"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding TimeSeriesValues.StartPos}"/>
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding TimeSeriesValues.Count}"/>
|
||||
|
||||
<WrapPanel Grid.Row="4" Grid.ColumnSpan="2" Grid.Column="0" Margin="10">
|
||||
<Button Command="{Binding CopyRatesCommand}" Margin="1"
|
||||
Content="CopyRates" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTimesCommand}" Margin="1"
|
||||
Content="CopyTimes" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyOpenCommand}" Margin="1"
|
||||
Content="CopyOpen" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyHighCommand}" Margin="1"
|
||||
Content="CopyHigh" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyLowCommand}" Margin="1"
|
||||
Content="CopyLow" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyCloseCommand}" Margin="1"
|
||||
Content="CopyClose" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTickVolumeCommand}" Margin="1"
|
||||
Content="CopyTickVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyRealVolumeCommand}" Margin="1"
|
||||
Content="CopyRealVolume" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopySpreadCommand}" Margin="1"
|
||||
Content="CopySpread" HorizontalAlignment="Left" />
|
||||
<Button Command="{Binding CopyTicksCommand}" Margin="1"
|
||||
Content="CopyTicks" HorizontalAlignment="Left" />
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal" Margin="5">
|
||||
<Button Command="{Binding ChartIdCommand}" Content="ChartId" Margin="2"/>
|
||||
<TextBlock Text="ChartID" VerticalAlignment="Center" Margin="20,2,2,2"/>
|
||||
<TextBox Width="150" Text="{Binding ChartFunctionsChartIdValue}" Margin="2"/>
|
||||
</StackPanel>
|
||||
|
||||
<WrapPanel Grid.Row="5" VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding ChartRedrawCommand}" Content="ChartRedraw" Margin="2"/>
|
||||
<Button Command="{Binding ChartWindowFindCommand}" Content="ChartWindowFind" Margin="2"/>
|
||||
<Button Command="{Binding ChartCloseCommand}" Content="ChartClose" Margin="2"/>
|
||||
<Button Command="{Binding ChartPeriodCommand}" Content="ChartPeriod" Margin="2"/>
|
||||
<Button Command="{Binding ChartSetDoubleCommand}" Content="ChartSetDouble" Margin="2"/>
|
||||
<Button Command="{Binding ChartSetIntegerCommand}" Content="ChartSetInteger" Margin="2"/>
|
||||
<Button Command="{Binding ChartSetStringCommand}" Content="ChartSetString" Margin="2"/>
|
||||
<Button Command="{Binding ChartGetDoubleCommand}" Content="ChartGetDouble" Margin="2"/>
|
||||
<Button Command="{Binding ChartGetIntegerCommand}" Content="ChartGetInteger" Margin="2"/>
|
||||
<Button Command="{Binding ChartNavigateCommand}" Content="ChartNavigate" Margin="2"/>
|
||||
<Button Command="{Binding ChartIndicatorAddCommand}" Content="ChartIndicatorAdd" Margin="2"/>
|
||||
<Button Command="{Binding ChartIndicatorDeleteCommand}" Content="ChartIndicatorDelete" Margin="2"/>
|
||||
<Button Command="{Binding ChartIndicatorGetCommand}" Content="ChartIndicatorGet" Margin="2"/>
|
||||
<Button Command="{Binding ChartIndicatorNameCommand}" Content="ChartIndicatorName" Margin="2"/>
|
||||
<Button Command="{Binding ChartIndicatorsTotalCommand}" Content="ChartIndicatorsTotal" Margin="2"/>
|
||||
<Button Command="{Binding ChartWindowOnDroppedCommand}" Content="ChartWindowOnDropped" Margin="2"/>
|
||||
<Button Command="{Binding ChartPriceOnDroppedCommand}" Content="ChartPriceOnDropped" Margin="2"/>
|
||||
<Button Command="{Binding ChartTimeOnDroppedCommand}" Content="ChartTimeOnDropped" Margin="2"/>
|
||||
<Button Command="{Binding ChartXOnDroppedCommand}" Content="ChartXOnDropped" Margin="2"/>
|
||||
<Button Command="{Binding ChartYOnDroppedCommand}" Content="ChartYOnDropped" Margin="2"/>
|
||||
<Button Command="{Binding ChartSetSymbolPeriodCommand}" Content="ChartSetSymbolPeriod" Margin="2"/>
|
||||
<Button Command="{Binding ChartScreenShotCommand}" Content="ChartScreenShot" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Time and Date">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding TimeCurrentCommand}" Content="TimeCurrent" Margin="2"/>
|
||||
<Button Command="{Binding TimeTradeServerCommand}" Content="TimeTradeServer" Margin="2"/>
|
||||
<Button Command="{Binding TimeLocalCommand}" Content="TimeLocal" Margin="2"/>
|
||||
<Button Command="{Binding TimeGMTCommand}" Content="TimeGMT" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
|
||||
<ListBox ItemsSource="{Binding TimeSeriesResults}" />
|
||||
<TabItem Header="Checkup and Common Functions">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Market Info">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding SymbolsTotalCommand}" Content="SymbolsTotal" Margin="2"/>
|
||||
<Button Command="{Binding SymbolNameCommand}" Content="SymbolName" Margin="2"/>
|
||||
<Button Command="{Binding SymbolSelectCommand}" Content="SymbolSelect" Margin="2"/>
|
||||
<Button Command="{Binding SymbolIsSynchronizedCommand}" Content="SymbolIsSynchronized" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoDoubleCommand}" Content="SymbolInfoDouble" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoIntegerCommand}" Content="SymbolInfoInteger" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoStringCommand}" Content="SymbolInfoString" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoTickCommand}" Content="SymbolInfoTick" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionQuoteCommand}" Content="SymbolInfoSessionQuote" Margin="2"/>
|
||||
<Button Command="{Binding SymbolInfoSessionTradeCommand}" Content="SymbolInfoSessionTrade" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookAddCommand}" Content="MarketBookAdd" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookReleaseCommand}" Content="MarketBookRelease" Margin="2"/>
|
||||
<Button Command="{Binding MarketBookGetCommand}" Content="MarketBookGet" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding GetLastErrorCommand}" Content="GetLastError" Margin="2"/>
|
||||
<Button Command="{Binding ResetLastErrorCommand}" Content="ResetLastError" Margin="2"/>
|
||||
</WrapPanel>
|
||||
|
||||
<TabItem Header="CTrade">
|
||||
<WrapPanel VerticalAlignment="Top" Margin="5">
|
||||
<Button Command="{Binding PositionOpenCommand}" Content="PositionOpen" Margin="2"/>
|
||||
</WrapPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<Grid Margin="10" Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" Text="{Binding MessageText}" Margin="2"/>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Command="{Binding PrintCommand}" Content="Print" Margin="2" />
|
||||
<Button Command="{Binding AlertCommand}" Content="Alert" Margin="2" />
|
||||
</StackPanel>
|
||||
|
||||
<Expander Grid.Row="2" Header="History" IsExpanded="True">
|
||||
<ListBox mtApi5TestClient:ListBoxBehavior.ScrollOnNewItem="true" Height="200" ItemsSource="{Binding History}"/>
|
||||
</Expander>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Grid>
|
||||
|
||||
<GridSplitter Grid.Row="1" Height="2" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Border Grid.Row="2" BorderThickness="1" BorderBrush="DarkBlue" Margin="2">
|
||||
<Grid Margin="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="Output Console" Background="LightYellow" />
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding History}"
|
||||
mtApi5TestClient:ListBoxBehavior.ScrollOnNewItem="true" />
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<StatusBar Grid.Row="3">
|
||||
<StatusBarItem>
|
||||
|
||||
@@ -1,37 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MainWindow.xaml
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
public partial class MainWindow
|
||||
{
|
||||
ViewModel _vm { get; set; }
|
||||
private ViewModel Vm { get; }
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_vm = new ViewModel();
|
||||
_MainLayout.DataContext = _vm;
|
||||
Vm = new ViewModel();
|
||||
_MainLayout.DataContext = Vm;
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
_vm.Close();
|
||||
Vm.Close();
|
||||
}
|
||||
|
||||
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
var regex = new Regex("[^0-9]+");
|
||||
e.Handled = regex.IsMatch(e.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
@@ -10,38 +6,38 @@ namespace MtApi5TestClient
|
||||
{
|
||||
#region Properties
|
||||
|
||||
public string Instrument { get; private set; }
|
||||
public string Instrument { get; }
|
||||
|
||||
private double _Bid;
|
||||
private double _bid;
|
||||
public double Bid
|
||||
{
|
||||
get { return _Bid; }
|
||||
get { return _bid; }
|
||||
set
|
||||
{
|
||||
_Bid = value;
|
||||
_bid = value;
|
||||
OnPropertyChanged("Bid");
|
||||
}
|
||||
}
|
||||
|
||||
private double _Ask;
|
||||
private double _ask;
|
||||
public double Ask
|
||||
{
|
||||
get { return _Ask; }
|
||||
get { return _ask; }
|
||||
set
|
||||
{
|
||||
_Ask = value;
|
||||
_ask = value;
|
||||
OnPropertyChanged("Ask");
|
||||
}
|
||||
}
|
||||
|
||||
private int _FeedCount = 0;
|
||||
public int FeedCount
|
||||
private int _expertHandle;
|
||||
public int ExpertHandle
|
||||
{
|
||||
get { return _FeedCount; }
|
||||
get { return _expertHandle; }
|
||||
set
|
||||
{
|
||||
_FeedCount = value;
|
||||
OnPropertyChanged("FeedCount");
|
||||
_expertHandle = value;
|
||||
OnPropertyChanged("ExpertHandle");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +55,7 @@ namespace MtApi5TestClient
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,21 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using MtApi5;
|
||||
using MtApi5;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
public class TimeSeriesValueViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private string _SymbolValue;
|
||||
private string _symbolValue;
|
||||
public string SymbolValue
|
||||
{
|
||||
get { return _SymbolValue; }
|
||||
get { return _symbolValue; }
|
||||
set
|
||||
{
|
||||
_SymbolValue = value;
|
||||
_symbolValue = value;
|
||||
OnPropertyChanged("SymbolValue");
|
||||
}
|
||||
}
|
||||
@@ -24,13 +20,36 @@ namespace MtApi5TestClient
|
||||
public int StartPos { get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
|
||||
private int _indicatorHandle;
|
||||
public int IndicatorHandle
|
||||
{
|
||||
get { return _indicatorHandle; }
|
||||
set
|
||||
{
|
||||
_indicatorHandle = value;
|
||||
OnPropertyChanged("IndicatorHandle");
|
||||
}
|
||||
}
|
||||
|
||||
private ENUM_INDICATOR _indicatorType = ENUM_INDICATOR.IND_MACD;
|
||||
public ENUM_INDICATOR IndicatorType
|
||||
{
|
||||
get { return _indicatorType; }
|
||||
set
|
||||
{
|
||||
_indicatorType = value;
|
||||
OnPropertyChanged("IndicatorType");
|
||||
}
|
||||
}
|
||||
|
||||
#region INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
|
||||
var handler = PropertyChanged;
|
||||
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
@@ -6,6 +7,8 @@ using MtApi5;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace MtApi5TestClient
|
||||
{
|
||||
@@ -16,20 +19,31 @@ namespace MtApi5TestClient
|
||||
public DelegateCommand DisconnectCommand { get; private set; }
|
||||
|
||||
public DelegateCommand OrderSendCommand { get; private set; }
|
||||
public DelegateCommand OrderCheckCommand { get; private set; }
|
||||
public DelegateCommand PositionGetTicketCommand { get; private set; }
|
||||
|
||||
public DelegateCommand HistoryOrderGetIntegerCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetDoubleCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetIntegerCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetStringCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealMethodsCommand { get; private set; }
|
||||
|
||||
public DelegateCommand AccountInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoStringCommand { get; private set; }
|
||||
|
||||
public DelegateCommand TerminalInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand TerminalInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand TerminalInfoStringCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyRatesCommand { get; private set; }
|
||||
public DelegateCommand CopyTimesCommand { get; private set; }
|
||||
public DelegateCommand CopyOpenCommand { get; private set; }
|
||||
public DelegateCommand CopyHighCommand { get; private set; }
|
||||
public DelegateCommand CopyLowCommand { get; private set; }
|
||||
public DelegateCommand CopyCloseCommand { get; private set; }
|
||||
public DelegateCommand IndicatorCreateCommand { get; private set; }
|
||||
public DelegateCommand IndicatorReleaseCommand { get; private set; }
|
||||
|
||||
public DelegateCommand CopyTickVolumeCommand { get; private set; }
|
||||
public DelegateCommand CopyRealVolumeCommand { get; private set; }
|
||||
@@ -43,6 +57,7 @@ namespace MtApi5TestClient
|
||||
public DelegateCommand SymbolInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoIntegerCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoStringCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoString2Command { get; private set; }
|
||||
public DelegateCommand SymbolInfoTickCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionQuoteCommand { get; private set; }
|
||||
public DelegateCommand SymbolInfoSessionTradeCommand { get; private set; }
|
||||
@@ -52,7 +67,47 @@ namespace MtApi5TestClient
|
||||
|
||||
public DelegateCommand PositionOpenCommand { get; private set; }
|
||||
|
||||
public DelegateCommand GetLastErrorCommand { get; private set; }
|
||||
public DelegateCommand ResetLastErrorCommand { get; private set; }
|
||||
public DelegateCommand PrintCommand { get; private set; }
|
||||
public DelegateCommand AlertCommand { get; private set; }
|
||||
|
||||
public DelegateCommand iCustomCommand { get; private set; }
|
||||
|
||||
public DelegateCommand TimeCurrentCommand { get; private set; }
|
||||
|
||||
public DelegateCommand ChartOpenCommand { get; private set; }
|
||||
public DelegateCommand ChartTimePriceToXYCommand { get; private set; }
|
||||
public DelegateCommand ChartXYToTimePriceCommand { get; private set; }
|
||||
public DelegateCommand ChartApplyTemplateCommand { get; private set; }
|
||||
public DelegateCommand ChartSaveTemplateCommand { get; private set; }
|
||||
public DelegateCommand ChartIdCommand { get; private set; }
|
||||
public DelegateCommand ChartRedrawCommand { get; private set; }
|
||||
public DelegateCommand ChartWindowFindCommand { get; private set; }
|
||||
public DelegateCommand ChartCloseCommand { get; private set; }
|
||||
public DelegateCommand ChartPeriodCommand { get; private set; }
|
||||
public DelegateCommand ChartSetDoubleCommand { get; private set; }
|
||||
public DelegateCommand ChartSetIntegerCommand { get; private set; }
|
||||
public DelegateCommand ChartSetStringCommand { get; private set; }
|
||||
public DelegateCommand ChartGetDoubleCommand { get; private set; }
|
||||
public DelegateCommand ChartGetIntegerCommand { get; private set; }
|
||||
public DelegateCommand ChartNavigateCommand { get; private set; }
|
||||
public DelegateCommand ChartIndicatorAddCommand { get; private set; }
|
||||
public DelegateCommand ChartIndicatorDeleteCommand { get; private set; }
|
||||
public DelegateCommand ChartIndicatorGetCommand { get; private set; }
|
||||
public DelegateCommand ChartIndicatorNameCommand { get; private set; }
|
||||
public DelegateCommand ChartIndicatorsTotalCommand { get; private set; }
|
||||
public DelegateCommand ChartWindowOnDroppedCommand { get; private set; }
|
||||
public DelegateCommand ChartPriceOnDroppedCommand { get; private set; }
|
||||
public DelegateCommand ChartTimeOnDroppedCommand { get; private set; }
|
||||
public DelegateCommand ChartXOnDroppedCommand { get; private set; }
|
||||
public DelegateCommand ChartYOnDroppedCommand { get; private set; }
|
||||
public DelegateCommand ChartSetSymbolPeriodCommand { get; private set; }
|
||||
public DelegateCommand ChartScreenShotCommand { get; private set; }
|
||||
|
||||
public DelegateCommand TimeTradeServerCommand { get; private set; }
|
||||
public DelegateCommand TimeLocalCommand { get; private set; }
|
||||
public DelegateCommand TimeGMTCommand { get; private set; }
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
@@ -133,6 +188,11 @@ namespace MtApi5TestClient
|
||||
public ENUM_ACCOUNT_INFO_INTEGER AccountInfoIntegerPropertyId { get; set; }
|
||||
public ENUM_ACCOUNT_INFO_STRING AccountInfoStringPropertyId { get; set; }
|
||||
|
||||
public ENUM_TERMINAL_INFO_DOUBLE TerminalInfoDoublePropertyId { get; set; }
|
||||
public ENUM_TERMINAL_INFO_INTEGER TerminalInfoIntegerPropertyId { get; set; }
|
||||
public ENUM_TERMINAL_INFO_STRING TerminalInfoStringPropertyId { get; set; }
|
||||
|
||||
|
||||
public TimeSeriesValueViewModel TimeSeriesValues { get; set; }
|
||||
|
||||
public ObservableCollection<string> TimeSeriesResults { get; } = new ObservableCollection<string>();
|
||||
@@ -148,6 +208,27 @@ namespace MtApi5TestClient
|
||||
}
|
||||
}
|
||||
|
||||
private string _chartFunctionsSymbolValue = "EURUSD";
|
||||
public string ChartFunctionsSymbolValue
|
||||
{
|
||||
get { return _chartFunctionsSymbolValue; }
|
||||
set
|
||||
{
|
||||
_chartFunctionsSymbolValue = value;
|
||||
OnPropertyChanged("ChartFunctionsSymbolValue");
|
||||
}
|
||||
}
|
||||
|
||||
private long _chartFunctionsChartIdValue;
|
||||
public long ChartFunctionsChartIdValue
|
||||
{
|
||||
get { return _chartFunctionsChartIdValue; }
|
||||
set
|
||||
{
|
||||
_chartFunctionsChartIdValue = value;
|
||||
OnPropertyChanged("ChartFunctionsChartIdValue");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -160,8 +241,9 @@ namespace MtApi5TestClient
|
||||
_mtApiClient.QuoteAdded += mMtApiClient_QuoteAdded;
|
||||
_mtApiClient.QuoteRemoved += mMtApiClient_QuoteRemoved;
|
||||
_mtApiClient.QuoteUpdated += mMtApiClient_QuoteUpdated;
|
||||
|
||||
_quotesMap = new Dictionary<string, QuoteViewModel>();
|
||||
_mtApiClient.QuoteUpdate += mMtApiClient_QuoteUpdate;
|
||||
_mtApiClient.OnTradeTransaction += mMtApiClient_OnTradeTransaction;
|
||||
_mtApiClient.OnBookEvent += _mtApiClient_OnBookEvent;
|
||||
|
||||
ConnectionState = _mtApiClient.ConnectionState;
|
||||
ConnectionMessage = "Disconnected";
|
||||
@@ -196,20 +278,31 @@ namespace MtApi5TestClient
|
||||
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
|
||||
|
||||
OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
|
||||
OrderCheckCommand = new DelegateCommand(ExecuteOrderCheck);
|
||||
PositionGetTicketCommand = new DelegateCommand(ExecutePositionGetTicket);
|
||||
|
||||
HistoryOrderGetIntegerCommand = new DelegateCommand(ExecuteHistoryOrderGetInteger);
|
||||
HistoryDealGetDoubleCommand = new DelegateCommand(ExecuteHistoryDealGetDouble);
|
||||
HistoryDealGetIntegerCommand = new DelegateCommand(ExecuteHistoryDealGetInteger);
|
||||
HistoryDealGetStringCommand = new DelegateCommand(ExecuteHistoryDealGetString);
|
||||
HistoryDealMethodsCommand = new DelegateCommand(ExecuteHistoryDealMethods);
|
||||
|
||||
AccountInfoDoubleCommand = new DelegateCommand(ExecuteAccountInfoDouble);
|
||||
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
|
||||
AccountInfoStringCommand = new DelegateCommand(ExecuteAccountInfoString);
|
||||
|
||||
TerminalInfoDoubleCommand = new DelegateCommand(ExecuteTerminalInfoDouble);
|
||||
TerminalInfoIntegerCommand = new DelegateCommand(ExecuteTerminalInfoInteger);
|
||||
TerminalInfoStringCommand = new DelegateCommand(ExecuteTerminalInfoString);
|
||||
|
||||
CopyRatesCommand = new DelegateCommand(ExecuteCopyRates);
|
||||
CopyTimesCommand = new DelegateCommand(ExecuteCopyTime);
|
||||
CopyOpenCommand = new DelegateCommand(ExecuteCopyOpen);
|
||||
CopyHighCommand = new DelegateCommand(ExecuteCopyHigh);
|
||||
CopyLowCommand = new DelegateCommand(ExecuteCopyLow);
|
||||
CopyCloseCommand = new DelegateCommand(ExecuteCopyClose);
|
||||
IndicatorCreateCommand = new DelegateCommand(ExecuteIndicatorCreate);
|
||||
IndicatorReleaseCommand = new DelegateCommand(ExecuteIndicatorRelease);
|
||||
|
||||
CopyTickVolumeCommand = new DelegateCommand(ExecuteCopyTickVolume);
|
||||
CopyRealVolumeCommand = new DelegateCommand(ExecuteCopyRealVolume);
|
||||
@@ -223,6 +316,7 @@ namespace MtApi5TestClient
|
||||
SymbolInfoDoubleCommand = new DelegateCommand(ExecuteSymbolInfoDouble);
|
||||
SymbolInfoIntegerCommand = new DelegateCommand(ExecuteSymbolInfoInteger);
|
||||
SymbolInfoStringCommand = new DelegateCommand(ExecuteSymbolInfoString);
|
||||
SymbolInfoString2Command = new DelegateCommand(ExecuteSymbolInfoString2);
|
||||
SymbolInfoTickCommand = new DelegateCommand(ExecuteSymbolInfoTick);
|
||||
SymbolInfoSessionQuoteCommand = new DelegateCommand(ExecuteSymbolInfoSessionQuote);
|
||||
SymbolInfoSessionTradeCommand = new DelegateCommand(ExecuteSymbolInfoSessionTrade);
|
||||
@@ -233,6 +327,45 @@ namespace MtApi5TestClient
|
||||
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
|
||||
|
||||
PrintCommand = new DelegateCommand(ExecutePrint);
|
||||
AlertCommand = new DelegateCommand(ExecuteAlert);
|
||||
GetLastErrorCommand = new DelegateCommand(ExecuteGetLastError);
|
||||
ResetLastErrorCommand = new DelegateCommand(ExecuteResetLastError);
|
||||
|
||||
iCustomCommand = new DelegateCommand(ExecuteICustom);
|
||||
|
||||
ChartOpenCommand = new DelegateCommand(ExecuteChartOpen);
|
||||
ChartTimePriceToXYCommand = new DelegateCommand(ExecuteChartTimePriceToXY);
|
||||
ChartXYToTimePriceCommand = new DelegateCommand(ExecuteChartXYToTimePrice);
|
||||
ChartApplyTemplateCommand = new DelegateCommand(ExecuteChartApplyTemplate);
|
||||
ChartSaveTemplateCommand = new DelegateCommand(ExecuteChartSaveTemplate);
|
||||
ChartIdCommand = new DelegateCommand(ExecuteChartId);
|
||||
ChartRedrawCommand = new DelegateCommand(ExecuteChartRedraw);
|
||||
ChartWindowFindCommand = new DelegateCommand(ExecuteChartWindowFind);
|
||||
ChartCloseCommand = new DelegateCommand(ExecuteChartClose);
|
||||
ChartPeriodCommand = new DelegateCommand(ExecuteChartPeriod);
|
||||
ChartSetDoubleCommand = new DelegateCommand(ExecuteChartSetDouble);
|
||||
ChartSetIntegerCommand = new DelegateCommand(ExecuteChartSetInteger);
|
||||
ChartSetStringCommand = new DelegateCommand(ExecuteChartSetString);
|
||||
ChartGetDoubleCommand = new DelegateCommand(ExecuteChartGetDouble);
|
||||
ChartGetIntegerCommand = new DelegateCommand(ExecuteChartGetInteger);
|
||||
ChartNavigateCommand = new DelegateCommand(ExecuteChartNavigate);
|
||||
ChartIndicatorAddCommand = new DelegateCommand(ExecuteChartIndicatorAdd);
|
||||
ChartIndicatorDeleteCommand = new DelegateCommand(ExecuteChartIndicatorDelete);
|
||||
ChartIndicatorGetCommand = new DelegateCommand(ExecuteChartIndicatorGet);
|
||||
ChartIndicatorNameCommand = new DelegateCommand(ExecuteChartIndicatorName);
|
||||
ChartIndicatorsTotalCommand = new DelegateCommand(ExecuteChartIndicatorsTotal);
|
||||
ChartWindowOnDroppedCommand = new DelegateCommand(ExecuteChartWindowOnDropped);
|
||||
ChartPriceOnDroppedCommand = new DelegateCommand(ExecuteChartPriceOnDropped);
|
||||
ChartTimeOnDroppedCommand = new DelegateCommand(ExecuteChartTimeOnDropped);
|
||||
ChartXOnDroppedCommand = new DelegateCommand(ExecuteChartXOnDropped);
|
||||
ChartYOnDroppedCommand = new DelegateCommand(ExecuteChartYOnDropped);
|
||||
ChartSetSymbolPeriodCommand = new DelegateCommand(ExecuteChartSetSymbolPeriod);
|
||||
ChartScreenShotCommand = new DelegateCommand(ExecuteChartScreenShot);
|
||||
|
||||
TimeCurrentCommand = new DelegateCommand(ExecuteTimeCurrent);
|
||||
TimeTradeServerCommand = new DelegateCommand(ExecuteTimeTradeServer);
|
||||
TimeLocalCommand = new DelegateCommand(ExecuteTimeLocal);
|
||||
TimeGMTCommand = new DelegateCommand(ExecuteTimeGMT);
|
||||
}
|
||||
|
||||
private bool CanExecuteConnect(object o)
|
||||
@@ -265,18 +398,55 @@ namespace MtApi5TestClient
|
||||
private async void ExecuteOrderSend(object o)
|
||||
{
|
||||
var request = TradeRequest.GetMqlTradeRequest();
|
||||
|
||||
MqlTradeResult result = null;
|
||||
var retVal = await Execute(() =>
|
||||
{
|
||||
MqlTradeResult result;
|
||||
var ok = _mtApiClient.OrderSend(request, out result);
|
||||
return ok ? result : null;
|
||||
return ok;
|
||||
});
|
||||
|
||||
var message = retVal != null ? $"OrderSend successed. {MqlTradeResultToString(retVal)}" : "OrderSend failed.";
|
||||
var message = retVal ? $"OrderSend: success. {result}" : $"OrderSend: fail. {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
|
||||
private async void ExecuteOrderCheck(object obj)
|
||||
{
|
||||
var request = TradeRequest.GetMqlTradeRequest();
|
||||
MqlTradeCheckResult result = null;
|
||||
var retVal = await Execute(() =>
|
||||
{
|
||||
var ok = _mtApiClient.OrderCheck(request, out result);
|
||||
return ok;
|
||||
});
|
||||
|
||||
var message = retVal ? $"OrderCheck: success. {result}" : $"OrderCheck: fail. {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecutePositionGetTicket(object obj)
|
||||
{
|
||||
const int index = 0;
|
||||
var retVal = await Execute(() =>
|
||||
{
|
||||
var ok = _mtApiClient.PositionGetTicket(index);
|
||||
return ok;
|
||||
});
|
||||
|
||||
var message = $"PositionGetTicket: result = {retVal}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryOrderGetInteger(object o)
|
||||
{
|
||||
const ulong ticket = 12345;
|
||||
const ENUM_ORDER_PROPERTY_INTEGER propertyId = ENUM_ORDER_PROPERTY_INTEGER.ORDER_POSITION_ID;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.HistoryOrderGetInteger(ticket, propertyId));
|
||||
|
||||
AddLog($"HistoryOrderGetInteger: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryDealGetDouble(object o)
|
||||
{
|
||||
const ulong ticket = 12345;
|
||||
@@ -307,6 +477,25 @@ namespace MtApi5TestClient
|
||||
AddLog($"HistoryDealGetString: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryDealMethods(object o)
|
||||
{
|
||||
try
|
||||
{
|
||||
var posId = await Execute(() => _mtApiClient.PositionGetInteger(ENUM_POSITION_PROPERTY_INTEGER.POSITION_IDENTIFIER));
|
||||
var history = await Execute(() => _mtApiClient.HistorySelectByPosition(posId));
|
||||
var historyDealsTotal = await Execute(() => _mtApiClient.HistoryDealsTotal());
|
||||
var histDealTicket = await Execute(() => _mtApiClient.HistoryDealGetTicket(0));
|
||||
var histDealPrice = await Execute(() => _mtApiClient.HistoryDealGetDouble(histDealTicket, ENUM_DEAL_PROPERTY_DOUBLE.DEAL_PRICE));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog(ex.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog("ExecuteHistoryDealMethods: success.");
|
||||
}
|
||||
|
||||
private async void ExecuteAccountInfoDouble(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.AccountInfoDouble(AccountInfoDoublePropertyId));
|
||||
@@ -319,7 +508,7 @@ namespace MtApi5TestClient
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.AccountInfoInteger(AccountInfoIntegerPropertyId));
|
||||
|
||||
var message = $"AccountInfoInteger: property_id = {AccountInfoDoublePropertyId}; result = {result}";
|
||||
var message = $"AccountInfoInteger: property_id = {AccountInfoIntegerPropertyId}; result = {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
@@ -327,10 +516,35 @@ namespace MtApi5TestClient
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.AccountInfoString(AccountInfoStringPropertyId));
|
||||
|
||||
var message = $"AccountInfoString: property_id = {AccountInfoDoublePropertyId}; result = {result}";
|
||||
var message = $"AccountInfoString: property_id = {AccountInfoStringPropertyId}; result = {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecuteTerminalInfoDouble(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.TerminalInfoDouble(TerminalInfoDoublePropertyId));
|
||||
|
||||
var message = $"TerminalInfoDouble: property_id = {TerminalInfoDoublePropertyId}; result = {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecuteTerminalInfoInteger(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.TerminalInfoInteger(TerminalInfoIntegerPropertyId));
|
||||
|
||||
var message = $"TerminalInfoInteger: property_id = {TerminalInfoIntegerPropertyId}; result = {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecuteTerminalInfoString(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.TerminalInfoString(TerminalInfoStringPropertyId));
|
||||
|
||||
var message = $"TerminalInfoString: property_id = {TerminalInfoStringPropertyId}; result = {result}";
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
|
||||
private async void ExecuteCopyTime(object o)
|
||||
{
|
||||
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
||||
@@ -482,6 +696,48 @@ namespace MtApi5TestClient
|
||||
AddLog("CopyClose: success");
|
||||
}
|
||||
|
||||
private async void ExecuteIndicatorCreate(object o)
|
||||
{
|
||||
var parameters = new List<MqlParam>
|
||||
{
|
||||
new MqlParam
|
||||
{
|
||||
DataType = ENUM_DATATYPE.TYPE_INT,
|
||||
IntegerValue = 12
|
||||
},
|
||||
new MqlParam
|
||||
{
|
||||
DataType = ENUM_DATATYPE.TYPE_INT,
|
||||
IntegerValue = 26
|
||||
},
|
||||
new MqlParam
|
||||
{
|
||||
DataType = ENUM_DATATYPE.TYPE_INT,
|
||||
IntegerValue = 9
|
||||
},
|
||||
new MqlParam
|
||||
{
|
||||
DataType = ENUM_DATATYPE.TYPE_INT,
|
||||
IntegerValue = (int)ENUM_APPLIED_PRICE.PRICE_CLOSE
|
||||
}
|
||||
};
|
||||
|
||||
var retVal = await Execute(() =>
|
||||
_mtApiClient.IndicatorCreate(TimeSeriesValues.SymbolValue,
|
||||
TimeSeriesValues.TimeFrame, TimeSeriesValues.IndicatorType, parameters));
|
||||
|
||||
TimeSeriesValues.IndicatorHandle = retVal;
|
||||
AddLog($"IndicatorCreate [IND_MA]: result - {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteIndicatorRelease(object o)
|
||||
{
|
||||
var indicatorHandle = TimeSeriesValues.IndicatorHandle;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.IndicatorRelease(indicatorHandle));
|
||||
AddLog($"IndicatorRelease [{indicatorHandle}]: result - {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteCopyRates(object o)
|
||||
{
|
||||
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
||||
@@ -684,6 +940,14 @@ namespace MtApi5TestClient
|
||||
AddLog($"SymbolInfoString(EURUSD, ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION): result = {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteSymbolInfoString2(object o)
|
||||
{
|
||||
string stringVar = null;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.SymbolInfoString("EURUSD", ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION, out stringVar));
|
||||
AddLog($"SymbolInfoString-2 (EURUSD, ENUM_SYMBOL_INFO_STRING.SYMBOL_DESCRIPTION): result = {retVal}, stringVar = {stringVar}");
|
||||
}
|
||||
|
||||
private async void ExecuteSymbolInfoTick(object o)
|
||||
{
|
||||
var result = await Execute(() =>
|
||||
@@ -741,14 +1005,14 @@ namespace MtApi5TestClient
|
||||
|
||||
private async void ExecuteMarketBookAdd(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.MarketBookAdd("CHFJPY"));
|
||||
AddLog($"MarketBookAdd(CHFJPY): result = {retVal}");
|
||||
var retVal = await Execute(() => _mtApiClient.MarketBookAdd("EURUSD"));
|
||||
AddLog($"MarketBookAdd(EURUSD): result = {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteMarketBookRelease(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.MarketBookRelease("CHFJPY"));
|
||||
AddLog($"MarketBookRelease(CHFJPY): result = {retVal}");
|
||||
var retVal = await Execute(() => _mtApiClient.MarketBookRelease("EURUSD"));
|
||||
AddLog($"MarketBookRelease(EURUSD): result = {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteMarketBookGet(object o)
|
||||
@@ -766,13 +1030,11 @@ namespace MtApi5TestClient
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog("MarketBookGet(EURUSD): success");
|
||||
AddLog($"MarketBookGet(EURUSD): success. Count = {result.Length}");
|
||||
|
||||
for (var i = 0; i < result.Length; i++)
|
||||
{
|
||||
AddLog($"MarketBookGet: book[{i}].price = {result[i].price}");
|
||||
AddLog($"MarketBookGet: book[{i}].price = {result[i].volume}");
|
||||
AddLog($"MarketBookGet: book[{i}].price = {result[i].type}");
|
||||
AddLog($"MarketBookGet: [{i}] - {result[i].price} | {result[i].volume} | {result[i].type}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -799,6 +1061,362 @@ namespace MtApi5TestClient
|
||||
AddLog($"Print: message print in MetaTrader - {retVal}");
|
||||
}
|
||||
|
||||
private void ExecuteAlert(object obj)
|
||||
{
|
||||
var message = MessageText;
|
||||
|
||||
_mtApiClient.Alert(message);
|
||||
AddLog($"Alert: send alert to MetaTrader - {message}.");
|
||||
}
|
||||
|
||||
private async void ExecuteGetLastError(object obj)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.GetLastError());
|
||||
AddLog($"GetLastError: last error = {retVal}");
|
||||
}
|
||||
|
||||
private void ExecuteResetLastError(object obj)
|
||||
{
|
||||
_mtApiClient.ResetLastError();
|
||||
AddLog("ResetLastError: executed.");
|
||||
}
|
||||
|
||||
private async void ExecuteICustom(object o)
|
||||
{
|
||||
const string symbol = "EURUSD";
|
||||
const ENUM_TIMEFRAMES timeframe = ENUM_TIMEFRAMES.PERIOD_H1;
|
||||
const string name = @"Examples\Custom Moving Average";
|
||||
int[] parameters = { 0, 21, (int)ENUM_APPLIED_PRICE.PRICE_CLOSE };
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.iCustom(symbol, timeframe, name, parameters));
|
||||
AddLog($"Custom Moving Average: result - {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteTimeCurrent(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.TimeCurrent());
|
||||
AddLog($"TimeCurrent: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteTimeTradeServer(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.TimeTradeServer());
|
||||
AddLog($"TimeTradeServer: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteTimeLocal(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.TimeLocal());
|
||||
AddLog($"TimeLocal: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteTimeGMT(object o)
|
||||
{
|
||||
var retVal = await Execute(() => _mtApiClient.TimeGMT());
|
||||
AddLog($"TimeGMT: {retVal}");
|
||||
}
|
||||
|
||||
#region Chart Commands
|
||||
private async void ExecuteChartOpen(object o)
|
||||
{
|
||||
AddLog("Executed #1");
|
||||
if (string.IsNullOrEmpty(ChartFunctionsSymbolValue))
|
||||
{
|
||||
AddLog("ChartOpen [ERROR]: Symbol is not defined!");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"Executed #2 s:{ChartFunctionsSymbolValue}");
|
||||
|
||||
|
||||
var result = await Execute(() =>
|
||||
{
|
||||
var SymbolAddReturn = _mtApiClient.SymbolSelect(ChartFunctionsSymbolValue, true);
|
||||
var ChartId = _mtApiClient.ChartOpen(ChartFunctionsSymbolValue, TimeSeriesValues.TimeFrame);
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
AddLog("ChartOpen: result is null");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ChartOpen: success chartid=>{result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartTimePriceToXY(object o)
|
||||
{
|
||||
const long chartId = 0;
|
||||
const int subWindow = 0;
|
||||
var time = DateTime.Now;
|
||||
const double price = 1.131;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
|
||||
var result = await Execute(() => _mtApiClient.ChartTimePriceToXY(chartId, subWindow, time, price, out x, out y));
|
||||
if (result == false)
|
||||
{
|
||||
AddLog("ChartTimePriceToXY: result is false");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ChartTimePriceToXY: success. x = {x}; Y = {y}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartXYToTimePrice(object o)
|
||||
{
|
||||
const long chartId = 0;
|
||||
const int x = 0;
|
||||
const int y = 0;
|
||||
|
||||
var subWindow = 0;
|
||||
DateTime? time = null;
|
||||
double price = double.NaN;
|
||||
|
||||
var result = await Execute(() => _mtApiClient.ChartXYToTimePrice(chartId, x, y, out subWindow, out time, out price));
|
||||
if (result == false)
|
||||
{
|
||||
AddLog("ChartXYToTimePrice: result is false");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ChartXYToTimePrice: success. subWindow = {subWindow}; time = {time}; price = {price}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartApplyTemplate(object o)
|
||||
{
|
||||
if (string.IsNullOrEmpty(TimeSeriesValues?.SymbolValue)) return;
|
||||
|
||||
AddLog($"ExecuteChartApplyTemplate #2 s:{TimeSeriesValues?.SymbolValue}");
|
||||
|
||||
|
||||
var result = await Execute(() =>
|
||||
{
|
||||
var SymbolAddReturn = _mtApiClient.SymbolSelect(TimeSeriesValues?.SymbolValue, true);
|
||||
var ChartId = _mtApiClient.ChartOpen(TimeSeriesValues?.SymbolValue, TimeSeriesValues.TimeFrame);
|
||||
|
||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_DATA_PATH);
|
||||
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "Template File (*.tpl)|*.tpl|All files (*.*)|*.*";
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
var TemplateName = "\\Files\\mt5api_copy.tpl";
|
||||
var TemplateStringContent = File.ReadAllLines(openFileDialog.FileName);
|
||||
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
||||
File.WriteAllLines($"{MT5Path}\\MQL5{TemplateName}", TemplateStringContent);
|
||||
_mtApiClient.ChartApplyTemplate(ChartId, TemplateName);
|
||||
}
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
AddLog("ExecuteChartApplyTemplate: result is null");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ExecuteChartApplyTemplate: success chartid=>{result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSaveTemplate(object o)
|
||||
{
|
||||
|
||||
AddLog("ExecuteSaveApplyTemplate #1");
|
||||
|
||||
|
||||
var result = await Execute(() =>
|
||||
{
|
||||
|
||||
var MT5Path = _mtApiClient.TerminalInfoString(ENUM_TERMINAL_INFO_STRING.TERMINAL_DATA_PATH);
|
||||
int ChartId = 0; // Actual Chart
|
||||
var TemplateName = "\\Files\\exported.tpl";
|
||||
_mtApiClient.ChartSaveTemplate(ChartId, TemplateName);
|
||||
var DestPath = $"{MT5Path}\\MQL5{TemplateName}";
|
||||
AddLog($"Destination: {TemplateName}");
|
||||
return ChartId;
|
||||
});
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
AddLog("ChartOpen: result is null");
|
||||
return;
|
||||
}
|
||||
|
||||
AddLog($"ChartOpen: success chartid=>{result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartId(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartId());
|
||||
RunOnUiThread(() =>
|
||||
{
|
||||
ChartFunctionsChartIdValue = result;
|
||||
});
|
||||
AddLog($"ChartId: chartid = {result}");
|
||||
}
|
||||
|
||||
private void ExecuteChartRedraw(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
_mtApiClient.ChartRedraw(chartId);
|
||||
AddLog($"ChartRedraw: executed for chartid = {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartWindowFind(object o)
|
||||
{
|
||||
const string shortname = "MACD(12,26,9)";
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartWindowFind(chartId, shortname));
|
||||
AddLog($"ChartRedraw: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartClose(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartClose(chartId));
|
||||
AddLog($"ChartClose: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartPeriod(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartPeriod(chartId));
|
||||
AddLog($"ChartPeriod: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSetDouble(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartSetDouble(chartId, ENUM_CHART_PROPERTY_DOUBLE.CHART_PRICE_MAX, 1.13));
|
||||
AddLog($"ChartSetDouble: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSetInteger(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartSetInteger(chartId, ENUM_CHART_PROPERTY_INTEGER.CHART_SHOW_GRID, 0));
|
||||
AddLog($"ChartSetInteger: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSetString(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartSetString(chartId, ENUM_CHART_PROPERTY_STRING.CHART_COMMENT, "This is test comment from MtApi5"));
|
||||
AddLog($"ChartSetString: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartGetDouble(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartGetDouble(chartId, ENUM_CHART_PROPERTY_DOUBLE.CHART_PRICE_MAX, 0));
|
||||
AddLog($"ChartGetDouble: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartGetInteger(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartGetInteger(chartId, ENUM_CHART_PROPERTY_INTEGER.CHART_VISIBLE_BARS, 0));
|
||||
AddLog($"ChartGetInteger: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartNavigate(object o)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartNavigate(chartId, ENUM_CHART_POSITION.CHART_BEGIN, 0));
|
||||
AddLog($"ChartNavigate: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartIndicatorAdd(object obj)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var symbol = ChartFunctionsSymbolValue;
|
||||
|
||||
var indicatorHandle = await Execute(() => _mtApiClient.iMACD(symbol, ENUM_TIMEFRAMES.PERIOD_CURRENT, 12, 26, 9, ENUM_APPLIED_PRICE.PRICE_CLOSE));
|
||||
var result = await Execute(() => _mtApiClient.ChartIndicatorAdd(chartId, 1, indicatorHandle));
|
||||
AddLog($"ChartIndicatorAdd: result {result} for chartid {chartId} with indicator {indicatorHandle}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartIndicatorDelete(object o)
|
||||
{
|
||||
const string shortname = "MACD(12,26,9)";
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartIndicatorDelete(chartId, 1, shortname));
|
||||
AddLog($"ChartIndicatorDelete: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartIndicatorGet(object obj)
|
||||
{
|
||||
const string shortname = "MACD(12,26,9)";
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartIndicatorGet(chartId, 1, shortname));
|
||||
AddLog($"hartIndicatorGet: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartIndicatorName(object obj)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartIndicatorName(chartId, 1, 0));
|
||||
AddLog($"ChartIndicatorName: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartIndicatorsTotal(object obj)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartIndicatorsTotal(chartId, 1));
|
||||
AddLog($"ChartIndicatorsTotal: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartWindowOnDropped(object obj)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartWindowOnDropped());
|
||||
AddLog($"ChartWindowOnDropped: result {result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartPriceOnDropped(object obj)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartPriceOnDropped());
|
||||
AddLog($"ChartPriceOnDropped: result {result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartTimeOnDropped(object obj)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartTimeOnDropped());
|
||||
AddLog($"ChartTimeOnDropped: result {result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartXOnDropped(object obj)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartXOnDropped());
|
||||
AddLog($"ChartXOnDropped: result {result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartYOnDropped(object obj)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.ChartYOnDropped());
|
||||
AddLog($"ChartYOnDropped: result {result}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartSetSymbolPeriod(object obj)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var symbol = ChartFunctionsSymbolValue;
|
||||
var result = await Execute(() => _mtApiClient.ChartSetSymbolPeriod(chartId, symbol, ENUM_TIMEFRAMES.PERIOD_M5));
|
||||
AddLog($"ChartSetSymbolPeriod: result {result} for chartid {chartId}");
|
||||
}
|
||||
|
||||
private async void ExecuteChartScreenShot(object obj)
|
||||
{
|
||||
var chartId = ChartFunctionsChartIdValue;
|
||||
var filename = "ChartScreenShot_TestMtApi.gif";
|
||||
const int width = 800;
|
||||
const int height = 600;
|
||||
var result = await Execute(() => _mtApiClient.ChartScreenShot(chartId, filename, width, height));
|
||||
AddLog($"ChartScreenShot: result {result} for chartid {chartId}. Filename {filename}");
|
||||
}
|
||||
#endregion
|
||||
|
||||
private static void RunOnUiThread(Action action)
|
||||
{
|
||||
Application.Current?.Dispatcher.Invoke(action);
|
||||
@@ -809,27 +1427,29 @@ namespace MtApi5TestClient
|
||||
Application.Current?.Dispatcher.Invoke(action, args);
|
||||
}
|
||||
|
||||
private void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||
private static void mMtApiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||
{
|
||||
if (string.IsNullOrEmpty(symbol) == false)
|
||||
{
|
||||
if (_quotesMap.ContainsKey(symbol))
|
||||
{
|
||||
var qvm = _quotesMap[symbol];
|
||||
qvm.Bid = bid;
|
||||
qvm.Ask = ask;
|
||||
}
|
||||
Console.WriteLine(@"Quote: Symbol = {0}, Bid = {1}, Ask = {2}", symbol, bid, ask);
|
||||
}
|
||||
|
||||
if (string.Equals(symbol, TradeRequest.Symbol))
|
||||
private void mMtApiClient_QuoteUpdate(object sender, Mt5QuoteEventArgs e)
|
||||
{
|
||||
if (_quotesMap.ContainsKey(e.Quote.ExpertHandle))
|
||||
{
|
||||
var qvm = _quotesMap[e.Quote.ExpertHandle];
|
||||
qvm.Bid = e.Quote.Bid;
|
||||
qvm.Ask = e.Quote.Ask;
|
||||
}
|
||||
|
||||
if (string.Equals(e.Quote.Instrument, TradeRequest.Symbol))
|
||||
{
|
||||
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
||||
{
|
||||
if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_BUY)
|
||||
{
|
||||
TradeRequest.Price = ask;
|
||||
}
|
||||
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
||||
{
|
||||
TradeRequest.Price = bid;
|
||||
}
|
||||
TradeRequest.Price = e.Quote.Ask;
|
||||
}
|
||||
else if (TradeRequest.Type == ENUM_ORDER_TYPE.ORDER_TYPE_SELL)
|
||||
{
|
||||
TradeRequest.Price = e.Quote.Bid;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -863,44 +1483,46 @@ namespace MtApi5TestClient
|
||||
}
|
||||
}
|
||||
|
||||
private void mMtApiClient_OnTradeTransaction(object sender, Mt5TradeTransactionEventArgs e)
|
||||
{
|
||||
AddLog($"OnTradeTransaction: ExpertHandle = {e.ExpertHandle}.{Environment.NewLine}Transaction = {e.Trans}.{Environment.NewLine}Request = {e.Request}.{Environment.NewLine}Result = {e.Result}.");
|
||||
}
|
||||
|
||||
private void _mtApiClient_OnBookEvent(object sender, Mt5BookEventArgs e)
|
||||
{
|
||||
AddLog($"OnBookEvent: ExpertHandle = {e.ExpertHandle}, Symbol = {e.Symbol}");
|
||||
}
|
||||
|
||||
private void AddQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null)
|
||||
if (_quotesMap.ContainsKey(quote.ExpertHandle))
|
||||
{
|
||||
AddLog($"AddQuote: Quote {quote.Instrument} with handle {quote.ExpertHandle} is present list. Skipped!");
|
||||
return;
|
||||
|
||||
QuoteViewModel qvm;
|
||||
|
||||
if (_quotesMap.ContainsKey(quote.Instrument) == false)
|
||||
{
|
||||
qvm = new QuoteViewModel(quote.Instrument);
|
||||
_quotesMap[quote.Instrument] = qvm;
|
||||
Quotes.Add(qvm);
|
||||
}
|
||||
else
|
||||
{
|
||||
qvm = _quotesMap[quote.Instrument];
|
||||
}
|
||||
|
||||
qvm.FeedCount++;
|
||||
qvm.Bid = quote.Bid;
|
||||
qvm.Ask = quote.Ask;
|
||||
var qvm = new QuoteViewModel(quote.Instrument)
|
||||
{
|
||||
ExpertHandle = quote.ExpertHandle,
|
||||
Bid = quote.Bid,
|
||||
Ask = quote.Ask
|
||||
};
|
||||
|
||||
_quotesMap[quote.ExpertHandle] = qvm;
|
||||
Quotes.Add(qvm);
|
||||
}
|
||||
|
||||
private void RemoveQuote(Mt5Quote quote)
|
||||
{
|
||||
if (quote == null) return;
|
||||
|
||||
if (_quotesMap.ContainsKey(quote.Instrument))
|
||||
if (_quotesMap.ContainsKey(quote.ExpertHandle) == false)
|
||||
{
|
||||
var qvm = _quotesMap[quote.Instrument];
|
||||
qvm.FeedCount--;
|
||||
|
||||
if (qvm.FeedCount <= 0)
|
||||
{
|
||||
_quotesMap.Remove(quote.Instrument);
|
||||
Quotes.Remove(qvm);
|
||||
}
|
||||
AddLog($"RemoveQuote: Quote {quote.Instrument} with handle {quote.ExpertHandle} is NOT present list. Skipped!");
|
||||
return;
|
||||
}
|
||||
|
||||
var qvm = _quotesMap[quote.ExpertHandle];
|
||||
_quotesMap.Remove(quote.ExpertHandle);
|
||||
Quotes.Remove(qvm);
|
||||
}
|
||||
|
||||
private void OnConnected()
|
||||
@@ -921,20 +1543,6 @@ namespace MtApi5TestClient
|
||||
Quotes.Clear();
|
||||
}
|
||||
|
||||
private static string MqlTradeResultToString(MqlTradeResult result)
|
||||
{
|
||||
return result != null ?
|
||||
"Retcode = " + result.Retcode + ";"
|
||||
+ " Comment = " + result.Comment + ";"
|
||||
+ " Order = " + result.Order + ";"
|
||||
+ " Volume = " + result.Volume + ";"
|
||||
+ " Price = " + result.Price + ";"
|
||||
+ " Deal = " + result.Deal + ";"
|
||||
+ " Request_id = " + result.Request_id + ";"
|
||||
+ " Bid = " + result.Bid + ";"
|
||||
+ " Ask = " + result.Ask + ";" : string.Empty;
|
||||
}
|
||||
|
||||
private void OnSelectedQuoteChanged()
|
||||
{
|
||||
if (SelectedQuote == null) return;
|
||||
@@ -952,6 +1560,10 @@ namespace MtApi5TestClient
|
||||
{
|
||||
result = func();
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
AddLog($"Exception: {ex.ErrorCode} - {ex.Message}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddLog($"Exception: {ex.Message}");
|
||||
@@ -961,6 +1573,7 @@ namespace MtApi5TestClient
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void AddLog(string msg)
|
||||
{
|
||||
RunOnUiThread(() =>
|
||||
@@ -983,7 +1596,7 @@ namespace MtApi5TestClient
|
||||
#region Private Fields
|
||||
private readonly MtApi5Client _mtApiClient;
|
||||
|
||||
private readonly Dictionary<string, QuoteViewModel> _quotesMap;
|
||||
private readonly Dictionary<int, QuoteViewModel> _quotesMap = new Dictionary<int, QuoteViewModel>();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+40
-2
@@ -143,6 +143,8 @@
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.textBoxAccountInfoSymbol = new System.Windows.Forms.TextBox();
|
||||
this.tabPage4 = new System.Windows.Forms.TabPage();
|
||||
this.comboBox12 = new System.Windows.Forms.ComboBox();
|
||||
this.button72 = new System.Windows.Forms.Button();
|
||||
this.button36 = new System.Windows.Forms.Button();
|
||||
this.comboBox10 = new System.Windows.Forms.ComboBox();
|
||||
this.comboBox9 = new System.Windows.Forms.ComboBox();
|
||||
@@ -210,6 +212,7 @@
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.tabPage11 = new System.Windows.Forms.TabPage();
|
||||
this.button69 = new System.Windows.Forms.Button();
|
||||
this.button73 = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -1427,6 +1430,8 @@
|
||||
//
|
||||
// tabPage4
|
||||
//
|
||||
this.tabPage4.Controls.Add(this.comboBox12);
|
||||
this.tabPage4.Controls.Add(this.button72);
|
||||
this.tabPage4.Controls.Add(this.button36);
|
||||
this.tabPage4.Controls.Add(this.comboBox10);
|
||||
this.tabPage4.Controls.Add(this.comboBox9);
|
||||
@@ -1450,6 +1455,25 @@
|
||||
this.tabPage4.Text = "MarketInfo";
|
||||
this.tabPage4.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBox12
|
||||
//
|
||||
this.comboBox12.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox12.FormattingEnabled = true;
|
||||
this.comboBox12.Location = new System.Drawing.Point(13, 188);
|
||||
this.comboBox12.Name = "comboBox12";
|
||||
this.comboBox12.Size = new System.Drawing.Size(186, 21);
|
||||
this.comboBox12.TabIndex = 38;
|
||||
//
|
||||
// button72
|
||||
//
|
||||
this.button72.Location = new System.Drawing.Point(208, 186);
|
||||
this.button72.Name = "button72";
|
||||
this.button72.Size = new System.Drawing.Size(111, 23);
|
||||
this.button72.TabIndex = 37;
|
||||
this.button72.Text = "TerminalInfoString";
|
||||
this.button72.UseVisualStyleBackColor = true;
|
||||
this.button72.Click += new System.EventHandler(this.button72_Click);
|
||||
//
|
||||
// button36
|
||||
//
|
||||
this.button36.Location = new System.Drawing.Point(208, 157);
|
||||
@@ -1844,6 +1868,7 @@
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
this.tabPage6.Controls.Add(this.button73);
|
||||
this.tabPage6.Controls.Add(this.textBoxPrint);
|
||||
this.tabPage6.Controls.Add(this.button27);
|
||||
this.tabPage6.Controls.Add(this.button14);
|
||||
@@ -1858,14 +1883,14 @@
|
||||
//
|
||||
// textBoxPrint
|
||||
//
|
||||
this.textBoxPrint.Location = new System.Drawing.Point(13, 86);
|
||||
this.textBoxPrint.Location = new System.Drawing.Point(13, 108);
|
||||
this.textBoxPrint.Name = "textBoxPrint";
|
||||
this.textBoxPrint.Size = new System.Drawing.Size(386, 20);
|
||||
this.textBoxPrint.TabIndex = 3;
|
||||
//
|
||||
// button27
|
||||
//
|
||||
this.button27.Location = new System.Drawing.Point(405, 84);
|
||||
this.button27.Location = new System.Drawing.Point(405, 106);
|
||||
this.button27.Name = "button27";
|
||||
this.button27.Size = new System.Drawing.Size(75, 23);
|
||||
this.button27.TabIndex = 2;
|
||||
@@ -2146,6 +2171,16 @@
|
||||
this.button69.UseVisualStyleBackColor = true;
|
||||
this.button69.Click += new System.EventHandler(this.button69_Click);
|
||||
//
|
||||
// button73
|
||||
//
|
||||
this.button73.Location = new System.Drawing.Point(13, 74);
|
||||
this.button73.Name = "button73";
|
||||
this.button73.Size = new System.Drawing.Size(75, 23);
|
||||
this.button73.TabIndex = 4;
|
||||
this.button73.Text = "TimeGMT";
|
||||
this.button73.UseVisualStyleBackColor = true;
|
||||
this.button73.Click += new System.EventHandler(this.button73_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -2379,6 +2414,9 @@
|
||||
private System.Windows.Forms.TextBox textBoxAccountLogin;
|
||||
private System.Windows.Forms.Button button70;
|
||||
private System.Windows.Forms.Button button71;
|
||||
private System.Windows.Forms.ComboBox comboBox12;
|
||||
private System.Windows.Forms.Button button72;
|
||||
private System.Windows.Forms.Button button73;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ namespace TestApiClientUI
|
||||
comboBox9.DataSource = Enum.GetNames(typeof(EnumTerminalInfoInteger));
|
||||
comboBox10.DataSource = Enum.GetNames(typeof(EnumTerminalInfoDouble));
|
||||
comboBox11.DataSource = Enum.GetNames(typeof(EnumObject));
|
||||
comboBox12.DataSource = Enum.GetNames(typeof(ENUM_TERMINAL_INFO_STRING));
|
||||
comboBoxAccountInfoCmd.DataSource = Enum.GetNames(typeof(TradeOperation));
|
||||
|
||||
_apiClient.QuoteUpdated += apiClient_QuoteUpdated;
|
||||
@@ -615,18 +616,28 @@ namespace TestApiClientUI
|
||||
listBoxProceHistory.DataSource = items;
|
||||
}
|
||||
|
||||
//TimeCurrent
|
||||
private void button13_Click(object sender, EventArgs e)
|
||||
{
|
||||
var retVal = _apiClient.TimeCurrent();
|
||||
PrintLog($"TimeCurrent result: {retVal}");
|
||||
}
|
||||
|
||||
//TimeLocal
|
||||
private void button14_Click(object sender, EventArgs e)
|
||||
{
|
||||
var retVal = _apiClient.TimeLocal();
|
||||
PrintLog($"TimeLocal result: {retVal}");
|
||||
}
|
||||
|
||||
//TimeGMT
|
||||
private void button73_Click(object sender, EventArgs e)
|
||||
{
|
||||
var retVal = _apiClient.TimeGMT();
|
||||
PrintLog($"TimeGMT result: {retVal}");
|
||||
}
|
||||
|
||||
//RefreshRates
|
||||
private void buttonRefreshRates_Click(object sender, EventArgs e)
|
||||
{
|
||||
var retVal = _apiClient.RefreshRates();
|
||||
@@ -1129,6 +1140,16 @@ namespace TestApiClientUI
|
||||
PrintLog($"TerminalInfoDouble: result = {result}");
|
||||
}
|
||||
|
||||
//TerminalInfoString
|
||||
private async void button72_Click(object sender, EventArgs e)
|
||||
{
|
||||
ENUM_TERMINAL_INFO_STRING propId;
|
||||
Enum.TryParse(comboBox12.Text, out propId);
|
||||
|
||||
var result = await Execute(() => _apiClient.TerminalInfoString(propId));
|
||||
PrintLog($"TerminalInfoString: result = {result}");
|
||||
}
|
||||
|
||||
private void checkBox2_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
var checkbox = sender as CheckBox;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
+1525
-72
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -257,7 +257,7 @@ public:
|
||||
{
|
||||
return (string)_long;
|
||||
} else {
|
||||
return (string)_dbl;
|
||||
return (_dbl!=0) ? (string)_dbl : "0";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user