mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 36c90c8481 | |||
| fefa451371 | |||
| 1c57f88cb1 | |||
| 08ba45c65f | |||
| b8314e9ed7 | |||
| 9587b10c8c | |||
| b838084ba2 | |||
| cd24891022 | |||
| add69a4c03 | |||
| 5a3407e47c | |||
| ce8cfbbb70 | |||
| 8470bbd5cc | |||
| 5c7ae748a5 | |||
| 7abb4d3b5e | |||
| 486c42685a | |||
| f41ab37b6f | |||
| 9e129fb6e2 | |||
| f7b00a8d88 | |||
| a7cb14de25 | |||
| f50925c8d3 | |||
| e29a11de68 | |||
| 12141775f3 | |||
| b6d24b8aa9 | |||
| 7175fae18c | |||
| 3c4d8d52ca | |||
| 6873363d41 | |||
| 947599327a | |||
| 5645902a48 | |||
| c82787473f | |||
| c213fb709a | |||
| 2ac29dc871 | |||
| 1f72b2b790 | |||
| 3a62ff56d7 | |||
| d25fe529b4 | |||
| 15538e81f4 | |||
| a33be3c764 | |||
| 023fe8c7c9 | |||
| b77516e324 | |||
| 4b48423c3f | |||
| 9800177b08 | |||
| a33d4a4594 | |||
| 29722f362d | |||
| e072343fe1 | |||
| acb0c20ca8 | |||
| 83543fee88 | |||
| 3ce6b042de | |||
| 9dd770e768 | |||
| abb8b8afaa | |||
| 1d6569caa8 | |||
| 441a3cb8de | |||
| 443f5c982c | |||
| 515a12ab15 | |||
| 84b00b605a | |||
| 10e267d031 | |||
| abcd489367 | |||
| d630e61e3c | |||
| 280bab7faf | |||
| 26d270422b | |||
| 9cd2e3b18f | |||
| 50013c0c29 | |||
| ca49d23017 | |||
| 0346836d35 | |||
| 2cc41df01a | |||
| f05ade2cbf | |||
| d34524d77f | |||
| d06cc67a5d |
@@ -35,6 +35,4 @@ using namespace System::Security::Permissions;
|
||||
|
||||
[assembly:ComVisible(false)];
|
||||
|
||||
[assembly:CLSCompliantAttribute(true)];
|
||||
|
||||
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
|
||||
[assembly:CLSCompliantAttribute(true)];
|
||||
+149
-344
@@ -6,14 +6,15 @@
|
||||
#include "MT5Handler.h"
|
||||
|
||||
#include "Windows.h"
|
||||
#include < vcclr.h >
|
||||
#include <vcclr.h>
|
||||
#include <functional>
|
||||
|
||||
using namespace System;
|
||||
using namespace MTApiService;
|
||||
using namespace System::Runtime::InteropServices;
|
||||
using namespace System::Reflection;
|
||||
using namespace System::Text;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Collections::Generic;
|
||||
using namespace System::Diagnostics;
|
||||
using namespace System::Security::Cryptography;
|
||||
using namespace System::Security;
|
||||
@@ -50,277 +51,154 @@ public struct CMqlBookInfo
|
||||
|
||||
void convertSystemString(wchar_t* dest, String^ src)
|
||||
{
|
||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||
memcpy(dest, wch, wcslen(wch) * sizeof(wchar_t));
|
||||
dest[wcslen(wch)] = '\0';
|
||||
if (src != nullptr) {
|
||||
pin_ptr<const wchar_t> wch = PtrToStringChars(src);
|
||||
memcpy(dest, wch, wcsnlen(wch, 1000) * sizeof(wchar_t));
|
||||
dest[wcsnlen(wch, 1000)] = L'\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
dest[0] = L'\0';
|
||||
}
|
||||
}
|
||||
|
||||
bool VerifySignature(System::String^ inputData, System::String^ signature, System::String^ publicKey)
|
||||
{
|
||||
bool verifyResult = false;
|
||||
#define _DLLAPI extern "C" __declspec(dllexport)
|
||||
|
||||
template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default_value)
|
||||
{
|
||||
T result = default_value;
|
||||
try
|
||||
{
|
||||
DSACryptoServiceProvider^ dsa = gcnew DSACryptoServiceProvider();
|
||||
dsa->FromXmlString(publicKey);
|
||||
array<System::Byte>^ data = UTF8Encoding::ASCII->GetBytes(inputData);
|
||||
array<System::Byte>^ signatureData = Convert::FromBase64String(signature);
|
||||
verifyResult = dsa->VerifyData(data, signatureData);
|
||||
}
|
||||
catch(Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:VerifySignature(): failed. " + e->Message);
|
||||
verifyResult = false;
|
||||
}
|
||||
|
||||
return verifyResult;
|
||||
}
|
||||
|
||||
bool g_IsVerified = true;
|
||||
|
||||
void _stdcall verify(int isDemo, wchar_t* accountName, long accountNumber)
|
||||
{
|
||||
if (isDemo != 0)
|
||||
{
|
||||
g_IsVerified = true;
|
||||
return;
|
||||
}
|
||||
|
||||
System::String^ signature = MtRegistryManager::ReadSignatureKey(gcnew String(accountName), accountNumber.ToString());
|
||||
Resources::ResourceManager^ rm = gcnew Resources::ResourceManager(L"MT5Connector.cl", Assembly::GetExecutingAssembly());
|
||||
System::String^ inputData = gcnew System::String(accountName);
|
||||
inputData += accountNumber.ToString();
|
||||
System::String^ publicKey = rm->GetString(L"cl");
|
||||
g_IsVerified = VerifySignature(inputData, gcnew System::String(signature), publicKey);
|
||||
}
|
||||
|
||||
int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
if (g_IsVerified == false)
|
||||
{
|
||||
System::String^ errorVerified = "Verification is failed!\nPlease contact with support.";
|
||||
convertSystemString(err, errorVerified);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:initExpert(): not verified");
|
||||
return 0;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
MT5Handler^ mtHander = gcnew MT5Handler();
|
||||
MtServerInstance::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHander);
|
||||
result = func();
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:initExpert(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||
_DLLAPI int _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, int isTestMode, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->DeinitExpert(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:deinitExpert(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, &port, symbol, &bid, &ask, &isTestMode]() {
|
||||
bool isTesting = (isTestMode != 0) ? true : false;
|
||||
auto expert = gcnew Mt5Expert(expertHandle, gcnew String(symbol), bid, ask, gcnew MT5Handler(), isTesting);
|
||||
MtAdapter::GetInstance()->AddExpert(port, expert);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
_DLLAPI int _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
convertSystemString(err, e->Message);
|
||||
Debug::WriteLine("[ERROR] MT5Connector:updateQuote(): " + e->Message);
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle]() {
|
||||
MtAdapter::GetInstance()->RemoveExpert(expertHandle);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendIntResponse(int expertHandle, int response)
|
||||
_DLLAPI int _stdcall updateQuote(int expertHandle, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendIntResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, symbol, &bid, &ask]() {
|
||||
MtAdapter::GetInstance()->SendQuote(expertHandle, gcnew String(symbol), bid, ask);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendLongResponse(int expertHandle, __int64 response)
|
||||
_DLLAPI int _stdcall sendIntResponse(int expertHandle, int response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseInt(response));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendULongResponse(int expertHandle, unsigned __int64 response)
|
||||
_DLLAPI int _stdcall sendLongResponse(int expertHandle, __int64 response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseULong(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLong(response));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendBooleanResponse(int expertHandle, int response)
|
||||
_DLLAPI int _stdcall sendULongResponse(int expertHandle, unsigned __int64 response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseULong(response));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
_DLLAPI int _stdcall sendBooleanResponse(int expertHandle, int response, wchar_t* err)
|
||||
{
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
bool value = (response != 0) ? true : false;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendBooleanResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseBool(value));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleResponse(int expertHandle, double response)
|
||||
_DLLAPI int _stdcall sendDoubleResponse(int expertHandle, double response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendDoubleResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, &response]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDouble(response));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendStringResponse(int expertHandle, wchar_t* response)
|
||||
_DLLAPI int _stdcall sendStringResponse(int expertHandle, wchar_t* response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendStringResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, response]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseString(gcnew String(response)));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendVoidResponse(int expertHandle)
|
||||
_DLLAPI int _stdcall sendVoidResponse(int expertHandle, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendVoidResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle]() {
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, nullptr);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size)
|
||||
_DLLAPI int _stdcall sendDoubleArrayResponse(int expertHandle, double* values, int size, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<double>^ list = gcnew array<double>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendDoubleArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseDoubleArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size)
|
||||
_DLLAPI int _stdcall sendIntArrayResponse(int expertHandle, int* values, int size, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<int>^ list = gcnew array<int>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendIntArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseIntArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendLongArrayResponse(int expertHandle, __int64* values, int size)
|
||||
_DLLAPI int _stdcall sendLongArrayResponse(int expertHandle, __int64* values, int size, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<System::Int64>^ list = gcnew array<System::Int64>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
list[i] = values[i];
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLongArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendLongArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseLongArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates values[], int size)
|
||||
_DLLAPI int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates values[], int size, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<MtMqlRates^>^ list = gcnew array<MtMqlRates^>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
MtMqlRates^ rates = gcnew MtMqlRates();
|
||||
rates->time = values[i].time;
|
||||
@@ -331,180 +209,107 @@ int _stdcall sendMqlRatesArrayResponse(int expertHandle, CMqlRates values[], int
|
||||
rates->tick_volume = values[i].tick_volume;
|
||||
rates->spread = values[i].spread;
|
||||
rates->real_volume = values[i].real_volume;
|
||||
|
||||
list[i] = rates;
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlRatesArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlRatesArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlRatesArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendMqlTickResponse(int expertHandle, CMqlTick* response, int size)
|
||||
_DLLAPI int _stdcall sendMqlTickResponse(int expertHandle, CMqlTick* response, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, response]() {
|
||||
MtMqlTick^ mtResponse = gcnew MtMqlTick();
|
||||
|
||||
mtResponse->time = response->time;
|
||||
mtResponse->bid = response->bid;
|
||||
mtResponse->ask = response->ask;
|
||||
mtResponse->last = response->last;
|
||||
mtResponse->volume = response->volume;
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlTick(mtResponse));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlTickResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlTick(mtResponse));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall sendMqlBookInfoArrayResponse(int expertHandle, CMqlBookInfo values[], int size)
|
||||
_DLLAPI int _stdcall sendMqlBookInfoArrayResponse(int expertHandle, CMqlBookInfo values[], int size, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Execute<int>([&expertHandle, values, &size]() {
|
||||
array<MtMqlBookInfo^>^ list = gcnew array<MtMqlBookInfo^>(size);
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
MtMqlBookInfo^ info = gcnew MtMqlBookInfo();
|
||||
|
||||
info->type = values[i].type;
|
||||
info->price = values[i].price;
|
||||
info->volume = values[i].volume;
|
||||
|
||||
list[i] = info;
|
||||
}
|
||||
|
||||
MtServerInstance::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlBookInfoArray(list));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:sendMqlRatesArrayResponse(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
MtAdapter::GetInstance()->SendResponse(expertHandle, gcnew MtResponseMqlBookInfoArray(list));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
//----------- get values -------------------------------
|
||||
|
||||
int _stdcall getCommandType(int expertHandle, int* res)
|
||||
_DLLAPI int _stdcall getCommandType(int expertHandle, int* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = MtServerInstance::GetInstance()->GetCommandType(expertHandle);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getCommandType(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, res]() {
|
||||
*res = MtAdapter::GetInstance()->GetCommandType(expertHandle);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getIntValue(int expertHandle, int paramIndex, int* res)
|
||||
_DLLAPI int _stdcall getIntValue(int expertHandle, int paramIndex, int* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
*res = (int)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res)
|
||||
_DLLAPI int _stdcall getDoubleValue(int expertHandle, int paramIndex, double* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (double)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getDoubleValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
*res = (double)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res)
|
||||
_DLLAPI int _stdcall getStringValue(int expertHandle, int paramIndex, wchar_t* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
convertSystemString(res, (String^)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getStringValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
convertSystemString(res, (String^)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex));
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getULongValue(int expertHandle, int paramIndex, unsigned __int64* res)
|
||||
_DLLAPI int _stdcall getULongValue(int expertHandle, int paramIndex, unsigned __int64* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (unsigned long)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getULongValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
*res = (unsigned __int64)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res)
|
||||
_DLLAPI int _stdcall getLongValue(int expertHandle, int paramIndex, __int64* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (long)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getLongValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
*res = (__int64)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res)
|
||||
_DLLAPI int _stdcall getBooleanValue(int expertHandle, int paramIndex, int* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool val = (bool)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
bool val = (bool)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
*res = val == true ? 1 : 0;
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getBooleanValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
int _stdcall getUIntValue(int expertHandle, int paramIndex, unsigned int* res)
|
||||
_DLLAPI int _stdcall getUIntValue(int expertHandle, int paramIndex, unsigned int* res, wchar_t* err)
|
||||
{
|
||||
try
|
||||
{
|
||||
*res = (unsigned int)MtServerInstance::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
}
|
||||
catch (Exception^ e)
|
||||
{
|
||||
Debug::WriteLine("[ERROR] MT5Connector:getUIntValue(): " + e->Message);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return Execute<int>([&expertHandle, ¶mIndex, res]() {
|
||||
*res = (unsigned int)MtAdapter::GetInstance()->GetCommandParameter(expertHandle, paramIndex);
|
||||
return 1;
|
||||
}, err, 0);
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
LIBRARY MT5Connector
|
||||
|
||||
EXPORTS initExpert
|
||||
deinitExpert
|
||||
updateQuote
|
||||
sendIntResponse
|
||||
sendBooleanResponse
|
||||
sendDoubleResponse
|
||||
sendStringResponse
|
||||
sendVoidResponse
|
||||
sendDoubleArrayResponse
|
||||
sendIntArrayResponse
|
||||
sendLongArrayResponse
|
||||
sendMqlRatesArrayResponse
|
||||
sendLongResponse
|
||||
sendULongResponse
|
||||
sendMqlTickResponse
|
||||
sendMqlBookInfoArrayResponse
|
||||
getCommandType
|
||||
getIntValue
|
||||
getUIntValue
|
||||
getDoubleValue
|
||||
getStringValue
|
||||
getLongValue
|
||||
getULongValue
|
||||
getBooleanValue
|
||||
verify
|
||||
@@ -95,7 +95,6 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
@@ -108,7 +107,6 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
@@ -120,7 +118,6 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
@@ -132,7 +129,6 @@
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>.\MT5Connector.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
@@ -157,7 +153,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.ico" />
|
||||
<None Include="MT5Connector.def" />
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -44,9 +44,6 @@
|
||||
<None Include="app.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="MT5Connector.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="app.rc">
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MTApiService
|
||||
namespace MTApiService
|
||||
{
|
||||
public interface IMetaTraderHandler
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace MTApiService
|
||||
|
||||
var roller = new RollingFileAppender
|
||||
{
|
||||
AppendToFile = false,
|
||||
AppendToFile = true,
|
||||
File = $@"{System.IO.Path.GetTempPath()}{profileName}\Logs\{filename}",
|
||||
Layout = patternLayout,
|
||||
PreserveLogFileNameExtension = true,
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
<Compile Include="IMetaTraderHandler.cs" />
|
||||
<Compile Include="ITaskExecutor.cs" />
|
||||
<Compile Include="LogConfigurator.cs" />
|
||||
<Compile Include="Mt5Expert.cs" />
|
||||
<Compile Include="MtCommandEventArgs.cs" />
|
||||
<Compile Include="IDisposableChannel.cs" />
|
||||
<Compile Include="IMtApiServer.cs" />
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
using log4net;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
public class Mt5Expert : MtExpert
|
||||
{
|
||||
private static readonly ILog Log = LogManager.GetLogger(typeof(MtExpert));
|
||||
private const int StopExpertInterval = 2000; // 2 sec for testing mode
|
||||
private readonly System.Timers.Timer _stopTimer = new System.Timers.Timer();
|
||||
|
||||
|
||||
public Mt5Expert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler, bool isTestMode) :
|
||||
base(handle, symbol, bid, ask, mtHandler)
|
||||
{
|
||||
IsTestMode = isTestMode;
|
||||
_stopTimer.Interval = StopExpertInterval;
|
||||
_stopTimer.Elapsed += _stopTimer_Elapsed;
|
||||
}
|
||||
|
||||
public bool IsTestMode { get; }
|
||||
|
||||
public override void UpdateQuote(MtQuote quote)
|
||||
{
|
||||
Log.Debug("UpdateQuote: begin.");
|
||||
|
||||
base.UpdateQuote(quote);
|
||||
|
||||
if (IsTestMode)
|
||||
{
|
||||
//reset timer
|
||||
_stopTimer.Stop();
|
||||
_stopTimer.Start();
|
||||
}
|
||||
|
||||
Log.Debug("UpdateQuote: end.");
|
||||
}
|
||||
|
||||
private void _stopTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||
{
|
||||
Log.Debug("_stopTimer_Elapsed: begin.");
|
||||
|
||||
Log.Warn("Mt5Expert has received new tick during 2 sec in testing mode. The possible cause: user has stopped the tester manually in MetaTrader 5.");
|
||||
Deinit();
|
||||
|
||||
Log.Debug("_stopTimer_Elapsed: end.");
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
-15
@@ -36,12 +36,12 @@ namespace MTApiService
|
||||
|
||||
|
||||
#region Public Methods
|
||||
public void InitExpert(int expertHandle, int port, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
|
||||
public void AddExpert(int port, MtExpert expert)
|
||||
{
|
||||
if (mtHandler == null)
|
||||
throw new ArgumentNullException(nameof(mtHandler));
|
||||
if (expert == null)
|
||||
throw new ArgumentNullException(nameof(expert));
|
||||
|
||||
Log.InfoFormat("InitExpert: begin. symbol = {0}, expertHandle = {1}, port = {2}", symbol, expertHandle, port);
|
||||
Log.InfoFormat("AddExpert: begin. expert = {0}", expert);
|
||||
|
||||
MtServer server;
|
||||
lock (_servers)
|
||||
@@ -60,8 +60,6 @@ namespace MTApiService
|
||||
}
|
||||
}
|
||||
|
||||
var expert = new MtExpert(expertHandle, new MtQuote { Instrument = symbol, Bid = bid, Ask = ask, ExpertHandle = expertHandle }, mtHandler);
|
||||
|
||||
lock (_experts)
|
||||
{
|
||||
_experts[expert.Handle] = expert;
|
||||
@@ -69,12 +67,12 @@ namespace MTApiService
|
||||
|
||||
server.AddExpert(expert);
|
||||
|
||||
Log.Info("InitExpert: end");
|
||||
Log.Info("AddExpert: end");
|
||||
}
|
||||
|
||||
public void DeinitExpert(int expertHandle)
|
||||
public void RemoveExpert(int expertHandle)
|
||||
{
|
||||
Log.InfoFormat("DeinitExpert: begin. expertHandle = {0}", expertHandle);
|
||||
Log.InfoFormat("RemoveExpert: begin. expertHandle = {0}", expertHandle);
|
||||
|
||||
MtExpert expert = null;
|
||||
|
||||
@@ -93,15 +91,15 @@ namespace MTApiService
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.WarnFormat("DeinitExpert: expert with id {0} has not been found.", expertHandle);
|
||||
Log.WarnFormat("RemoveExpert: expert with id {0} has not been found.", expertHandle);
|
||||
}
|
||||
|
||||
Log.Info("DeinitExpert: end");
|
||||
Log.Info("RemoveExpert: end");
|
||||
}
|
||||
|
||||
public void SendQuote(int expertHandle, string symbol, double bid, double ask)
|
||||
{
|
||||
Log.DebugFormat("SendQuote: begin. symbol = {0}, bid = {1}, ask = {2}", symbol, bid, ask);
|
||||
Log.DebugFormat("UpdateQuote: begin. symbol = {0}, bid = {1}, ask = {2}", symbol, bid, ask);
|
||||
|
||||
MtExpert expert;
|
||||
lock (_experts)
|
||||
@@ -111,14 +109,14 @@ namespace MTApiService
|
||||
|
||||
if (expert != null)
|
||||
{
|
||||
expert.Quote = new MtQuote { Instrument = symbol, Bid = bid, Ask = ask, ExpertHandle = expertHandle };
|
||||
expert.UpdateQuote(new MtQuote { Instrument = symbol, Bid = bid, Ask = ask, ExpertHandle = expertHandle });
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.WarnFormat("SendQuote: expert with id {0} has not been found.", expertHandle);
|
||||
Log.WarnFormat("UpdateQuote: expert with id {0} has not been found.", expertHandle);
|
||||
}
|
||||
|
||||
Log.Debug("SendQuote: end");
|
||||
Log.Debug("UpdateQuote: end");
|
||||
}
|
||||
|
||||
public void SendEvent(int expertHandle, int eventType, string payload)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace MTApiService
|
||||
Command = command;
|
||||
}
|
||||
|
||||
public MtCommand Command { get; private set; }
|
||||
public MtCommand Command { get; }
|
||||
|
||||
public MtResponse WaitResult(int time)
|
||||
{
|
||||
|
||||
+15
-27
@@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace MTApiService
|
||||
{
|
||||
internal class MtExpert: ITaskExecutor
|
||||
public class MtExpert: ITaskExecutor
|
||||
{
|
||||
public delegate void MtQuoteHandler(MtExpert expert, MtQuote quote);
|
||||
public delegate void MtEventHandler(MtExpert expert, MtEvent e);
|
||||
@@ -19,21 +19,20 @@ namespace MTApiService
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
public MtExpert(int handle, MtQuote quote, IMetaTraderHandler mtHandler)
|
||||
public MtExpert(int handle, string symbol, double bid, double ask, IMetaTraderHandler mtHandler)
|
||||
{
|
||||
if (mtHandler == null)
|
||||
throw new ArgumentNullException(nameof(mtHandler));
|
||||
|
||||
Quote = quote;
|
||||
_quote = new MtQuote { ExpertHandle = handle, Instrument = symbol, Bid = bid, Ask = ask};
|
||||
Handle = handle;
|
||||
_mtHadler = mtHandler;
|
||||
}
|
||||
|
||||
public void Deinit()
|
||||
public virtual void Deinit()
|
||||
{
|
||||
Log.Debug("Deinit: begin.");
|
||||
|
||||
IsEnable = false;
|
||||
FireOnDeinited();
|
||||
|
||||
Log.Debug("Deinit: end.");
|
||||
@@ -120,9 +119,18 @@ namespace MTApiService
|
||||
Log.Debug("SendEvent: end.");
|
||||
}
|
||||
|
||||
public virtual void UpdateQuote(MtQuote quote)
|
||||
{
|
||||
Log.DebugFormat("UpdateQuote: begin. quote = {0}", quote);
|
||||
|
||||
Quote = quote;
|
||||
|
||||
Log.Debug("UpdateQuote: end.");
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"ExpertHandle = {Handle}";
|
||||
return $"ExpertHandle = {Handle}, Quote = {Quote}";
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -153,7 +161,7 @@ namespace MTApiService
|
||||
return _quote;
|
||||
}
|
||||
}
|
||||
set
|
||||
private set
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
@@ -165,26 +173,6 @@ namespace MTApiService
|
||||
}
|
||||
|
||||
public int Handle { get; }
|
||||
|
||||
private bool _isEnable = true;
|
||||
public bool IsEnable
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
return _isEnable;
|
||||
}
|
||||
}
|
||||
private set
|
||||
{
|
||||
lock (_locker)
|
||||
{
|
||||
_isEnable = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -9,9 +9,9 @@ namespace MTApiService
|
||||
[DataMember]
|
||||
public int Action { get; set; }
|
||||
[DataMember]
|
||||
public uint Magic { get; set; }
|
||||
public ulong Magic { get; set; }
|
||||
[DataMember]
|
||||
public uint Order { get; set; }
|
||||
public ulong Order { get; set; }
|
||||
[DataMember]
|
||||
public string Symbol { get; set; }
|
||||
[DataMember]
|
||||
@@ -25,7 +25,7 @@ namespace MTApiService
|
||||
[DataMember]
|
||||
public double Tp { get; set; }
|
||||
[DataMember]
|
||||
public uint Deviation { get; set; }
|
||||
public ulong Deviation { get; set; }
|
||||
[DataMember]
|
||||
public int Type { get; set; }
|
||||
[DataMember]
|
||||
@@ -36,5 +36,9 @@ namespace MTApiService
|
||||
public DateTime Expiration { get; set; }
|
||||
[DataMember]
|
||||
public string Comment { get; set; }
|
||||
[DataMember]
|
||||
public ulong Position { get; set; }
|
||||
[DataMember]
|
||||
public ulong PositionBy { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,21 +62,24 @@ namespace MTApiService
|
||||
}
|
||||
|
||||
//init local pipe host
|
||||
var localUrl = CreateConnectionAddress(null, port, true);
|
||||
var localServiceHost = CreateServiceHost(localUrl, true);
|
||||
var localPipeUrl = CreateConnectionAddress(null, port, true);
|
||||
var localPipeServiceHost = CreateServiceHost(localPipeUrl, true);
|
||||
if (localPipeServiceHost != null)
|
||||
{
|
||||
_hosts.Add(localPipeServiceHost);
|
||||
}
|
||||
|
||||
//init localhost
|
||||
var localUrl = CreateConnectionAddress("localhost", port, false);
|
||||
var localServiceHost = CreateServiceHost(localUrl, false);
|
||||
if (localServiceHost != null)
|
||||
{
|
||||
_hosts.Add(localServiceHost);
|
||||
}
|
||||
|
||||
|
||||
//init network hosts
|
||||
var dnsHostName = Dns.GetHostName();
|
||||
var ips = Dns.GetHostEntry(dnsHostName);
|
||||
if (ips == null)
|
||||
{
|
||||
Log.WarnFormat("InitHosts: end. Dns.GetHostEntry has returned null for DNS Host Name {0}", dnsHostName);
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach (var ipAddress in ips.AddressList)
|
||||
{
|
||||
|
||||
@@ -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.25.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.25.0")]
|
||||
[assembly: AssemblyVersion("1.0.28.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.28.0")]
|
||||
@@ -44,17 +44,16 @@ template <typename T> T Execute(std::function<T()> func, wchar_t* err, T default
|
||||
_DLLAPI bool _stdcall initExpert(int expertHandle, int port, wchar_t* symbol, double bid, double ask, wchar_t* err)
|
||||
{
|
||||
return Execute<bool>([&expertHandle, &port, symbol, &bid, &ask]() {
|
||||
MT4Handler^ mtHandler = gcnew MT4Handler();
|
||||
MtAdapter::GetInstance()->InitExpert(expertHandle, port, gcnew String(symbol), bid, ask, mtHandler);
|
||||
auto expert = gcnew MtExpert(expertHandle, gcnew String(symbol), bid, ask, gcnew MT4Handler());
|
||||
MtAdapter::GetInstance()->AddExpert(port, expert);
|
||||
return true;
|
||||
}, err, false);
|
||||
|
||||
}
|
||||
|
||||
_DLLAPI bool _stdcall deinitExpert(int expertHandle, wchar_t* err)
|
||||
{
|
||||
return Execute<bool>([&expertHandle]() {
|
||||
MtAdapter::GetInstance()->DeinitExpert(expertHandle);
|
||||
MtAdapter::GetInstance()->RemoveExpert(expertHandle);
|
||||
return true;
|
||||
}, err, false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace MtApi
|
||||
{
|
||||
public class ChartEventArgs : EventArgs
|
||||
{
|
||||
internal ChartEventArgs(int expertHandle, MtChartEvent chartEvent)
|
||||
{
|
||||
ExpertHandle = expertHandle;
|
||||
ChartId = chartEvent.ChartId;
|
||||
EventId = chartEvent.EventId;
|
||||
Lparam = chartEvent.Lparam;
|
||||
Dparam = chartEvent.Dparam;
|
||||
Sparam = chartEvent.Sparam;
|
||||
}
|
||||
|
||||
public int ExpertHandle { get; }
|
||||
public long ChartId { get; }
|
||||
public int EventId { get; }
|
||||
public long Lparam { get; }
|
||||
public double Dparam { get; }
|
||||
public string Sparam { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace MtApi
|
||||
{
|
||||
public enum EnumAlignMode
|
||||
{
|
||||
ALIGN_LEFT = 1,
|
||||
ALIGN_CENTER = 2,
|
||||
ALIGN_RIGHT = 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace MtApi
|
||||
{
|
||||
public enum EnumChartEvent
|
||||
{
|
||||
CHARTEVENT_KEYDOWN = 0,
|
||||
CHARTEVENT_MOUSE_MOVE = 10,
|
||||
CHARTEVENT_OBJECT_CREATE = 7,
|
||||
CHARTEVENT_OBJECT_CHANGE = 8,
|
||||
CHARTEVENT_OBJECT_DELETE = 6,
|
||||
CHARTEVENT_CLICK = 4,
|
||||
CHARTEVENT_OBJECT_CLICK = 1,
|
||||
CHARTEVENT_OBJECT_DRAG = 2,
|
||||
CHARTEVENT_OBJECT_ENDEDIT = 3,
|
||||
CHARTEVENT_CHART_CHANGE = 9,
|
||||
CHARTEVENT_CUSTOM = 1000,
|
||||
CHARTEVENT_CUSTOM_LAST = 66534
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace MtApi
|
||||
{
|
||||
public enum EnumChartPropertyDouble
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
namespace MtApi
|
||||
{
|
||||
public enum EnumChartPropertyInteger
|
||||
{
|
||||
CHART_BRING_TO_TOP = 35,
|
||||
CHART_MOUSE_SCROLL = 42,
|
||||
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_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_IS_OFFLINE = 112
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MtApi
|
||||
{
|
||||
public enum EnumChartPropertyString
|
||||
{
|
||||
CHART_COMMENT = 20
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,12 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChartEventArgs.cs" />
|
||||
<Compile Include="ChartPeriod.cs" />
|
||||
<Compile Include="EnumAlignMode.cs" />
|
||||
<Compile Include="EnumChartPropertyDouble.cs" />
|
||||
<Compile Include="EnumChartPropertyInteger.cs" />
|
||||
<Compile Include="EnumChartPropertyString.cs" />
|
||||
<Compile Include="EnumColorFormat.cs" />
|
||||
<Compile Include="EnumObject.cs" />
|
||||
<Compile Include="EnumObjectPropertyDouble.cs" />
|
||||
@@ -73,6 +78,7 @@
|
||||
<Compile Include="Monitors\AvailabilityOrdersEventArgs.cs" />
|
||||
<Compile Include="MqlRates.cs" />
|
||||
<Compile Include="MqlTick.cs" />
|
||||
<Compile Include="MtChartEvent.cs" />
|
||||
<Compile Include="MtConnectionEventArgs.cs" />
|
||||
<Compile Include="MtConnectionException.cs" />
|
||||
<Compile Include="MtConnectionState.cs" />
|
||||
|
||||
+683
-15
@@ -271,31 +271,77 @@ namespace MtApi
|
||||
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment, int magic, DateTime expiration)
|
||||
{
|
||||
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, Color.Empty);
|
||||
var response = SendRequest<OrderSendResponse>(new OrderSendRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Cmd = (int)cmd,
|
||||
Volume = volume,
|
||||
Price = price,
|
||||
Slippage = slippage,
|
||||
Stoploss = stoploss,
|
||||
Takeprofit = takeprofit,
|
||||
Comment = comment,
|
||||
Magic = magic,
|
||||
Expiration = MtApiTimeConverter.ConvertToMtTime(expiration)
|
||||
});
|
||||
return response?.Ticket ?? -1;
|
||||
}
|
||||
|
||||
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment, int magic)
|
||||
{
|
||||
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, DateTime.MinValue, Color.Empty);
|
||||
var response = SendRequest<OrderSendResponse>(new OrderSendRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Cmd = (int)cmd,
|
||||
Volume = volume,
|
||||
Price = price,
|
||||
Slippage = slippage,
|
||||
Stoploss = stoploss,
|
||||
Takeprofit = takeprofit,
|
||||
Comment = comment,
|
||||
Magic = magic
|
||||
});
|
||||
return response?.Ticket ?? -1;
|
||||
}
|
||||
|
||||
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit
|
||||
, string comment)
|
||||
{
|
||||
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, 0, DateTime.MinValue, Color.Empty);
|
||||
var response = SendRequest<OrderSendResponse>(new OrderSendRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Cmd = (int)cmd,
|
||||
Volume = volume,
|
||||
Price = price,
|
||||
Slippage = slippage,
|
||||
Stoploss = stoploss,
|
||||
Takeprofit = takeprofit,
|
||||
Comment = comment
|
||||
});
|
||||
return response?.Ticket ?? -1;
|
||||
}
|
||||
|
||||
public int OrderSend(string symbol, TradeOperation cmd, double volume, double price, int slippage, double stoploss, double takeprofit)
|
||||
{
|
||||
return OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, null, 0, DateTime.MinValue, Color.Empty);
|
||||
var response = SendRequest<OrderSendResponse>(new OrderSendRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Cmd = (int)cmd,
|
||||
Volume = volume,
|
||||
Price = price,
|
||||
Slippage = slippage,
|
||||
Stoploss = stoploss,
|
||||
Takeprofit = takeprofit,
|
||||
});
|
||||
return response?.Ticket ?? -1;
|
||||
}
|
||||
|
||||
public int OrderSend(string symbol, TradeOperation cmd, double volume, string price, int slippage, double stoploss, double takeprofit)
|
||||
{
|
||||
double dPrice;
|
||||
return double.TryParse(price, out dPrice) ?
|
||||
OrderSend(symbol, cmd, volume, dPrice, slippage, stoploss, takeprofit, null, 0, DateTime.MinValue, Color.Empty) : 0;
|
||||
OrderSend(symbol, cmd, volume, dPrice, slippage, stoploss, takeprofit) : 0;
|
||||
}
|
||||
|
||||
public int OrderSendBuy(string symbol, double volume, int slippage)
|
||||
@@ -740,7 +786,7 @@ namespace MtApi
|
||||
|
||||
#endregion
|
||||
|
||||
#region Account Information
|
||||
#region Account functions
|
||||
|
||||
public double AccountBalance()
|
||||
{
|
||||
@@ -823,6 +869,12 @@ namespace MtApi
|
||||
return SendCommand<int>(MtCommandType.AccountStopoutMode, null);
|
||||
}
|
||||
|
||||
public bool ChangeAccount(string login, string password, string host)
|
||||
{
|
||||
var commandParameters = new ArrayList { login, password, host};
|
||||
return SendCommand<bool>(MtCommandType.ChangeAccount, commandParameters);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Common Function
|
||||
@@ -1681,9 +1733,9 @@ namespace MtApi
|
||||
///</summary>
|
||||
///<param name="symbolName">Symbol name.</param>
|
||||
///<param name="propId">Identifier of a symbol property. The value can be one of the values of the ENUM_SYMBOL_INFO_DOUBLE enumeration.</param>
|
||||
/// <returns>
|
||||
///<returns>
|
||||
/// The value of double type.
|
||||
/// </returns>
|
||||
///</returns>
|
||||
public double SymbolInfoDouble(string symbolName, EnumSymbolInfoDouble propId)
|
||||
{
|
||||
var response = SendRequest<SymbolInfoDoubleResponse>(new SymbolInfoDoubleRequest
|
||||
@@ -1699,9 +1751,9 @@ namespace MtApi
|
||||
///Returns the corresponding property of a specified symbol.
|
||||
///</summary>
|
||||
///<param name="symbol">Symbol name.</param>
|
||||
/// <returns>
|
||||
///<returns>
|
||||
/// MqlTick object, to which the current prices and time of the last price update will be placed.
|
||||
/// </returns>
|
||||
///</returns>
|
||||
public MqlTick SymbolInfoTick(string symbol)
|
||||
{
|
||||
var response = SendRequest<SymbolInfoTickResponse>(new SymbolInfoTickRequest
|
||||
@@ -1734,6 +1786,606 @@ namespace MtApi
|
||||
var commandParameters = new ArrayList { chartId };
|
||||
SendCommand<object>(MtCommandType.ChartRedraw, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Applies a specific template from a specified file to the chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID.</param>
|
||||
///<param name="filename">The name of the file containing the template.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartApplyTemplate(long chartId, string filename)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, filename };
|
||||
return SendCommand<bool>(MtCommandType.ChartApplyTemplate, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Saves current chart settings in a template with a specified name.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID.</param>
|
||||
///<param name="filename">The filename to save the template. The ".tpl" extension will be added to the filename automatically; there is no need to specify it. The template is saved in data_folder\templates\ and can be used for manual application in the terminal. If a template with the same filename already exists, the contents of this file will be overwritten.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartSaveTemplate(long chartId, string filename)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, filename };
|
||||
return SendCommand<bool>(MtCommandType.ChartSaveTemplate, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the number of a subwindow where an indicator is drawn.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID.</param>
|
||||
///<param name="indicatorShortname">Short name of the indicator.</param>
|
||||
///<returns>
|
||||
///Subwindow number in case of success. In case of failure the function returns -1.
|
||||
///</returns>
|
||||
public int ChartWindowFind(long chartId, string indicatorShortname)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, indicatorShortname };
|
||||
return SendCommand<int>(MtCommandType.ChartWindowFind, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the number of a subwindow where an indicator is drawn.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID.</param>
|
||||
///<param name="subWindow">The number of the chart subwindow. 0 means the main chart window.</param>
|
||||
///<param name="time">The time value on the chart, for which the value in pixels along the X axis will be received.</param>
|
||||
///<param name="price">The price value on the chart, for which the value in pixels along the Y axis will be received.</param>
|
||||
///<param name="x">The variable, into which the conversion of time to X will be received. The origin is in the upper left corner of the main chart window.</param>
|
||||
///<param name="y">The variable, into which the conversion of price to Y will be received. The origin is in the upper left corner of the main chart window.</param>
|
||||
///<returns>
|
||||
///Subwindow number in case of success. In case of failure the function returns -1.
|
||||
///</returns>
|
||||
public bool ChartTimePriceToXY(long chartId, int subWindow, DateTime? time, double price, out int x, out int y)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow, MtApiTimeConverter.ConvertToMtTime(time), price };
|
||||
var str = SendCommand<string>(MtCommandType.ChartTimePriceToXY, commandParameters);
|
||||
var res = false;
|
||||
x = 0;
|
||||
y = 0;
|
||||
if (!string.IsNullOrEmpty(str) && str.Contains(";"))
|
||||
{
|
||||
var values = str.Split(';');
|
||||
if (values.Length > 1)
|
||||
{
|
||||
int.TryParse(values[0], out x);
|
||||
int.TryParse(values[1], out y);
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the number of a subwindow where an indicator is drawn.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID.</param>
|
||||
///<param name="x">The variable, into which the conversion of time to X will be received. The origin is in the upper left corner of the main chart window.</param>
|
||||
///<param name="y">The variable, into which the conversion of price to Y will be received. The origin is in the upper left corner of the main chart window.</param>
|
||||
///<param name="subWindow">The number of the chart subwindow. 0 means the main chart window.</param>
|
||||
///<param name="time">The time value on the chart, for which the value in pixels along the X axis will be received.</param>
|
||||
///<param name="price">The price value on the chart, for which the value in pixels along the Y axis will be received.</param>
|
||||
///<returns>
|
||||
///Subwindow number in case of success. In case of failure the function returns -1.
|
||||
///</returns>
|
||||
public bool ChartXYToTimePrice(long chartId, int x, int y, out int subWindow, out DateTime? time, out double price)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, x, y };
|
||||
var str = SendCommand<string>(MtCommandType.ChartXYToTimePrice, commandParameters);
|
||||
var res = false;
|
||||
subWindow = 0;
|
||||
time = null;
|
||||
price = double.NaN;
|
||||
if (!string.IsNullOrEmpty(str) && str.Contains(";"))
|
||||
{
|
||||
var values = str.Split(';');
|
||||
if (values.Length > 2)
|
||||
{
|
||||
int.TryParse(values[0], out subWindow);
|
||||
int mt4Time;
|
||||
int.TryParse(values[1], out mt4Time);
|
||||
time = MtApiTimeConverter.ConvertFromMtTime(mt4Time);
|
||||
double.TryParse(values[2], out price);
|
||||
res = true;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Opens a new chart with the specified symbol and period.
|
||||
///</summary>
|
||||
///<param name="symbol">Chart symbol. NULL means the symbol of the current chart (the Expert Advisor is attached to).</param>
|
||||
///<param name="period"> Chart period (timeframe). Can be one of the ENUM_TIMEFRAMES values. 0 means the current chart period.</param>
|
||||
///<returns>
|
||||
///If successful, it returns the opened chart ID. Otherwise returns 0.
|
||||
///</returns>
|
||||
public long ChartOpen(string symbol, ENUM_TIMEFRAMES period)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period };
|
||||
return SendCommand<long>(MtCommandType.ChartOpen, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the ID of the first chart of the client terminal.
|
||||
///</summary>
|
||||
public long ChartFirst()
|
||||
{
|
||||
return SendCommand<long>(MtCommandType.ChartFirst, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the chart ID of the chart next to the specified one.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 does not mean the current chart. 0 means "return the first chart ID".</param>
|
||||
///<returns>
|
||||
///Chart ID. If this is the end of the chart list, it returns -1.
|
||||
///</returns>
|
||||
public long ChartNext(long chartId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId };
|
||||
return SendCommand<long>(MtCommandType.ChartNext, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Closes the specified chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<returns>
|
||||
///If successful, returns true, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartClose(long chartId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId };
|
||||
return SendCommand<bool>(MtCommandType.ChartClose, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the symbol name for the specified chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<returns>
|
||||
///If chart does not exist, the result will be an empty string.
|
||||
///</returns>
|
||||
public string ChartSymbol(long chartId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId };
|
||||
return SendCommand<string>(MtCommandType.ChartSymbol, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the timeframe period of specified chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<returns>
|
||||
///The function returns one of the ENUM_TIMEFRAMES values. If chart does not exist, it returns 0.
|
||||
///</returns>
|
||||
public ENUM_TIMEFRAMES ChartPeriod(long chartId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId };
|
||||
return (ENUM_TIMEFRAMES) SendCommand<int>(MtCommandType.ChartPeriod, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Sets a value for a corresponding property of the specified chart. Chart property should be of a double type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. Can be one of the ENUM_CHART_PROPERTY_DOUBLE values (except the read-only properties).</param>
|
||||
///<param name="value">Property value.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartSetDouble(long chartId, EnumChartPropertyDouble propId, double value)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId, value };
|
||||
return SendCommand<bool>(MtCommandType.ChartSetDouble, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Sets a value for a corresponding property of the specified chart. Chart property must be datetime, int, color, bool or char.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. It can be one of the ENUM_CHART_PROPERTY_INTEGER value (except the read-only properties).</param>
|
||||
///<param name="value">Property value.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartSetInteger(long chartId, EnumChartPropertyInteger propId, long value)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId, value };
|
||||
return SendCommand<bool>(MtCommandType.ChartSetInteger, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Sets a value for a corresponding property of the specified chart. Chart property must be of the string type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. Its value can be one of the ENUM_CHART_PROPERTY_STRING values (except the read-only properties).</param>
|
||||
///<param name="value">Property value string. String length cannot exceed 2045 characters (extra characters will be truncated).</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartSetString(long chartId, EnumChartPropertyString propId, string value)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId, value };
|
||||
return SendCommand<bool>(MtCommandType.ChartSetString, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Sets a value for a corresponding property of the specified chart. Chart property must be of the string type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. This value can be one of the ENUM_CHART_PROPERTY_DOUBLE values.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. For the first case, the default value is 0 (main chart window). The most of the properties do not require a subwindow number.</param>
|
||||
///<returns>
|
||||
///The value of double type.
|
||||
///</returns>
|
||||
public double ChartGetDouble(long chartId, EnumChartPropertyDouble propId, int subWindow = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId, subWindow };
|
||||
return SendCommand<double>(MtCommandType.ChartGetDouble, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the value of a corresponding property of the specified chart. Chart property must be of datetime, int or bool type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. This value can be one of the ENUM_CHART_PROPERTY_INTEGER values.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. For the first case, the default value is 0 (main chart window). The most of the properties do not require a subwindow number.</param>
|
||||
///<returns>
|
||||
///The value of long type.
|
||||
///</returns>
|
||||
public long ChartGetInteger(long chartId, EnumChartPropertyInteger propId, int subWindow = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId, subWindow };
|
||||
return SendCommand<long>(MtCommandType.ChartGetInteger, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the value of a corresponding property of the specified chart. Chart property must be of string type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="propId">Chart property ID. This value can be one of the ENUM_CHART_PROPERTY_STRING values.</param>
|
||||
///<returns>
|
||||
///The value of string type.
|
||||
///</returns>
|
||||
public string ChartGetString(long chartId, EnumChartPropertyString propId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, (int)propId };
|
||||
return SendCommand<string>(MtCommandType.ChartGetString, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Performs shift of the specified chart by the specified number of bars relative to the specified position in the chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="position">Chart position to perform a shift. Can be one of the ENUM_CHART_POSITION values.</param>
|
||||
///<param name="shift">Number of bars to shift the chart. Positive value means the right shift (to the end of chart), negative value means the left shift (to the beginning of chart). The zero shift can be used to navigate to the beginning or end of chart.</param>
|
||||
///<returns>
|
||||
///Returns true if successful, otherwise returns false.
|
||||
///</returns>
|
||||
public bool ChartNavigate(long chartId, int position, int shift = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, position, shift };
|
||||
return SendCommand<bool>(MtCommandType.ChartNavigate, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Performs shift of the specified chart by the specified number of bars relative to the specified position in the chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. 0 denotes the main chart subwindow.</param>
|
||||
///<param name="indicatorShortname">The short name of the indicator which is set in the INDICATOR_SHORTNAME property with the IndicatorSetString() function. To get the short name of an indicator use the ChartIndicatorName() function.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartIndicatorDelete(long chartId, int subWindow, string indicatorShortname)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow, indicatorShortname };
|
||||
return SendCommand<bool>(MtCommandType.ChartIndicatorDelete, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the short name of the indicator by the number in the indicators list on the specified chart window.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. 0 denotes the main chart subwindow.</param>
|
||||
///<param name="index">the index of the indicator in the list of indicators. The numeration of indicators start with zero, i.e. the first indicator in the list has the 0 index. To obtain the number of indicators in the list use the ChartIndicatorsTotal() function.</param>
|
||||
///<returns>
|
||||
///The short name of the indicator which is set in the INDICATOR_SHORTNAME property with the IndicatorSetString() function.
|
||||
///</returns>
|
||||
public string ChartIndicatorName(long chartId, int subWindow, int index)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow, index };
|
||||
return SendCommand<string>(MtCommandType.ChartIndicatorName, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the number of all indicators applied to the specified chart window.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. 0 denotes the main chart subwindow.</param>
|
||||
///<returns>
|
||||
///The number of indicators in the specified chart window.
|
||||
///</returns>
|
||||
public int ChartIndicatorsTotal(long chartId, int subWindow)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow };
|
||||
return SendCommand<int>(MtCommandType.ChartIndicatorsTotal, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the number (index) of the chart subwindow the Expert Advisor or script has been dropped to. 0 means the main chart window.
|
||||
///</summary>
|
||||
public int ChartWindowOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.ChartWindowOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the price coordinate corresponding to the chart point the Expert Advisor or script has been dropped to.
|
||||
///</summary>
|
||||
public double ChartPriceOnDropped()
|
||||
{
|
||||
return SendCommand<double>(MtCommandType.ChartPriceOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the time coordinate corresponding to the chart point the Expert Advisor or script has been dropped to.
|
||||
///</summary>
|
||||
public DateTime ChartTimeOnDropped()
|
||||
{
|
||||
var res = SendCommand<int>(MtCommandType.ChartTimeOnDropped, null);
|
||||
return MtApiTimeConverter.ConvertFromMtTime(res);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the X coordinate of the chart point the Expert Advisor or script has been dropped to.
|
||||
///</summary>
|
||||
public int ChartXOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.ChartXOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the Y coordinateof the chart point the Expert Advisor or script has been dropped to.
|
||||
///</summary>
|
||||
public int ChartYOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.ChartYOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Changes the symbol and period of the specified chart. The function is asynchronous, i.e. it sends the command and does not wait for its execution completion.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="symbol">Chart symbol. NULL value means the current chart symbol (Expert Advisor is attached to)</param>
|
||||
///<param name="period">Chart period (timeframe). Can be one of the ENUM_TIMEFRAMES values. 0 means the current chart period.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartSetSymbolPeriod(long chartId, string symbol, ENUM_TIMEFRAMES period)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, symbol, (int)period };
|
||||
return SendCommand<bool>(MtCommandType.ChartSetSymbolPeriod, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Saves current chart screen shot as a GIF, PNG or BMP file depending on specified extension.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart ID. 0 means the current chart.</param>
|
||||
///<param name="filename">Screenshot file name. Cannot exceed 63 characters. Screenshot files are placed in the \Files directory.</param>
|
||||
///<param name="width">Screenshot width in pixels.</param>
|
||||
///<param name="height">Screenshot height in pixels.</param>
|
||||
///<param name="alignMode">Output mode of a narrow screenshot.</param>
|
||||
///<returns>
|
||||
///Returns true if the command has been added to chart queue, otherwise false.
|
||||
///</returns>
|
||||
public bool ChartScreenShot(long chartId, string filename, int width, int height, EnumAlignMode alignMode = EnumAlignMode.ALIGN_RIGHT)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, filename, width, height, (int)alignMode };
|
||||
return SendCommand<bool>(MtCommandType.ChartScreenShot, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the amount of bars visible on the chart.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The amount of bars visible on the chart.
|
||||
///</returns>
|
||||
public int WindowBarsPerChart()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowBarsPerChart, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the name of the executed Expert Advisor, script, custom indicator, or library.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The name of the executed Expert Advisor, script, custom indicator, or library, depending on the MQL4 program, from which this function has been called.
|
||||
///</returns>
|
||||
public string WindowExpertName()
|
||||
{
|
||||
return SendCommand<string>(MtCommandType.WindowExpertName, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the window index containing this specified indicator.
|
||||
///</summary>
|
||||
///<param name="name">Indicator short name.</param>
|
||||
///<returns>
|
||||
///If indicator with name was found, the function returns the window index containing this specified indicator, otherwise it returns -1.
|
||||
///</returns>
|
||||
public int WindowFind(string name)
|
||||
{
|
||||
var commandParameters = new ArrayList { name };
|
||||
return SendCommand<int>(MtCommandType.WindowFind, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns index of the first visible bar in the current chart window.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///Index of the first visible bar number in the current chart window.
|
||||
///</returns>
|
||||
public int WindowFirstVisibleBar()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowFirstVisibleBar, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the system handle of the chart window.
|
||||
///</summary>
|
||||
///<param name="symbol">Symbol.</param>
|
||||
///<param name="timeframe">Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.</param>
|
||||
///<returns>
|
||||
///Returns the system handle of the chart window. If the chart of symbol and timeframe has not been opened by the moment of function calling, 0 will be returned.
|
||||
///</returns>
|
||||
public int WindowHandle(string symbol, int timeframe)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, timeframe };
|
||||
return SendCommand<int>(MtCommandType.WindowHandle, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the visibility flag of the chart subwindow.
|
||||
///</summary>
|
||||
///<param name="index">Subwindow index.</param>
|
||||
///<returns>
|
||||
///Returns true if the chart subwindow is visible, otherwise returns false. The chart subwindow can be hidden due to the visibility properties of the indicator placed in it.
|
||||
///</returns>
|
||||
public bool WindowIsVisible(int index)
|
||||
{
|
||||
var commandParameters = new ArrayList { index };
|
||||
return SendCommand<bool>(MtCommandType.WindowIsVisible, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the window index where Expert Advisor, custom indicator or script was dropped.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The window index where Expert Advisor, custom indicator or script was dropped. This value is valid if the Expert Advisor, custom indicator or script was dropped by mouse.
|
||||
///</returns>
|
||||
public int WindowOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the maximal value of the vertical scale of the specified subwindow of the current chart.
|
||||
///</summary>
|
||||
///<param name="index">Chart subwindow index (0 - main chart window).</param>
|
||||
///<returns>
|
||||
///The maximal value of the vertical scale of the specified subwindow of the current chart.
|
||||
///</returns>
|
||||
public int WindowPriceMax(int index = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { index };
|
||||
return SendCommand<int>(MtCommandType.WindowPriceMax, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the minimal value of the vertical scale of the specified subwindow of the current chart.
|
||||
///</summary>
|
||||
///<param name="index">Chart subwindow index (0 - main chart window).</param>
|
||||
///<returns>
|
||||
///The minimal value of the vertical scale of the specified subwindow of the current chart.
|
||||
///</returns>
|
||||
public int WindowPriceMin(int index = 0)
|
||||
{
|
||||
var commandParameters = new ArrayList { index };
|
||||
return SendCommand<int>(MtCommandType.WindowPriceMin, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the price of the chart point where Expert Advisor or script was dropped.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The price of the chart point where Expert Advisor or script was dropped. This value is only valid if the expert or script was dropped by mouse.
|
||||
///</returns>
|
||||
public double WindowPriceOnDropped()
|
||||
{
|
||||
return SendCommand<double>(MtCommandType.WindowPriceOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Redraws the current chart forcedly.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///Redraws the current chart forcedly. It is normally used after the objects properties have been changed.
|
||||
///</returns>
|
||||
public void WindowRedraw()
|
||||
{
|
||||
SendCommand<object>(MtCommandType.WindowRedraw, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Saves current chart screen shot as a GIF file.
|
||||
///</summary>
|
||||
///<param name="filename">Screen shot file name. Screenshot is saved to \Files folder.</param>
|
||||
///<param name="sizeX">Screen shot width in pixels.</param>
|
||||
///<param name="sizeY">Screen shot height in pixels.</param>
|
||||
///<param name="startBar">Index of the first visible bar in the screen shot. If 0 value is set, the current first visible bar will be shot. If no value or negative value has been set, the end-of-chart screen shot will be produced, indent being taken into consideration.</param>
|
||||
///<param name="chartScale">Horizontal chart scale for screen shot. Can be in the range from 0 to 5. If no value or negative value has been set, the current chart scale will be used.</param>
|
||||
///<param name="chartMode"> Chart displaying mode. It can take the following values: CHART_BAR (0 is a sequence of bars), CHART_CANDLE (1 is a sequence of candlesticks), CHART_LINE (2 is a close prices line). If no value or negative value has been set, the chart will be shown in its current mode.</param>
|
||||
///<returns>
|
||||
///Returns true if succeed, otherwise false.
|
||||
///</returns>
|
||||
public bool WindowScreenShot(string filename, int sizeX, int sizeY, int startBar = -1, int chartScale = -1, int chartMode = -1)
|
||||
{
|
||||
var commandParameters = new ArrayList { filename, sizeX, sizeY, startBar, chartScale, chartMode };
|
||||
return SendCommand<bool>(MtCommandType.WindowScreenShot, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the time of the chart point where Expert Advisor or script was dropped.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The time value of the chart point where expert or script was dropped. This value is only valid if the expert or script was dropped by mouse.
|
||||
///</returns>
|
||||
public DateTime WindowTimeOnDropped()
|
||||
{
|
||||
var res = SendCommand<int>(MtCommandType.WindowTimeOnDropped, null);
|
||||
return MtApiTimeConverter.ConvertFromMtTime(res);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns total number of indicator windows on the chart.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///Total number of indicator windows on the chart (including main chart).
|
||||
///</returns>
|
||||
public int WindowsTotal()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowsTotal, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the value at X axis in pixels for the chart window client area point at which the Expert Advisor or script was dropped.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///The value at X axis in pixels for the chart window client area point at which the expert or script was dropped. The value will be true only if the expert or script were moved with the mouse ("Drag'n'Drop") technique.
|
||||
///</returns>
|
||||
public int WindowXOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowXOnDropped, null);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Returns the value at Y axis in pixels for the chart window client area point at which the Expert Advisor or script was dropped.
|
||||
///</summary>
|
||||
///<returns>
|
||||
///Returns the value at Y axis in pixels for the chart window client area point at which the Expert Advisor or script was dropped. The value will be true only if the expert or script were moved with the mouse ("Drag'n'Drop") technique.
|
||||
///</returns>
|
||||
public int WindowYOnDropped()
|
||||
{
|
||||
return SendCommand<int>(MtCommandType.WindowYOnDropped, null);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Object Functions
|
||||
@@ -2186,6 +2838,15 @@ namespace MtApi
|
||||
|
||||
#endregion
|
||||
|
||||
#region Backtesting functions
|
||||
|
||||
public void UnlockTicks()
|
||||
{
|
||||
SendCommand<object>(MtCommandType.UnlockTicks, null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private MtClient Client
|
||||
{
|
||||
@@ -2407,18 +3068,24 @@ namespace MtApi
|
||||
switch(eventType)
|
||||
{
|
||||
case MtEventTypes.LastTimeBar:
|
||||
{
|
||||
FireOnLastTimeBar(JsonConvert.DeserializeObject<MtTimeBar>(e.Payload));
|
||||
}
|
||||
FireOnLastTimeBar(e.ExpertHandle, JsonConvert.DeserializeObject<MtTimeBar>(e.Payload));
|
||||
break;
|
||||
case MtEventTypes.ChartEvent:
|
||||
FireOnChartEvent(e.ExpertHandle, JsonConvert.DeserializeObject<MtChartEvent>(e.Payload));
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void FireOnLastTimeBar(MtTimeBar timeBar)
|
||||
private void FireOnLastTimeBar(int expertHandler, MtTimeBar timeBar)
|
||||
{
|
||||
OnLastTimeBar?.Invoke(this, new TimeBarArgs(timeBar));
|
||||
OnLastTimeBar?.Invoke(this, new TimeBarArgs(expertHandler, timeBar));
|
||||
}
|
||||
|
||||
private void FireOnChartEvent(int expertHandler, MtChartEvent chartEvent)
|
||||
{
|
||||
OnChartEvent?.Invoke(this, new ChartEventArgs(expertHandler, chartEvent));
|
||||
}
|
||||
|
||||
private void BacktestingReady()
|
||||
@@ -2436,6 +3103,7 @@ namespace MtApi
|
||||
public event EventHandler<MtQuoteEventArgs> QuoteRemoved;
|
||||
public event EventHandler<MtConnectionEventArgs> ConnectionStateChanged;
|
||||
public event EventHandler<TimeBarArgs> OnLastTimeBar;
|
||||
public event EventHandler<ChartEventArgs> OnChartEvent;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace MtApi
|
||||
{
|
||||
internal class MtChartEvent
|
||||
{
|
||||
public long ChartId { get; set; }
|
||||
public int EventId { get; set; }
|
||||
public long Lparam { get; set; }
|
||||
public double Dparam { get; set; }
|
||||
public string Sparam { get; set; }
|
||||
}
|
||||
}
|
||||
Executable → Regular
+53
-3
@@ -197,8 +197,6 @@
|
||||
SymbolName = 201,
|
||||
SymbolSelect = 202,
|
||||
SymbolInfoInteger = 203,
|
||||
ChartId = 206,
|
||||
ChartRedraw = 207,
|
||||
|
||||
//Object Functions
|
||||
ObjectCreate = 208,
|
||||
@@ -227,6 +225,58 @@
|
||||
ObjectSet = 231,
|
||||
ObjectSetFiboDescription = 232,
|
||||
ObjectSetText = 233,
|
||||
ObjectType = 234
|
||||
ObjectType = 234,
|
||||
|
||||
UnlockTicks = 235,
|
||||
|
||||
//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,
|
||||
WindowBarsPerChart = 264,
|
||||
WindowExpertName = 265,
|
||||
WindowFind = 266,
|
||||
WindowFirstVisibleBar = 267,
|
||||
WindowHandle = 268,
|
||||
WindowIsVisible = 269,
|
||||
WindowOnDropped = 270,
|
||||
WindowPriceMax = 271,
|
||||
WindowPriceMin = 272,
|
||||
WindowPriceOnDropped = 273,
|
||||
WindowRedraw = 274,
|
||||
WindowScreenShot = 275,
|
||||
WindowTimeOnDropped = 276,
|
||||
WindowsTotal = 277,
|
||||
WindowXOnDropped = 278,
|
||||
WindowYOnDropped = 279,
|
||||
|
||||
ChangeAccount = 280
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{
|
||||
public enum MtEventTypes
|
||||
{
|
||||
LastTimeBar = 1
|
||||
LastTimeBar = 1,
|
||||
ChartEvent = 2
|
||||
}
|
||||
}
|
||||
|
||||
+2
-11
@@ -11,16 +11,7 @@ namespace MtApi
|
||||
public double Close { get; set; }
|
||||
public double High { get; set; }
|
||||
public double Low { get; set; }
|
||||
|
||||
public DateTime OpenTime
|
||||
{
|
||||
get { return MtApiTimeConverter.ConvertFromMtTime(MtOpenTime); }
|
||||
}
|
||||
|
||||
public DateTime CloseTime
|
||||
{
|
||||
get { return MtApiTimeConverter.ConvertFromMtTime(MtCloseTime); }
|
||||
}
|
||||
|
||||
public DateTime OpenTime => MtApiTimeConverter.ConvertFromMtTime(MtOpenTime);
|
||||
public DateTime CloseTime => MtApiTimeConverter.ConvertFromMtTime(MtCloseTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.33.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.33.0")]
|
||||
[assembly: AssemblyVersion("1.0.38.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.38.0")]
|
||||
@@ -4,11 +4,18 @@ namespace MtApi
|
||||
{
|
||||
public class TimeBarArgs: EventArgs
|
||||
{
|
||||
internal TimeBarArgs(int expertHandle, MtTimeBar timeBar)
|
||||
: this(timeBar)
|
||||
{
|
||||
ExpertHandle = expertHandle;
|
||||
}
|
||||
|
||||
public TimeBarArgs(MtTimeBar timeBar)
|
||||
{
|
||||
TimeBar = timeBar;
|
||||
}
|
||||
|
||||
public MtTimeBar TimeBar { get; private set; }
|
||||
public int ExpertHandle { get; }
|
||||
public MtTimeBar TimeBar { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlTradeCheckResult
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace MtApi5
|
||||
public class MqlTradeRequest
|
||||
{
|
||||
public ENUM_TRADE_REQUEST_ACTIONS Action { get; set; } // Trade operation type
|
||||
public uint Magic { get; set; } // Expert Advisor ID (magic number)
|
||||
public ulong Magic { get; set; } // Expert Advisor ID (magic number)
|
||||
public ulong Order { get; set; } // Order ticket
|
||||
public string Symbol { get; set; } // Trade symbol
|
||||
public double Volume { get; set; } // Requested volume for a deal in lots
|
||||
@@ -13,11 +13,13 @@ namespace MtApi5
|
||||
public double Stoplimit { get; set; } // StopLimit level of the order
|
||||
public double Sl { get; set; } // Stop Loss level of the order
|
||||
public double Tp { get; set; } // Take Profit level of the order
|
||||
public uint Deviation { get; set; } // Maximal possible deviation from the requested price
|
||||
public ulong Deviation { get; set; } // Maximal possible deviation from the requested price
|
||||
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)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
namespace MtApi5
|
||||
{
|
||||
public class MqlTradeResult
|
||||
{
|
||||
@@ -27,6 +23,11 @@ namespace MtApi5
|
||||
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
|
||||
public uint Request_id { get; private set; } // 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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace MtApi5
|
||||
namespace MtApi5
|
||||
{
|
||||
internal enum Mt5CommandType
|
||||
{
|
||||
@@ -105,6 +100,7 @@ namespace MtApi5
|
||||
//CTrade
|
||||
PositionClose = 64,
|
||||
PositionOpen = 65,
|
||||
PositionOpenWithResult = 1065,
|
||||
|
||||
//Backtesting
|
||||
BacktestingReady = 66,
|
||||
@@ -114,5 +110,66 @@ namespace MtApi5
|
||||
|
||||
//Requests
|
||||
MtRequest = 155,
|
||||
|
||||
PositionSelectByTicket = 69,
|
||||
|
||||
ObjectCreate = 70,
|
||||
ObjectName = 71,
|
||||
ObjectDelete = 72,
|
||||
ObjectsDeleteAll = 73,
|
||||
ObjectFind = 74,
|
||||
ObjectGetTimeByValue = 75,
|
||||
ObjectGetValueByTime = 76,
|
||||
ObjectMove = 77,
|
||||
ObjectsTotal = 78,
|
||||
ObjectGetDouble = 79,
|
||||
ObjectGetInteger = 80,
|
||||
ObjectGetString = 81,
|
||||
ObjectSetDouble = 82,
|
||||
ObjectSetInteger = 83,
|
||||
ObjectSetString = 84,
|
||||
//TextSetFont = 85,
|
||||
//TextOut = 86,
|
||||
//TextGetSize = 87,
|
||||
|
||||
iAC = 88,
|
||||
iAD = 89,
|
||||
iADX = 90,
|
||||
iADXWilder = 91,
|
||||
iAlligator = 92,
|
||||
iAMA = 93,
|
||||
iAO = 94,
|
||||
iATR = 95,
|
||||
iBearsPower = 96,
|
||||
iBands = 97,
|
||||
iBullsPower = 98,
|
||||
iCCI = 99,
|
||||
iChaikin = 100,
|
||||
//iCustom = 101,
|
||||
iDEMA = 102,
|
||||
iDeMarker = 103,
|
||||
iEnvelopes = 104,
|
||||
iForce = 105,
|
||||
iFractals = 106,
|
||||
iFrAMA = 107,
|
||||
iGator = 108,
|
||||
iIchimoku = 109,
|
||||
iBWMFI = 110,
|
||||
iMomentum = 111,
|
||||
iMFI = 112,
|
||||
iMA = 113,
|
||||
iOsMA = 114,
|
||||
iMACD = 115,
|
||||
iOBV = 116,
|
||||
iSAR = 117,
|
||||
iRSI = 118,
|
||||
iRVI = 119,
|
||||
iStdDev = 120,
|
||||
iStochastic = 121,
|
||||
iTEMA = 122,
|
||||
iTriX = 123,
|
||||
iWPR = 124,
|
||||
iVIDyA = 125,
|
||||
iVolumes = 126
|
||||
}
|
||||
}
|
||||
|
||||
+664
-212
@@ -1,200 +1,10 @@
|
||||
namespace MtApi5
|
||||
{
|
||||
public enum ENUM_TRADE_REQUEST_ACTIONS
|
||||
{
|
||||
TRADE_ACTION_DEAL = 1, //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
TRADE_ACTION_PENDING = 5, //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
TRADE_ACTION_SLTP = 6, //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
TRADE_ACTION_MODIFY = 7, //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
TRADE_ACTION_REMOVE = 8 //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE
|
||||
{
|
||||
ORDER_TYPE_BUY = 0, //Market Buy order
|
||||
ORDER_TYPE_SELL = 1, //Market Sell order
|
||||
ORDER_TYPE_BUY_LIMIT = 2, //Buy Limit pending order
|
||||
ORDER_TYPE_SELL_LIMIT = 3, //Sell Limit pending order
|
||||
ORDER_TYPE_BUY_STOP = 4, //Buy Stop pending order
|
||||
ORDER_TYPE_SELL_STOP = 5, //Sell Stop pending order
|
||||
ORDER_TYPE_BUY_STOP_LIMIT = 6, //Upon reaching the order price, a pending Buy Limit order is places at the StopLimit price
|
||||
ORDER_TYPE_SELL_STOP_LIMIT = 7, //Upon reaching the order price, a pending Sell Limit order is places at the StopLimit price
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE_FILLING
|
||||
{
|
||||
ORDER_FILLING_FOK = 0,
|
||||
ORDER_FILLING_IOC = 1,
|
||||
ORDER_FILLING_RETURN = 2
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE_TIME
|
||||
{
|
||||
ORDER_TIME_GTC = 0,
|
||||
ORDER_TIME_DAY = 1,
|
||||
ORDER_TIME_SPECIFIED = 2,
|
||||
ORDER_TIME_SPECIFIED_DAY = 3
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_DOUBLE
|
||||
{
|
||||
POSITION_VOLUME = 3, //Position volume
|
||||
POSITION_PRICE_OPEN = 4, //Position open price
|
||||
POSITION_SL = 6, //Stop Loss level of opened position
|
||||
POSITION_TP = 7, //Take Profit level of opened position
|
||||
POSITION_PRICE_CURRENT = 5, //Current price of the position symbol
|
||||
POSITION_COMMISSION = 8, //Commission
|
||||
POSITION_SWAP = 9, //Cumulative swap
|
||||
POSITION_PROFIT = 10 //Current profit
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_INTEGER
|
||||
{
|
||||
POSITION_TIME = 1, //Position open time
|
||||
POSITION_TYPE = 2, //Position type
|
||||
POSITION_MAGIC = 12, //Position magic number
|
||||
POSITION_IDENTIFIER = 13 //Position identifier is a unique number that is assigned to every newly opened position and doesn't change during the entire lifetime of the position. Position turnover doesn't change its identifier.
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_TYPE
|
||||
{
|
||||
POSITION_TYPE_BUY = 0, //Buy
|
||||
POSITION_TYPE_SELL = 1 //Sell
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_STRING
|
||||
{
|
||||
POSITION_SYMBOL = 0, //Symbol of the position
|
||||
POSITION_COMMENT = 11 //Position comment
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_DOUBLE
|
||||
{
|
||||
ORDER_VOLUME_INITIAL = 7, //Order initial volume
|
||||
ORDER_VOLUME_CURRENT = 8, //Order current volume
|
||||
ORDER_PRICE_OPEN = 9, //Price specified in the order
|
||||
ORDER_SL = 12, //Stop Loss value
|
||||
ORDER_TP = 13, //Take Profit value
|
||||
ORDER_PRICE_CURRENT = 10, //The current price of the order symbol
|
||||
ORDER_PRICE_STOPLIMIT = 11 //The Limit order price for the StopLimit order
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_STRING
|
||||
{
|
||||
ORDER_SYMBOL = 0, //Symbol of the order
|
||||
ORDER_COMMENT = 16 //Order comment
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_INTEGER
|
||||
{
|
||||
ORDER_TIME_SETUP = 1, //Order setup time
|
||||
ORDER_TYPE = 4, //Order type
|
||||
ORDER_STATE = 14, //Order state
|
||||
ORDER_TIME_EXPIRATION = 2, //Order expiration time
|
||||
ORDER_TIME_DONE = 3, //Order execution or cancellation time
|
||||
ORDER_TYPE_FILLING = 5, //Order filling type
|
||||
ORDER_TYPE_TIME = 6, //Order lifetime
|
||||
ORDER_MAGIC = 15, //ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number)
|
||||
ORDER_POSITION_ID = 17 //Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of exactly this position is set to the executed order at this moment.
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_DOUBLE
|
||||
{
|
||||
DEAL_VOLUME = 5,
|
||||
DEAL_PRICE = 6,
|
||||
DEAL_COMMISSION = 7,
|
||||
DEAL_SWAP = 8,
|
||||
DEAL_PROFIT = 9
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_STRING
|
||||
{
|
||||
DEAL_SYMBOL = 0,
|
||||
DEAL_COMMENT = 10
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_TYPE
|
||||
{
|
||||
DEAL_TYPE_BUY = 0,
|
||||
DEAL_TYPE_SELL = 1,
|
||||
DEAL_TYPE_BALANCE = 2,
|
||||
DEAL_TYPE_CREDIT = 3,
|
||||
DEAL_TYPE_CHARGE = 4,
|
||||
DEAL_TYPE_CORRECTION = 5,
|
||||
DEAL_TYPE_BONUS = 6,
|
||||
DEAL_TYPE_COMMISSION = 7,
|
||||
DEAL_TYPE_COMMISSION_DAILY = 8,
|
||||
DEAL_TYPE_COMMISSION_MONTHLY = 9,
|
||||
DEAL_TYPE_COMMISSION_AGENT_DAILY = 10,
|
||||
DEAL_TYPE_COMMISSION_AGENT_MONTHLY = 11,
|
||||
DEAL_TYPE_INTEREST = 12,
|
||||
DEAL_TYPE_BUY_CANCELED = 13,
|
||||
DEAL_TYPE_SELL_CANCELED = 14
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_ENTRY
|
||||
{
|
||||
DEAL_ENTRY_IN = 0,
|
||||
DEAL_ENTRY_OUT = 1,
|
||||
DEAL_ENTRY_INOUT = 2,
|
||||
DEAL_ENTRY_STATE = 255
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_INTEGER
|
||||
{
|
||||
DEAL_ORDER = 1,
|
||||
DEAL_TIME = 2,
|
||||
DEAL_TYPE = 3,
|
||||
DEAL_ENTRY = 4,
|
||||
DEAL_MAGIC = 11,
|
||||
DEAL_POSITION_ID = 12
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_INTEGER
|
||||
{
|
||||
ACCOUNT_LOGIN = 0,
|
||||
ACCOUNT_TRADE_MODE = 32,
|
||||
ACCOUNT_LEVERAGE = 35,
|
||||
ACCOUNT_LIMIT_ORDERS = 47,
|
||||
ACCOUNT_MARGIN_SO_MODE = 44,
|
||||
ACCOUNT_TRADE_ALLOWED = 33,
|
||||
ACCOUNT_TRADE_EXPERT = 34
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_DOUBLE
|
||||
{
|
||||
ACCOUNT_BALANCE = 37,
|
||||
ACCOUNT_CREDIT = 38,
|
||||
ACCOUNT_PROFIT = 39,
|
||||
ACCOUNT_EQUITY = 40,
|
||||
ACCOUNT_MARGIN = 41,
|
||||
ACCOUNT_FREEMARGIN = 42,
|
||||
ACCOUNT_MARGIN_LEVEL = 43,
|
||||
ACCOUNT_MARGIN_SO_CALL = 45,
|
||||
ACCOUNT_MARGIN_SO_SO = 46
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_STRING
|
||||
{
|
||||
ACCOUNT_NAME = 1,
|
||||
ACCOUNT_SERVER = 3,
|
||||
ACCOUNT_CURRENCY = 36,
|
||||
ACCOUNT_COMPANY = 2
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_TRADE_MODE
|
||||
{
|
||||
ACCOUNT_TRADE_MODE_DEMO = 0,
|
||||
ACCOUNT_TRADE_MODE_CONTEST = 1,
|
||||
ACCOUNT_TRADE_MODE_REAL = 2
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_STOPOUT_MODE
|
||||
{
|
||||
ACCOUNT_STOPOUT_MODE_PERCENT = 0,
|
||||
ACCOUNT_STOPOUT_MODE_MONEY = 1
|
||||
}
|
||||
// Chart Constants:
|
||||
|
||||
#region Chart Timeframes
|
||||
|
||||
public enum ENUM_TIMEFRAMES
|
||||
{
|
||||
PERIOD_CURRENT = 0,
|
||||
@@ -221,19 +31,66 @@
|
||||
PERIOD_MN1 = 49153
|
||||
}
|
||||
|
||||
public enum ENUM_SERIES_INFO_INTEGER
|
||||
#endregion //Chart Timeframes
|
||||
|
||||
|
||||
// Environment State:
|
||||
|
||||
#region Client Terminal Properties
|
||||
|
||||
public enum ENUM_TERMINAL_INFO_INTEGER
|
||||
{
|
||||
SERIES_BARS_COUNT = 0,
|
||||
SERIES_FIRSTDATE = 1,
|
||||
SERIES_LASTBAR_DATE = 5,
|
||||
SERIES_SERVER_FIRSTDATE = 2,
|
||||
SERIES_TERMINAL_FIRSTDATE = 3,
|
||||
SERIES_SYNCHRONIZED = 4
|
||||
TERMINAL_BUILD = 5,
|
||||
TERMINAL_COMMUNITY_ACCOUNT = 23,
|
||||
TERMINAL_COMMUNITY_CONNECTION = 24,
|
||||
TERMINAL_CONNECTED = 6,
|
||||
TERMINAL_DLLS_ALLOWED = 7,
|
||||
TERMINAL_TRADE_ALLOWED = 8,
|
||||
TERMINAL_EMAIL_ENABLED = 9,
|
||||
TERMINAL_FTP_ENABLED = 10,
|
||||
TERMINAL_NOTIFICATIONS_ENABLED = 26,
|
||||
TERMINAL_MAXBARS = 11,
|
||||
TERMINAL_MQID = 22,
|
||||
TERMINAL_CODEPAGE = 12,
|
||||
TERMINAL_CPU_CORES = 21,
|
||||
TERMINAL_DISK_SPACE = 20,
|
||||
TERMINAL_MEMORY_PHYSICAL = 14,
|
||||
TERMINAL_MEMORY_TOTAL = 15,
|
||||
TERMINAL_MEMORY_AVAILABLE = 16,
|
||||
TERMINAL_MEMORY_USED = 17,
|
||||
TERMINAL_X64 = 18,
|
||||
TERMINAL_OPENCL_SUPPORT = 19,
|
||||
TERMINAL_SCREEN_DPI = 27,
|
||||
TERMINAL_PING_LAST = 29
|
||||
}
|
||||
|
||||
public enum ENUM_TERMINAL_INFO_DOUBLE
|
||||
{
|
||||
TERMINAL_COMMUNITY_BALANCE = 25
|
||||
}
|
||||
|
||||
public enum ENUM_TERMINAL_INFO_STRING
|
||||
{
|
||||
TERMINAL_LANGUAGE = 13,
|
||||
TERMINAL_COMPANY = 0,
|
||||
TERMINAL_NAME = 1,
|
||||
TERMINAL_PATH = 2,
|
||||
TERMINAL_DATA_PATH = 3,
|
||||
TERMINAL_COMMONDATA_PATH = 4
|
||||
}
|
||||
|
||||
#endregion //Client Terminal Properties
|
||||
|
||||
#region Symbol Properties
|
||||
|
||||
public enum ENUM_SYMBOL_INFO_INTEGER
|
||||
{
|
||||
SYMBOL_CUSTOM = 78,
|
||||
SYMBOL_BACKGROUND_COLOR = 79,
|
||||
SYMBOL_CHART_MODE = 80,
|
||||
SYMBOL_SELECT = 0,
|
||||
//FIXME: SYMBOL_VISIBLE not found in MQL5 environment!
|
||||
//SYMBOL_VISIBLE = ?
|
||||
SYMBOL_SESSION_DEALS = 56,
|
||||
SYMBOL_SESSION_BUY_ORDERS = 60,
|
||||
SYMBOL_SESSION_SELL_ORDERS = 62,
|
||||
@@ -254,8 +111,14 @@
|
||||
SYMBOL_TRADE_EXEMODE = 33,
|
||||
SYMBOL_SWAP_MODE = 37,
|
||||
SYMBOL_SWAP_ROLLOVER3DAYS = 40,
|
||||
SYMBOL_MARGIN_HEDGED_USE_LEG = 82,
|
||||
SYMBOL_EXPIRATION_MODE = 49,
|
||||
SYMBOL_FILLING_MODE = 50
|
||||
SYMBOL_FILLING_MODE = 50,
|
||||
SYMBOL_ORDER_MODE = 71,
|
||||
SYMBOL_ORDER_GTC_MODE = 81,
|
||||
SYMBOL_ORDER_CLOSEBY = 64,
|
||||
SYMBOL_OPTION_MODE = 75,
|
||||
SYMBOL_OPTION_RIGHT = 74,
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_INFO_DOUBLE
|
||||
@@ -269,12 +132,16 @@
|
||||
SYMBOL_LAST = 7,
|
||||
SYMBOL_LASTHIGH = 8,
|
||||
SYMBOL_LASTLOW = 9,
|
||||
SYMBOL_OPTION_STRIKE = 72,
|
||||
SYMBOL_POINT = 16,
|
||||
SYMBOL_TRADE_TICK_VALUE = 26,
|
||||
SYMBOL_TRADE_TICK_VALUE_PROFIT = 53,
|
||||
SYMBOL_TRADE_TICK_VALUE_LOSS = 54,
|
||||
SYMBOL_TRADE_TICK_SIZE = 27,
|
||||
SYMBOL_TRADE_CONTRACT_SIZE = 28,
|
||||
SYMBOL_TRADE_ACCRUED_INTEREST = 87,
|
||||
SYMBOL_TRADE_FACE_VALUE = 86,
|
||||
SYMBOL_TRADE_LIQUIDITY_RATE = 85,
|
||||
SYMBOL_VOLUME_MIN = 34,
|
||||
SYMBOL_VOLUME_MAX = 35,
|
||||
SYMBOL_VOLUME_STEP = 36,
|
||||
@@ -283,11 +150,11 @@
|
||||
SYMBOL_SWAP_SHORT = 39,
|
||||
SYMBOL_MARGIN_INITIAL = 42,
|
||||
SYMBOL_MARGIN_MAINTENANCE = 43,
|
||||
SYMBOL_MARGIN_LONG = 44,
|
||||
SYMBOL_MARGIN_SHORT = 45,
|
||||
SYMBOL_MARGIN_LIMIT = 46,
|
||||
SYMBOL_MARGIN_STOP = 47,
|
||||
SYMBOL_MARGIN_STOPLIMIT = 48,
|
||||
SYMBOL_MARGIN_LONG = 44, //FIXME: Undocumented!
|
||||
SYMBOL_MARGIN_SHORT = 45, //FIXME: Undocumented!
|
||||
SYMBOL_MARGIN_LIMIT = 46, //FIXME: Undocumented!
|
||||
SYMBOL_MARGIN_STOP = 47, //FIXME: Undocumented!
|
||||
SYMBOL_MARGIN_STOPLIMIT = 48, //FIXME: Undocumented!
|
||||
SYMBOL_SESSION_VOLUME = 57,
|
||||
SYMBOL_SESSION_TURNOVER = 58,
|
||||
SYMBOL_SESSION_INTEREST = 59,
|
||||
@@ -298,20 +165,80 @@
|
||||
SYMBOL_SESSION_AW = 66,
|
||||
SYMBOL_SESSION_PRICE_SETTLEMENT = 67,
|
||||
SYMBOL_SESSION_PRICE_LIMIT_MIN = 68,
|
||||
SYMBOL_SESSION_PRICE_LIMIT_MAX = 69
|
||||
SYMBOL_SESSION_PRICE_LIMIT_MAX = 69,
|
||||
SYMBOL_MARGIN_HEDGED = 77
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_INFO_STRING
|
||||
{
|
||||
SYMBOL_BASIS = 73,
|
||||
SYMBOL_CURRENCY_BASE = 22,
|
||||
SYMBOL_CURRENCY_PROFIT = 23,
|
||||
SYMBOL_CURRENCY_MARGIN = 24,
|
||||
SYMBOL_BANK = 19,
|
||||
SYMBOL_DESCRIPTION = 20,
|
||||
SYMBOL_FORMULA = 84,
|
||||
SYMBOL_PAGE = 83,
|
||||
SYMBOL_ISIN = 70,
|
||||
SYMBOL_PATH = 21
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_CHART_MODE
|
||||
{
|
||||
SYMBOL_CHART_MODE_BID = 0,
|
||||
SYMBOL_CHART_MODE_LAST = 1
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_ORDER_GTC_MODE
|
||||
{
|
||||
SYMBOL_ORDERS_GTC = 0,
|
||||
SYMBOL_ORDERS_DAILY = 1,
|
||||
SYMBOL_ORDERS_DAILY_EXCLUDING_STOPS = 2
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_CALC_MODE
|
||||
{
|
||||
SYMBOL_CALC_MODE_FOREX = 0,
|
||||
SYMBOL_CALC_MODE_FUTURES = 1,
|
||||
SYMBOL_CALC_MODE_CFD = 2,
|
||||
SYMBOL_CALC_MODE_CFDINDEX = 3,
|
||||
SYMBOL_CALC_MODE_CFDLEVERAGE = 4,
|
||||
SYMBOL_CALC_MODE_EXCH_STOCKS = 32,
|
||||
SYMBOL_CALC_MODE_EXCH_FUTURES = 33,
|
||||
SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS = 34,
|
||||
SYMBOL_CALC_MODE_SERV_COLLATERAL = 64
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_TRADE_MODE
|
||||
{
|
||||
SYMBOL_TRADE_MODE_DISABLED = 0,
|
||||
SYMBOL_TRADE_MODE_LONGONLY = 1,
|
||||
SYMBOL_TRADE_MODE_SHORTONLY = 2,
|
||||
SYMBOL_TRADE_MODE_CLOSEONLY = 3,
|
||||
SYMBOL_TRADE_MODE_FULL = 4
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_TRADE_EXECUTION
|
||||
{
|
||||
SYMBOL_TRADE_EXECUTION_REQUEST = 0,
|
||||
SYMBOL_TRADE_EXECUTION_INSTANT = 1,
|
||||
SYMBOL_TRADE_EXECUTION_MARKET = 2,
|
||||
SYMBOL_TRADE_EXECUTION_EXCHANGE = 3
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_SWAP_MODE
|
||||
{
|
||||
SYMBOL_SWAP_MODE_DISABLED = 0,
|
||||
SYMBOL_SWAP_MODE_POINTS = 1,
|
||||
SYMBOL_SWAP_MODE_CURRENCY_SYMBOL = 2,
|
||||
SYMBOL_SWAP_MODE_CURRENCY_MARGIN = 3,
|
||||
SYMBOL_SWAP_MODE_CURRENCY_DEPOSIT = 4,
|
||||
SYMBOL_SWAP_MODE_INTEREST_CURRENT = 5,
|
||||
SYMBOL_SWAP_MODE_INTEREST_OPEN = 6,
|
||||
SYMBOL_SWAP_MODE_REOPEN_CURRENT = 7,
|
||||
SYMBOL_SWAP_MODE_REOPEN_BID = 8
|
||||
}
|
||||
|
||||
public enum ENUM_DAY_OF_WEEK
|
||||
{
|
||||
SUNDAY = 0,
|
||||
@@ -323,11 +250,536 @@
|
||||
SATURDAY = 6
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_OPTION_RIGHT
|
||||
{
|
||||
SYMBOL_OPTION_RIGHT_CALL = 0,
|
||||
SYMBOL_OPTION_RIGHT_PUT = 1
|
||||
}
|
||||
|
||||
public enum ENUM_SYMBOL_OPTION_MODE
|
||||
{
|
||||
SYMBOL_OPTION_MODE_EUROPEAN = 0,
|
||||
SYMBOL_OPTION_MODE_AMERICAN = 1
|
||||
}
|
||||
|
||||
#endregion //Symbol Properties
|
||||
|
||||
#region Account Properties
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_INTEGER
|
||||
{
|
||||
ACCOUNT_LOGIN = 0, //Account number
|
||||
ACCOUNT_TRADE_MODE = 32, //Account trade mode
|
||||
ACCOUNT_LEVERAGE = 35, //Account leverage
|
||||
ACCOUNT_LIMIT_ORDERS = 47, //Maximum allowed number of active pending orders
|
||||
ACCOUNT_MARGIN_SO_MODE = 44, //Mode for setting the minimal allowed margin
|
||||
ACCOUNT_TRADE_ALLOWED = 33, //Allowed trade for the current account
|
||||
ACCOUNT_TRADE_EXPERT = 34, //Allowed trade for an Expert Advisor
|
||||
ACCOUNT_MARGIN_MODE = 53 //Margin calculation mode
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_DOUBLE
|
||||
{
|
||||
ACCOUNT_BALANCE = 37, //Account balance in the deposit currency
|
||||
ACCOUNT_CREDIT = 38, //Account credit in the deposit currency
|
||||
ACCOUNT_PROFIT = 39, //Current profit of an account in the deposit currency
|
||||
ACCOUNT_EQUITY = 40, //Account equity in the deposit currency
|
||||
ACCOUNT_MARGIN = 41, //Account margin used in the deposit currency
|
||||
ACCOUNT_MARGIN_FREE = 42, //Free margin of an account in the deposit currency
|
||||
ACCOUNT_MARGIN_LEVEL = 43, //Account margin level in percents
|
||||
ACCOUNT_MARGIN_SO_CALL = 45, //Margin call level
|
||||
ACCOUNT_MARGIN_SO_SO = 46, //Margin stop out level
|
||||
ACCOUNT_MARGIN_INITIAL = 48, //Initial margin
|
||||
ACCOUNT_MARGIN_MAINTENANCE = 49, //Maintenance margin
|
||||
ACCOUNT_ASSETS = 50, //The current assets of an account
|
||||
ACCOUNT_LIABILITIES = 51, //The current liabilities on an account
|
||||
ACCOUNT_COMMISSION_BLOCKED = 52 //The current blocked commission amount on an account
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_INFO_STRING
|
||||
{
|
||||
ACCOUNT_NAME = 1, //Client name
|
||||
ACCOUNT_SERVER = 3, //Trade server name
|
||||
ACCOUNT_CURRENCY = 36, //Account currency
|
||||
ACCOUNT_COMPANY = 2 //Name of a company that serves the account
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_TRADE_MODE
|
||||
{
|
||||
ACCOUNT_TRADE_MODE_DEMO = 0, //Demo account
|
||||
ACCOUNT_TRADE_MODE_CONTEST = 1, //Contest account
|
||||
ACCOUNT_TRADE_MODE_REAL = 2 //Real account
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_STOPOUT_MODE
|
||||
{
|
||||
ACCOUNT_STOPOUT_MODE_PERCENT = 0, //Account stop out mode in percents
|
||||
ACCOUNT_STOPOUT_MODE_MONEY = 1 //Account stop out mode in money
|
||||
}
|
||||
|
||||
public enum ENUM_ACCOUNT_MARGIN_MODE
|
||||
{
|
||||
ACCOUNT_MARGIN_MODE_RETAIL_NETTING = 0, //Used for the OTC markets to interpret positions in the "netting" mode
|
||||
ACCOUNT_MARGIN_MODE_EXCHANGE = 1, //Used for the exchange markets
|
||||
ACCOUNT_MARGIN_MODE_RETAIL_HEDGING = 2 //Used for the exchange markets where individual positions are possible
|
||||
}
|
||||
|
||||
#endregion //Account Properties
|
||||
|
||||
// Trade Constants:
|
||||
|
||||
#region History Database Properties
|
||||
|
||||
public enum ENUM_SERIES_INFO_INTEGER
|
||||
{
|
||||
SERIES_BARS_COUNT = 0, //Bars count for the symbol-period for the current moment
|
||||
SERIES_FIRSTDATE = 1, //The very first date for the symbol-period for the current moment
|
||||
SERIES_LASTBAR_DATE = 5, //Open time of the last bar of the symbol-period
|
||||
SERIES_SERVER_FIRSTDATE = 2, //The very first date in the history of the symbol on the server regardless of the timeframe
|
||||
SERIES_TERMINAL_FIRSTDATE = 3, //The very first date in the history of the symbol in the client terminal, regardless of the timeframe
|
||||
SERIES_SYNCHRONIZED = 4 //Symbol/period data synchronization flag for the current moment
|
||||
}
|
||||
|
||||
#endregion //History Database Properties
|
||||
|
||||
#region Order Properties
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_INTEGER
|
||||
{
|
||||
ORDER_TICKET = 22, //Order ticket. Unique number assigned to each order
|
||||
ORDER_TIME_SETUP = 1, //Order setup time
|
||||
ORDER_TYPE = 4, //Order type
|
||||
ORDER_STATE = 14, //Order state
|
||||
ORDER_TIME_EXPIRATION = 2, //Order expiration time
|
||||
ORDER_TIME_DONE = 3, //Order execution or cancellation time
|
||||
ORDER_TIME_SETUP_MSC = 18, //The time of placing an order for execution in milliseconds since 01.01.1970
|
||||
ORDER_TIME_DONE_MSC = 19, //Order execution/cancellation time in milliseconds since 01.01.1970
|
||||
ORDER_TYPE_FILLING = 5, //Order filling type
|
||||
ORDER_TYPE_TIME = 6, //Order lifetime
|
||||
ORDER_MAGIC = 15, //ID of an Expert Advisor that has placed the order (designed to ensure that each Expert Advisor places its own unique number)
|
||||
ORDER_REASON = 23, //The reason or source for placing an order
|
||||
ORDER_POSITION_ID = 17, //Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of exactly this position is set to the executed order at this moment.
|
||||
ORDER_POSITION_BY_ID = 21 //Identifier of an opposite position used for closing by order ORDER_TYPE_CLOSE_BY
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_DOUBLE
|
||||
{
|
||||
ORDER_VOLUME_INITIAL = 7, //Order initial volume
|
||||
ORDER_VOLUME_CURRENT = 8, //Order current volume
|
||||
ORDER_PRICE_OPEN = 9, //Price specified in the order
|
||||
ORDER_SL = 12, //Stop Loss value
|
||||
ORDER_TP = 13, //Take Profit value
|
||||
ORDER_PRICE_CURRENT = 10, //The current price of the order symbol
|
||||
ORDER_PRICE_STOPLIMIT = 11 //The Limit order price for the StopLimit order
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_PROPERTY_STRING
|
||||
{
|
||||
ORDER_SYMBOL = 0, //Symbol of the order
|
||||
ORDER_COMMENT = 16, //Order comment
|
||||
ORDER_EXTERNAL_ID = 20 //Order identifier in an external trading system (on the Exchange)
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE
|
||||
{
|
||||
ORDER_TYPE_BUY = 0, //Market Buy order
|
||||
ORDER_TYPE_SELL = 1, //Market Sell order
|
||||
ORDER_TYPE_BUY_LIMIT = 2, //Buy Limit pending order
|
||||
ORDER_TYPE_SELL_LIMIT = 3, //Sell Limit pending order
|
||||
ORDER_TYPE_BUY_STOP = 4, //Buy Stop pending order
|
||||
ORDER_TYPE_SELL_STOP = 5, //Sell Stop pending order
|
||||
ORDER_TYPE_BUY_STOP_LIMIT = 6, //Upon reaching the order price, a pending Buy Limit order is places at the StopLimit price
|
||||
ORDER_TYPE_SELL_STOP_LIMIT = 7, //Upon reaching the order price, a pending Sell Limit order is places at the StopLimit price
|
||||
ORDER_TYPE_CLOSE_BY = 8 //Order to close a position by an opposite one
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_STATE
|
||||
{
|
||||
ORDER_STATE_STARTED = 0, //Order checked, but not yet accepted by broker
|
||||
ORDER_STATE_PLACED = 1, //Order accepted
|
||||
ORDER_STATE_CANCELED = 2, //Order canceled by client
|
||||
ORDER_STATE_PARTIAL = 3, //Order partially executed
|
||||
ORDER_STATE_FILLED = 4, //Order fully executed
|
||||
ORDER_STATE_REJECTED = 5, //Order rejected
|
||||
ORDER_STATE_EXPIRED = 6, //Order expired
|
||||
ORDER_STATE_REQUEST_ADD = 7, //Order is being registered (placing to the trading system)
|
||||
ORDER_STATE_REQUEST_MODIFY = 8, //Order is being modified (changing its parameters)
|
||||
ORDER_STATE_REQUEST_CANCEL = 9 //Order is being deleted (deleting from the trading system)
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE_FILLING
|
||||
{
|
||||
ORDER_FILLING_FOK = 0,
|
||||
ORDER_FILLING_IOC = 1,
|
||||
ORDER_FILLING_RETURN = 2
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_TYPE_TIME
|
||||
{
|
||||
ORDER_TIME_GTC = 0,
|
||||
ORDER_TIME_DAY = 1,
|
||||
ORDER_TIME_SPECIFIED = 2,
|
||||
ORDER_TIME_SPECIFIED_DAY = 3
|
||||
}
|
||||
|
||||
public enum ENUM_ORDER_REASON
|
||||
{
|
||||
ORDER_REASON_CLIENT = 0, //The order was placed from a desktop terminal
|
||||
ORDER_REASON_MOBILE = 1, //The order was placed from a mobile application
|
||||
ORDER_REASON_WEB = 2, //The order was placed from a web platform
|
||||
ORDER_REASON_EXPERT = 3, //The order was placed from an MQL5-program, i.e. by an Expert Advisor or a script
|
||||
ORDER_REASON_SL = 4, //The order was placed as a result of Stop Loss activation
|
||||
ORDER_REASON_TP = 5, //The order was placed as a result of Take Profit activation
|
||||
ORDER_REASON_SO = 6 //The order was placed as a result of the Stop Out event
|
||||
}
|
||||
|
||||
#endregion //Order Properties
|
||||
|
||||
#region Position Properties
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_INTEGER
|
||||
{
|
||||
POSITION_TICKET = 17, //Position ticket
|
||||
POSITION_TIME = 1, //Position open time
|
||||
POSITION_TIME_MSC = 14, //Position opening time in milliseconds since 01.01.1970
|
||||
POSITION_TIME_UPDATE = 15, //Position changing time in seconds since 01.01.1970
|
||||
POSITION_TIME_UPDATE_MSC = 16, //Position changing time in milliseconds since 01.01.1970
|
||||
POSITION_TYPE = 2, //Position type
|
||||
POSITION_MAGIC = 12, //Position magic number
|
||||
POSITION_IDENTIFIER = 13, //Position identifier is a unique number that is assigned to every newly opened position and doesn't change during the entire lifetime of the position. Position turnover doesn't change its identifier.
|
||||
POSITION_REASON = 18 //The reason for opening a position
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_DOUBLE
|
||||
{
|
||||
POSITION_VOLUME = 3, //Position volume
|
||||
POSITION_PRICE_OPEN = 4, //Position open price
|
||||
POSITION_SL = 6, //Stop Loss level of opened position
|
||||
POSITION_TP = 7, //Take Profit level of opened position
|
||||
POSITION_PRICE_CURRENT = 5, //Current price of the position symbol
|
||||
POSITION_COMMISSION = 8, //FIXME: Undocumented!
|
||||
POSITION_SWAP = 9, //Cumulative swap
|
||||
POSITION_PROFIT = 10 //Current profit
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_PROPERTY_STRING
|
||||
{
|
||||
POSITION_SYMBOL = 0, //Symbol of the position
|
||||
POSITION_COMMENT = 11 //Position comment
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_TYPE
|
||||
{
|
||||
POSITION_TYPE_BUY = 0, //Buy
|
||||
POSITION_TYPE_SELL = 1 //Sell
|
||||
}
|
||||
|
||||
public enum ENUM_POSITION_REASON
|
||||
{
|
||||
POSITION_REASON_CLIENT = 0, //The position was opened as a result of activation of an order placed from a desktop terminal
|
||||
POSITION_REASON_MOBILE = 1, //The position was opened as a result of activation of an order placed from a mobile application
|
||||
POSITION_REASON_WEB = 2, //The position was opened as a result of activation of an order placed from the web platform
|
||||
POSITION_REASON_EXPERT = 3 //The position was opened as a result of activation of an order placed from an MQL5 program
|
||||
}
|
||||
|
||||
#endregion //Position Properties
|
||||
|
||||
#region Deal Properties
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_INTEGER
|
||||
{
|
||||
DEAL_TICKET = 15, //Deal ticket. Unique number assigned to each deal
|
||||
DEAL_ORDER = 1, //Deal order number
|
||||
DEAL_TIME = 2, //Deal time
|
||||
DEAL_TIME_MSC = 13, //The time of a deal execution in milliseconds since 01.01.1970
|
||||
DEAL_TYPE = 3, //Deal type
|
||||
DEAL_ENTRY = 4, //Deal entry - entry in, entry out, reverse
|
||||
DEAL_MAGIC = 11, //Deal magic number
|
||||
DEAL_REASON = 16, //The reason or source for deal execution
|
||||
DEAL_POSITION_ID = 12 //Identifier of a position
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_DOUBLE
|
||||
{
|
||||
DEAL_VOLUME = 5, //Deal volume
|
||||
DEAL_PRICE = 6, //Deal price
|
||||
DEAL_COMMISSION = 7, //Deal commission
|
||||
DEAL_SWAP = 8, //Cumulative swap on close
|
||||
DEAL_PROFIT = 9 //Deal profit
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_PROPERTY_STRING
|
||||
{
|
||||
DEAL_SYMBOL = 0, //Deal symbol
|
||||
DEAL_COMMENT = 10, //Deal comment
|
||||
DEAL_EXTERNAL_ID = 14 //Deal identifier in an external trading system (on the Exchange)
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_TYPE
|
||||
{
|
||||
DEAL_TYPE_BUY = 0, //Buy
|
||||
DEAL_TYPE_SELL = 1, //Sell
|
||||
DEAL_TYPE_BALANCE = 2, //Balance
|
||||
DEAL_TYPE_CREDIT = 3, //Credit
|
||||
DEAL_TYPE_CHARGE = 4, //Additional charge
|
||||
DEAL_TYPE_CORRECTION = 5, //Correction
|
||||
DEAL_TYPE_BONUS = 6, //Bonus
|
||||
DEAL_TYPE_COMMISSION = 7, //Additional commission
|
||||
DEAL_TYPE_COMMISSION_DAILY = 8, //Daily commission
|
||||
DEAL_TYPE_COMMISSION_MONTHLY = 9, //Monthly commission
|
||||
DEAL_TYPE_COMMISSION_AGENT_DAILY = 10, //Daily agent commission
|
||||
DEAL_TYPE_COMMISSION_AGENT_MONTHLY = 11, //Monthly agent commission
|
||||
DEAL_TYPE_INTEREST = 12, //Interest rate
|
||||
DEAL_TYPE_BUY_CANCELED = 13, //Canceled buy deal
|
||||
DEAL_TYPE_SELL_CANCELED = 14, //Canceled sell deal
|
||||
DEAL_DIVIDEND = 15, //Dividend operations
|
||||
DEAL_DIVIDEND_FRANKED = 16, //Franked (non-taxable) dividend operations
|
||||
DEAL_TAX = 17 //Tax charges
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_ENTRY
|
||||
{
|
||||
DEAL_ENTRY_IN = 0, //Entry in
|
||||
DEAL_ENTRY_OUT = 1, //Entry out
|
||||
DEAL_ENTRY_INOUT = 2, //Reverse
|
||||
DEAL_ENTRY_STATE = 255 //Close a position by an opposite one
|
||||
}
|
||||
|
||||
public enum ENUM_DEAL_REASON
|
||||
{
|
||||
DEAL_REASON_CLIENT = 0, //The deal was executed as a result of activation of an order placed from a desktop terminal
|
||||
DEAL_REASON_MOBILE = 1, //The deal was executed as a result of activation of an order placed from a mobile application
|
||||
DEAL_REASON_WEB = 2, //The deal was executed as a result of activation of an order placed from the web platform
|
||||
DEAL_REASON_EXPERT = 3, //The deal was executed as a result of activation of an order placed from an MQL5 program, i.e. an Expert Advisor or a script
|
||||
DEAL_REASON_SL = 4, //The deal was executed as a result of Stop Loss activation
|
||||
DEAL_REASON_TP = 5, //The deal was executed as a result of Take Profit activation
|
||||
DEAL_REASON_SO = 6, //The deal was executed as a result of the Stop Out event
|
||||
DEAL_REASON_ROLLOVER = 7, //The deal was executed due to a rollover
|
||||
DEAL_REASON_VMARGIN = 8, //The deal was executed after charging the variation margin
|
||||
DEAL_REASON_SPLIT = 9 //The deal was executed after the split (price reduction) of an instrument, which had an open position during split announcement
|
||||
}
|
||||
|
||||
#endregion //Deal Properties
|
||||
|
||||
#region Trade Operation Types
|
||||
|
||||
public enum ENUM_TRADE_REQUEST_ACTIONS
|
||||
{
|
||||
TRADE_ACTION_DEAL = 1, //Place a trade order for an immediate execution with the specified parameters (market order)
|
||||
TRADE_ACTION_PENDING = 5, //Place a trade order for the execution under specified conditions (pending order)
|
||||
TRADE_ACTION_SLTP = 6, //Modify Stop Loss and Take Profit values of an opened position
|
||||
TRADE_ACTION_MODIFY = 7, //Modify the parameters of the order placed previously
|
||||
TRADE_ACTION_REMOVE = 8, //Delete the pending order placed previously
|
||||
TRADE_ACTION_CLOSE_BY = 10 //Close a position by an opposite one
|
||||
}
|
||||
|
||||
#endregion //Trade Operation Types
|
||||
|
||||
#region Trade Transaction Types
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
#endregion //Trade Transaction Types
|
||||
|
||||
#region Trade Orders in Depth Of Market
|
||||
|
||||
public enum ENUM_BOOK_TYPE
|
||||
{
|
||||
BOOK_TYPE_SELL = 1,
|
||||
BOOK_TYPE_BUY = 2,
|
||||
BOOK_TYPE_SELL_MARKET = 3,
|
||||
BOOK_TYPE_BUY_MARKET = 4
|
||||
BOOK_TYPE_SELL = 1, //Sell order (Offer)
|
||||
BOOK_TYPE_BUY = 2, //Buy order (Bid)
|
||||
BOOK_TYPE_SELL_MARKET = 3, //Sell order by Market
|
||||
BOOK_TYPE_BUY_MARKET = 4 //Buy order by Market
|
||||
}
|
||||
|
||||
#endregion //Trade Orders in Depth Of Market
|
||||
|
||||
#region Object Types
|
||||
|
||||
public enum ENUM_OBJECT
|
||||
{
|
||||
OBJ_VLINE = 0, // Vertical Line
|
||||
OBJ_HLINE = 1, // Horizontal Line
|
||||
OBJ_TREND = 2, // Trend Line
|
||||
OBJ_TRENDBYANGLE = 3, // Trend Line By Angle
|
||||
OBJ_CYCLES = 4, // Cycle Lines
|
||||
OBJ_ARROWED_LINE = 108, // Arrowed Line
|
||||
OBJ_CHANNEL = 5, // Equidistant Channel
|
||||
OBJ_STDDEVCHANNEL = 6, // Standard Deviation Channel
|
||||
OBJ_REGRESSION = 7, // Linear Regression Channel
|
||||
OBJ_PITCHFORK = 8, // Andrews Pitchfork
|
||||
OBJ_GANNLINE = 9, // Gann Line
|
||||
OBJ_GANNFAN = 10, // Gann Fan
|
||||
OBJ_GANNGRID = 11, // Gann Grid
|
||||
OBJ_FIBO = 12, // Fibonacci Retracement
|
||||
OBJ_FIBOTIMES = 13, // Fibonacci Time Zones
|
||||
OBJ_FIBOFAN = 14, // Fibonacci Fan
|
||||
OBJ_FIBOARC = 15, // Fibonacci Arcs
|
||||
OBJ_FIBOCHANNEL = 16, // Fibonacci Channel
|
||||
OBJ_EXPANSION = 17, // Fibonacci Expansion
|
||||
OBJ_ELLIOTWAVE5 = 18, // Elliott Motive Wave
|
||||
OBJ_ELLIOTWAVE3 = 19, // Elliott Correction Wave
|
||||
OBJ_RECTANGLE = 20, // Rectangle
|
||||
OBJ_TRIANGLE = 21, // Triangle
|
||||
OBJ_ELLIPSE = 22, // Ellipse
|
||||
OBJ_ARROW_THUMB_UP = 23, // Thumbs Up
|
||||
OBJ_ARROW_THUMB_DOWN = 24, // Thumbs Down
|
||||
OBJ_ARROW_UP = 25, // Arrow Up
|
||||
OBJ_ARROW_DOWN = 26, // Arrow Down
|
||||
OBJ_ARROW_STOP = 27, // Stop Sign
|
||||
OBJ_ARROW_CHECK = 28, // Check Sign
|
||||
OBJ_ARROW_LEFT_PRICE = 29, // Left Price Label
|
||||
OBJ_ARROW_RIGHT_PRICE = 30, // Right Price Label
|
||||
OBJ_ARROW_BUY = 31, // Buy Sign
|
||||
OBJ_ARROW_SELL = 32, // Sell Sign
|
||||
OBJ_ARROW = 100, // Arrow
|
||||
OBJ_TEXT = 101, // Text
|
||||
OBJ_LABEL = 102, // Label
|
||||
OBJ_BUTTON = 103, // Button
|
||||
OBJ_CHART = 104, // Chart
|
||||
OBJ_BITMAP = 105, // Bitmap
|
||||
OBJ_BITMAP_LABEL = 106, // Bitmap Label
|
||||
OBJ_EDIT = 107, // Edit
|
||||
OBJ_EVENT = 109, // The "Event" object corresponding to an event in the economic calendar
|
||||
OBJ_RECTANGLE_LABEL = 110 // The "Rectangle label" object for creating and designing the custom graphical interface.
|
||||
}
|
||||
|
||||
#endregion // Object Types
|
||||
|
||||
#region Object Properties
|
||||
|
||||
public enum ENUM_OBJECT_PROPERTY_DOUBLE
|
||||
{
|
||||
OBJPROP_PRICE = 9, // Price coordinate
|
||||
OBJPROP_LEVELVALUE = 204, // Level value
|
||||
OBJPROP_SCALE = 1006, // Scale (properties of Gann objects and Fibonacci Arcs)
|
||||
OBJPROP_ANGLE = 1007, // Angle. For the objects with no angle specified, created from a program, the value is equal to EMPTY_VALUE
|
||||
OBJPROP_DEVIATION = 1010 // Deviation for the Standard Deviation Channel
|
||||
}
|
||||
|
||||
public enum ENUM_OBJECT_PROPERTY_INTEGER
|
||||
{
|
||||
OBJPROP_COLOR = 0, // Color
|
||||
OBJPROP_STYLE = 1, // Style
|
||||
OBJPROP_WIDTH = 2, // Line thickness
|
||||
OBJPROP_BACK = 3, // Object in the background
|
||||
OBJPROP_ZORDER = 207, // Priority of a graphical object for receiving events of clicking on a chart (CHARTEVENT_CLICK). The default zero value is set when creating an object; the priority can be increased if necessary. When objects are placed one atop another, only one of them with the highest priority will receive the CHARTEVENT_CLICK event.
|
||||
OBJPROP_FILL = 1031, // Fill an object with color (for OBJ_RECTANGLE, OBJ_TRIANGLE, OBJ_ELLIPSE, OBJ_CHANNEL, OBJ_STDDEVCHANNEL, OBJ_REGRESSION)
|
||||
OBJPROP_HIDDEN = 208, // Prohibit showing of the name of a graphical object in the list of objects from the terminal menu "Charts" - "Objects" - "List of objects". The true value allows to hide an object from the list. By default, true is set to the objects that display calendar events, trading history and to the objects created from MQL5 programs. To see such graphical objects and access their properties, click on the "All" button in the "List of objects" window.
|
||||
OBJPROP_SELECTED = 4, // Object is selected
|
||||
OBJPROP_READONLY = 1028, // Ability to edit text in the Edit object
|
||||
OBJPROP_TYPE = 7, // Object type
|
||||
OBJPROP_TIME = 8, // Time coordinate
|
||||
OBJPROP_SELECTABLE = 10, // Object availability
|
||||
OBJPROP_CREATETIME = 11, // Time of object creation
|
||||
OBJPROP_LEVELS = 200, // Number of levels
|
||||
OBJPROP_LEVELCOLOR = 201, // Color of the line-level
|
||||
OBJPROP_LEVELSTYLE = 202, // Style of the line-level
|
||||
OBJPROP_LEVELWIDTH = 203, // Thickness of the line-level
|
||||
OBJPROP_ALIGN = 1036, // Horizontal text alignment in the "Edit" object (OBJ_EDIT)
|
||||
OBJPROP_FONTSIZE = 1002, // Font size
|
||||
OBJPROP_RAY_LEFT = 1003, // Ray goes to the left
|
||||
OBJPROP_RAY_RIGHT = 1004, // Ray goes to the right
|
||||
OBJPROP_RAY = 1032, // A vertical line goes through all the windows of a chart
|
||||
OBJPROP_ELLIPSE = 1005, // Showing the full ellipse of the Fibonacci Arc object (OBJ_FIBOARC)
|
||||
OBJPROP_ARROWCODE = 1008, // Arrow code for the Arrow object
|
||||
OBJPROP_TIMEFRAMES = 12, // Visibility of an object at timeframes
|
||||
OBJPROP_ANCHOR = 1011, // Location of the anchor point of a graphical object
|
||||
OBJPROP_XDISTANCE = 1012, // The distance in pixels along the X axis from the binding corner
|
||||
OBJPROP_YDISTANCE = 1013, // The distance in pixels along the Y axis from the binding corner
|
||||
OBJPROP_DIRECTION = 1014, // Trend of the Gann object
|
||||
OBJPROP_DEGREE = 1015, // Level of the Elliott Wave Marking
|
||||
OBJPROP_DRAWLINES = 1016, // Displaying lines for marking the Elliott Wave
|
||||
OBJPROP_STATE = 1018, // Button state (pressed / depressed)
|
||||
OBJPROP_CHART_ID = 1030, // ID of the "Chart" object (OBJ_CHART). It allows working with the properties of this object like with a normal chart using the functions described in Chart Operations, but there some exceptions.
|
||||
OBJPROP_XSIZE = 1019, // The object's width along the X axis in pixels. Specified for OBJ_LABEL (read only), OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects.
|
||||
OBJPROP_YSIZE = 1020, // The object's height along the Y axis in pixels. Specified for OBJ_LABEL (read only), OBJ_BUTTON, OBJ_CHART, OBJ_BITMAP, OBJ_BITMAP_LABEL, OBJ_EDIT, OBJ_RECTANGLE_LABEL objects.
|
||||
OBJPROP_XOFFSET = 1033, // The X coordinate of the upper left corner of the rectangular visible area in the graphical objects "Bitmap Label" and "Bitmap" (OBJ_BITMAP_LABEL and OBJ_BITMAP). The value is set in pixels relative to the upper left corner of the original image.
|
||||
OBJPROP_YOFFSET = 1034, // The Y coordinate of the upper left corner of the rectangular visible area in the graphical objects "Bitmap Label" and "Bitmap" (OBJ_BITMAP_LABEL and OBJ_BITMAP). The value is set in pixels relative to the upper left corner of the original image.
|
||||
OBJPROP_PERIOD = 1022, // Timeframe for the Chart object
|
||||
OBJPROP_DATE_SCALE = 1023, // Displaying the time scale for the Chart object
|
||||
OBJPROP_PRICE_SCALE = 1024, // Displaying the price scale for the Chart object
|
||||
OBJPROP_CHART_SCALE = 1027, // The scale for the Chart object
|
||||
OBJPROP_BGCOLOR = 1025, // The background color for OBJ_EDIT, OBJ_BUTTON, OBJ_RECTANGLE_LABEL
|
||||
OBJPROP_CORNER = 1026, // The corner of the chart to link a graphical object
|
||||
OBJPROP_BORDER_TYPE = 1029, // Border type for the "Rectangle label" object
|
||||
OBJPROP_BORDER_COLOR = 1035 // Border color for the OBJ_EDIT and OBJ_BUTTON objects
|
||||
}
|
||||
|
||||
public enum ENUM_OBJECT_PROPERTY_STRING
|
||||
{
|
||||
OBJPROP_NAME = 5, // Object name
|
||||
OBJPROP_TEXT = 6, // Description of the object (the text contained in the object)
|
||||
OBJPROP_TOOLTIP = 206, // The text of a tooltip. If the property is not set, then the tooltip generated automatically by the terminal is shown. A tooltip can be disabled by setting the "\n" (line feed) value to it
|
||||
OBJPROP_LEVELTEXT = 205, // Level description
|
||||
OBJPROP_FONT = 1001, // Font
|
||||
OBJPROP_BMPFILE = 1017, // The name of BMP-file for Bitmap Label.
|
||||
OBJPROP_SYMBOL = 1021 // Symbol for the Chart object
|
||||
}
|
||||
|
||||
public enum ENUM_BORDER_TYPE
|
||||
{
|
||||
BORDER_FLAT = 0, // Flat form
|
||||
BORDER_RAISED = 1, // Prominent form
|
||||
BORDER_SUNKEN = 2 // Concave form
|
||||
}
|
||||
|
||||
public enum ENUM_ALIGN_MODE
|
||||
{
|
||||
ALIGN_LEFT = 1, // Left alignment
|
||||
ALIGN_CENTER = 2, // Centered (only for the Edit object)
|
||||
ALIGN_RIGHT = 0, // Right alignment
|
||||
}
|
||||
#endregion //Object Properties
|
||||
|
||||
#region Price Constants
|
||||
|
||||
public enum ENUM_APPLIED_PRICE
|
||||
{
|
||||
PRICE_CLOSE = 1, //Close price
|
||||
PRICE_OPEN = 2, //Open price
|
||||
PRICE_HIGH = 3, //The maximum price for the period
|
||||
PRICE_LOW = 4, //The minimum price for the period
|
||||
PRICE_MEDIAN = 5, //Median price, (high + low)/2
|
||||
PRICE_TYPICAL = 6, //Typical price, (high + low + close)/3
|
||||
PRICE_WEIGHTED = 7 //Average price, (high + low + close + close)/4
|
||||
}
|
||||
|
||||
public enum ENUM_APPLIED_VOLUME
|
||||
{
|
||||
VOLUME_TICK = 0, //Tick volume
|
||||
VOLUME_REAL = 1 //Trade volume
|
||||
}
|
||||
|
||||
public enum ENUM_STO_PRICE
|
||||
{
|
||||
STO_LOWHIGH = 0, //Calculation is based on Low/High prices
|
||||
STO_CLOSECLOSE = 1 //Calculation is based on Close/Close prices
|
||||
}
|
||||
|
||||
#endregion //Price Constants
|
||||
|
||||
#region Smoothing Methods
|
||||
|
||||
public enum ENUM_MA_METHOD
|
||||
{
|
||||
MODE_SMA = 0, //Simple averaging
|
||||
MODE_EMA = 1, //Exponential averaging
|
||||
MODE_SMMA = 2, //Smoothed averaging
|
||||
MODE_LWMA = 3 //Linear-weighted averaging
|
||||
}
|
||||
|
||||
#endregion //Smoothing Methods
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,9 +67,11 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Mt5Quote.cs" />
|
||||
<Compile Include="Requests\CopyTicksRequest.cs" />
|
||||
<Compile Include="Requests\ICustomRequest.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" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
+799
-9
@@ -223,6 +223,17 @@ namespace MtApi5
|
||||
return SendCommand<bool>(Mt5CommandType.PositionSelect, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///Selects an open position to work with based on the ticket number specified in the position. If successful, returns true. Returns false if the function failed.
|
||||
///</summary>
|
||||
///<param name="ticket">Position ticket.</param>
|
||||
public bool PositionSelectByTicket(ulong ticket)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticket };
|
||||
|
||||
return SendCommand<bool>(Mt5CommandType.PositionSelectByTicket, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the requested property of an open position, pre-selected using PositionGetSymbol or PositionSelect.
|
||||
///</summary>
|
||||
@@ -445,7 +456,7 @@ namespace MtApi5
|
||||
///<param name="propertyId"> Identifier of a deal property.</param>
|
||||
public double HistoryDealGetDouble(ulong ticketNumber, ENUM_DEAL_PROPERTY_DOUBLE propertyId)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticketNumber, propertyId };
|
||||
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
|
||||
|
||||
return SendCommand<double>(Mt5CommandType.HistoryDealGetDouble, commandParameters);
|
||||
}
|
||||
@@ -457,7 +468,7 @@ namespace MtApi5
|
||||
///<param name="propertyId"> Identifier of a deal property.</param>
|
||||
public long HistoryDealGetInteger(ulong ticketNumber, ENUM_DEAL_PROPERTY_INTEGER propertyId)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticketNumber, propertyId };
|
||||
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
|
||||
|
||||
return SendCommand<long>(Mt5CommandType.HistoryDealGetInteger, commandParameters);
|
||||
}
|
||||
@@ -469,7 +480,7 @@ namespace MtApi5
|
||||
///<param name="propertyId"> Identifier of a deal property.</param>
|
||||
public string HistoryDealGetString(ulong ticketNumber, ENUM_DEAL_PROPERTY_STRING propertyId)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticketNumber, propertyId };
|
||||
var commandParameters = new ArrayList { ticketNumber, (int)propertyId };
|
||||
|
||||
return SendCommand<string>(Mt5CommandType.HistoryDealGetString, commandParameters);
|
||||
}
|
||||
@@ -486,9 +497,10 @@ namespace MtApi5
|
||||
///Closes a position with the specified ticket.
|
||||
///</summary>
|
||||
///<param name="ticket">Ticket of the closed position.</param>
|
||||
public bool PositionClose(int ticket)
|
||||
///<param name="deviation">Maximal deviation from the current price (in points).</param>
|
||||
public bool PositionClose(ulong ticket, ulong deviation = ulong.MaxValue)
|
||||
{
|
||||
var commandParameters = new ArrayList { ticket};
|
||||
var commandParameters = new ArrayList { ticket, deviation };
|
||||
|
||||
return SendCommand<bool>(Mt5CommandType.PositionClose, commandParameters);
|
||||
}
|
||||
@@ -510,6 +522,25 @@ namespace MtApi5
|
||||
|
||||
return SendCommand<bool>(Mt5CommandType.PositionOpen, commandParameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens a position with the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="symbol">symbol</param>
|
||||
/// <param name="orderType">order type to open position </param>
|
||||
/// <param name="volume">position volume</param>
|
||||
/// <param name="price">execution price</param>
|
||||
/// <param name="sl">Stop Loss price</param>
|
||||
/// <param name="tp">Take Profit price</param>
|
||||
/// <param name="comment">comment</param>
|
||||
/// <returns>true - successful check of the basic structures, otherwise - false.</returns>
|
||||
public bool PositionOpen(string symbol, ENUM_ORDER_TYPE orderType, double volume, double price, double sl, double tp, string comment , out MqlTradeResult result)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)orderType, volume, price, sl, tp, comment };
|
||||
|
||||
var strResult = SendCommand<string>(Mt5CommandType.PositionOpenWithResult, commandParameters);
|
||||
return strResult.ParseResult(ParamSeparator, out result);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Account Information functions
|
||||
@@ -1407,9 +1438,769 @@ namespace MtApi5
|
||||
|
||||
return SendCommand<bool>(Mt5CommandType.Print, commandParameters);
|
||||
}
|
||||
#endregion
|
||||
#endregion // Common Functions
|
||||
|
||||
#endregion
|
||||
#region Object Functions
|
||||
|
||||
///<summary>
|
||||
///The function creates an object with the specified name, type, and the initial coordinates in the specified chart subwindow.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object. The name must be unique within a chart, including its subwindows.</param>
|
||||
///<param name="type">Object type. The value can be one of the values of the ENUM_OBJECT enumeration.</param>
|
||||
///<param name="nwin">Number of the chart subwindow. 0 means the main chart window. The specified subwindow must exist, otherwise the function returns false.</param>
|
||||
///<param name="time">The time coordinate of the first anchor.</param>
|
||||
///<param name="price">The price coordinate of the first anchor point.</param>
|
||||
public bool ObjectCreate(long chartId, string name, ENUM_OBJECT type, int nwin, DateTime time, double price)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)type, nwin, Mt5TimeConverter.ConvertToMtTime(time), price };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectCreate, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the name of the corresponding object in the specified chart, in the specified subwindow, of the specified type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="pos">Ordinal number of the object according to the specified filter by the number and type of the subwindow.</param>
|
||||
///<param name="subWindow">umber of the chart subwindow. 0 means the main chart window, -1 means all the subwindows of the chart, including the main window.</param>
|
||||
///<param name="type">Type of the object. The value can be one of the values of the ENUM_OBJECT enumeration. -1 means all types.</param>
|
||||
public string ObjectName(long chartId, int pos, int subWindow = -1, int type = -1)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, pos, subWindow, type };
|
||||
return SendCommand<string>(Mt5CommandType.ObjectName, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function removes the object with the specified name from the specified chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of object to be deleted.</param>
|
||||
public bool ObjectDelete(long chartId, string name)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectDelete, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function removes the object with the specified name from the specified chart.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. 0 means the main chart window, -1 means all the subwindows of the chart, including the main window.</param>
|
||||
///<param name="type">Type of the object. The value can be one of the values of the ENUM_OBJECT enumeration. -1 means all types.</param>
|
||||
public int ObjectsDeleteAll(long chartId, int subWindow = -1, int type = -1)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow, type };
|
||||
return SendCommand<int>(Mt5CommandType.ObjectsDeleteAll, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function searches for an object with the specified name in the chart with the specified ID.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">The name of the searched object.</param>
|
||||
public int ObjectFind(long chartId, string name)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name };
|
||||
return SendCommand<int>(Mt5CommandType.ObjectFind, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the time value for the specified price value of the specified object.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="value">Price value.</param>
|
||||
///<param name="lineId">Line identifier.</param>
|
||||
public DateTime ObjectGetTimeByValue(long chartId, string name, double value, int lineId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, value, lineId };
|
||||
var res = SendCommand<int>(Mt5CommandType.ObjectGetTimeByValue, commandParameters);
|
||||
return Mt5TimeConverter.ConvertFromMtTime(res);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the price value for the specified time value of the specified object.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="time">Time value.</param>
|
||||
///<param name="lineId">Line identifier.</param>
|
||||
public double ObjectGetValueByTime(long chartId, string name, DateTime time, int lineId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, Mt5TimeConverter.ConvertToMtTime(time), lineId };
|
||||
return SendCommand<double>(Mt5CommandType.ObjectGetValueByTime, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function changes coordinates of the specified anchor point of the object.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="pointIndex">Index of the anchor point. The number of anchor points depends on the type of object.</param>
|
||||
///<param name="time">Time coordinate of the selected anchor point.</param>
|
||||
///<param name="price">Price coordinate of the selected anchor point.</param>
|
||||
public bool ObjectMove(long chartId, string name, int pointIndex, DateTime time, double price)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, pointIndex, Mt5TimeConverter.ConvertToMtTime(time), price };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectMove, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the number of objects in the specified chart, specified subwindow, of the specified type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="subWindow">Number of the chart subwindow. 0 means the main chart window, -1 means all the subwindows of the chart, including the main window.</param>
|
||||
///<param name="type">Type of the object. The value can be one of the values of the ENUM_OBJECT enumeration. -1 means all types.</param>
|
||||
public int ObjectsTotal(long chartId, int subWindow = -1, int type = -1)
|
||||
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, subWindow, type };
|
||||
return SendCommand<int>(Mt5CommandType.ObjectsTotal, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function sets the value of the corresponding object property. The object property must be of the double type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_DOUBLE enumeration.</param>
|
||||
///<param name="propValue">The value of the property.</param>
|
||||
public bool ObjectSetDouble(long chartId, string name, ENUM_OBJECT_PROPERTY_DOUBLE propId, double propValue)
|
||||
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId, propValue };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectSetDouble, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function sets the value of the corresponding object property. The object property must be of the datetime, int, color, bool or char type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_INTEGER enumeration.</param>
|
||||
///<param name="propValue">The value of the property.</param>
|
||||
public bool ObjectSetInteger(long chartId, string name, ENUM_OBJECT_PROPERTY_INTEGER propId, long propValue)
|
||||
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId, propValue };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectSetInteger, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function sets the value of the corresponding object property. The object property must be of the string type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_STRING enumeration.</param>
|
||||
///<param name="propValue">The value of the property.</param>
|
||||
public bool ObjectSetString(long chartId, string name, ENUM_OBJECT_PROPERTY_STRING propId, string propValue)
|
||||
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId, propValue };
|
||||
return SendCommand<bool>(Mt5CommandType.ObjectSetString, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the value of the corresponding object property. The object property must be of the double type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_DOUBLE enumeration.</param>
|
||||
public double ObjectGetDouble(long chartId, string name, ENUM_OBJECT_PROPERTY_DOUBLE propId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId };
|
||||
return SendCommand<double>(Mt5CommandType.ObjectGetDouble, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///he function returns the value of the corresponding object property. The object property must be of the datetime, int, color, bool or char type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_INTEGER enumeration.</param>
|
||||
public long ObjectGetInteger(long chartId, string name, ENUM_OBJECT_PROPERTY_INTEGER propId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId };
|
||||
return SendCommand<long>(Mt5CommandType.ObjectGetInteger, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the value of the corresponding object property. The object property must be of the string type.
|
||||
///</summary>
|
||||
///<param name="chartId">Chart identifier. 0 means the current chart.</param>
|
||||
///<param name="name">Name of the object.</param>
|
||||
///<param name="propId">ID of the object property. The value can be one of the values of the ENUM_OBJECT_PROPERTY_STRING enumeration.</param>
|
||||
public string ObjectGetString(long chartId, string name, ENUM_OBJECT_PROPERTY_STRING propId)
|
||||
{
|
||||
var commandParameters = new ArrayList { chartId, name, (int)propId };
|
||||
return SendCommand<string>(Mt5CommandType.ObjectGetString, commandParameters);
|
||||
}
|
||||
|
||||
#endregion //Object Functions
|
||||
|
||||
#region Technical Indicators
|
||||
|
||||
#endregion //Technical Indicators
|
||||
|
||||
///<summary>
|
||||
///The function creates Accelerator Oscillator in a global cache of the client terminal and returns its handle.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
public int iAC(string symbol, ENUM_TIMEFRAMES period)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period };
|
||||
return SendCommand<int>(Mt5CommandType.iAC, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Accumulation/Distribution indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be any of ENUM_APPLIED_VOLUME values.</param>
|
||||
public int iAD(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iAD, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Average Directional Movement Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="adxPeriod">Period to calculate the index.</param>
|
||||
public int iADX(string symbol, ENUM_TIMEFRAMES period, int adxPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, adxPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iADX, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of Average Directional Movement Index by Welles Wilder.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="adxPeriod">Period to calculate the index.</param>
|
||||
public int iADXWilder(string symbol, ENUM_TIMEFRAMES period, int adxPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, adxPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iADXWilder, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Alligator indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="jawPeriod">Averaging period for the blue line (Alligator's Jaw).</param>
|
||||
///<param name="jawShift">The shift of the blue line relative to the price chart.</param>
|
||||
///<param name="teethPeriod">Averaging period for the red line (Alligator's Teeth).</param>
|
||||
///<param name="teethShift">The shift of the red line relative to the price chart.</param>
|
||||
///<param name="lipsPeriod">Averaging period for the green line (Alligator's lips).</param>
|
||||
///<param name="lipsShift">The shift of the green line relative to the price chart.</param>
|
||||
///<param name="maMethod">The method of averaging. Can be any of the ENUM_MA_METHOD values.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iAlligator(string symbol, ENUM_TIMEFRAMES period, int jawPeriod, int jawShift, int teethPeriod,
|
||||
int teethShift, int lipsPeriod, int lipsShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, jawPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, (int)maMethod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iAlligator, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Adaptive Moving Average indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="amaPeriod">The calculation period, on which the efficiency coefficient is calculated.</param>
|
||||
///<param name="fastMaPeriod">Fast period for the smoothing coefficient calculation for a rapid market.</param>
|
||||
///<param name="slowMaPeriod">Slow period for the smoothing coefficient calculation in the absence of trend.</param>
|
||||
///<param name="amaShift">Shift of the indicator relative to the price chart.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iAMA(string symbol, ENUM_TIMEFRAMES period, int amaPeriod, int fastMaPeriod, int slowMaPeriod, int amaShift, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, amaPeriod, fastMaPeriod, slowMaPeriod, amaShift, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iAMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Awesome Oscillator indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
public int iAO(string symbol, ENUM_TIMEFRAMES period)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period };
|
||||
return SendCommand<int>(Mt5CommandType.iAO, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Average True Range indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">The value of the averaging period for the indicator calculation.</param>
|
||||
public int iATR(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iATR, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Bears Power indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">The value of the averaging period for the indicator calculation.</param>
|
||||
public int iBearsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iBearsPower, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Bollinger Bands® indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="bandsPeriod">The averaging period of the main line of the indicator.</param>
|
||||
///<param name="bandsShift">The shift the indicator relative to the price chart.</param>
|
||||
///<param name="deviation">Deviation from the main line.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iBands(string symbol, ENUM_TIMEFRAMES period, int bandsPeriod, int bandsShift, double deviation, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, bandsPeriod, bandsShift, deviation, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iBands, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Bulls Power indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">The averaging period for the indicator calculation.</param>
|
||||
public int iBullsPower(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iBullsPower, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Commodity Channel Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">The averaging period for the indicator calculation.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iCCI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iCCI, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Bulls Power indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="fastMaPeriod">Fast averaging period for calculations.</param>
|
||||
///<param name="slowMaPeriod">Slow averaging period for calculations.</param>
|
||||
///<param name="maMethod">Smoothing type. Can be one of the averaging constants of ENUM_MA_METHOD.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be one of the constants of ENUM_APPLIED_VOLUME.</param>
|
||||
public int iChaikin(string symbol, ENUM_TIMEFRAMES period, int fastMaPeriod, int slowMaPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, fastMaPeriod, slowMaPeriod, (int)maMethod, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iChaikin, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Bulls Power indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period (bars count) for calculations.</param>
|
||||
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iDEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iDEMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the DeMarker indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period (bars count) for calculations.</param>
|
||||
public int iDeMarker(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iDeMarker, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Envelopes indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the main line.</param>
|
||||
///<param name="maShift">The shift of the indicator relative to the price chart.</param>
|
||||
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
///<param name="deviation">The deviation from the main line (in percents).</param>
|
||||
public int iEnvelopes(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice, double deviation)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice, deviation };
|
||||
return SendCommand<int>(Mt5CommandType.iEnvelopes, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Force Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the indicator calculations.</param>
|
||||
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be one of the values of ENUM_APPLIED_VOLUME.</param>
|
||||
public int iForce(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_MA_METHOD maMethod, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)maMethod, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iForce, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Force Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
public int iForce(string symbol, ENUM_TIMEFRAMES period)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period };
|
||||
return SendCommand<int>(Mt5CommandType.iForce, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Fractal Adaptive Moving Average indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Period (bars count) for the indicator calculations.</param>
|
||||
///<param name="maShift">Shift of the indicator in the price chart.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iFrAMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iFrAMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Gator indicator. The Oscillator shows the difference between the blue and red lines of Alligator (upper histogram) and difference between red and green lines (lower histogram).
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="jawPeriod">Averaging period for the blue line (Alligator's Jaw).</param>
|
||||
///<param name="jawShift">The shift of the blue line relative to the price chart. It isn't directly connected with the visual shift of the indicator histogram.</param>
|
||||
///<param name="teethPeriod">Averaging period for the red line (Alligator's Teeth).</param>
|
||||
///<param name="teethShift">The shift of the red line relative to the price chart. It isn't directly connected with the visual shift of the indicator histogram.</param>
|
||||
///<param name="lipsPeriod">Averaging period for the green line (Alligator's lips).</param>
|
||||
///<param name="lipsShift">The shift of the green line relative to the price charts. It isn't directly connected with the visual shift of the indicator histogram.</param>
|
||||
///<param name="maMethod">Smoothing type. Can be one of the values of ENUM_MA_METHOD.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iGator(string symbol, ENUM_TIMEFRAMES period, int jawPeriod, int jawShift, int teethPeriod,
|
||||
int teethShift, int lipsPeriod, int lipsShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, jawPeriod, jawShift, teethPeriod, teethShift, lipsPeriod, lipsShift, (int)maMethod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iGator, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Ichimoku Kinko Hyo indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="tenkanSen">Averaging period for Tenkan Sen.</param>
|
||||
///<param name="kijunSen">Averaging period for Kijun Sen.</param>
|
||||
///<param name="senkouSpanB">Averaging period for Senkou Span B.</param>
|
||||
public int iIchimoku(string symbol, ENUM_TIMEFRAMES period, int tenkanSen, int kijunSen, int senkouSpanB)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, tenkanSen, kijunSen, senkouSpanB };
|
||||
return SendCommand<int>(Mt5CommandType.iIchimoku, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Market Facilitation Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be one of the constants of ENUM_APPLIED_VOLUME.</param>
|
||||
public int iBWMFI(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iBWMFI, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Momentum indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="momPeriod">Averaging period (bars count) for the calculation of the price change.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iMomentum(string symbol, ENUM_TIMEFRAMES period, int momPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, momPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iMomentum, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Money Flow Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period (bars count) for the calculation.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
|
||||
public int iMFI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iMFI, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Moving Average indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the calculation of the moving average.</param>
|
||||
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
|
||||
///<param name="maMethod">Smoothing type. Can be one of the ENUM_MA_METHOD values.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Moving Average of Oscillator indicator. The OsMA oscillator shows the difference between values of MACD and its signal line.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="fastEmaPeriod">Period for Fast Moving Average calculation.</param>
|
||||
///<param name="slowEmaPeriod">Period for Slow Moving Average calculation.</param>
|
||||
///<param name="signalPeriod">Averaging period for signal line calculation.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iOsMA(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, fastEmaPeriod, slowEmaPeriod, signalPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iOsMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Moving Averages Convergence/Divergence indicator. In systems where OsMA is called MACD Histogram, this indicator is shown as two lines. In the client terminal the Moving Averages Convergence/Divergence looks like a histogram.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="fastEmaPeriod">Period for Fast Moving Average calculation.</param>
|
||||
///<param name="slowEmaPeriod">Period for Slow Moving Average calculation.</param>
|
||||
///<param name="signalPeriod">Averaging period for signal line calculation.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iMACD(string symbol, ENUM_TIMEFRAMES period, int fastEmaPeriod, int slowEmaPeriod, int signalPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, fastEmaPeriod, slowEmaPeriod, signalPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iMACD, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the On Balance Volume indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
|
||||
public int iOBV(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iOBV, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Parabolic Stop and Reverse system indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="step">The step of price increment, usually 0.02.</param>
|
||||
///<param name="maximum">The maximum step, usually 0.2.</param>
|
||||
public int iSAR(string symbol, ENUM_TIMEFRAMES period, double step, double maximum)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, step, maximum };
|
||||
return SendCommand<int>(Mt5CommandType.iSAR, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Relative Strength Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the RSI calculation.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iRSI(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iRSI, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Relative Vigor Index indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the RVI calculation.</param>
|
||||
public int iRVI(string symbol, ENUM_TIMEFRAMES period, int maPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iRVI, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Standard Deviation indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period for the RVI calculation.</param>
|
||||
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
|
||||
///<param name="maMethod">Type of averaging. Can be any of the ENUM_MA_METHOD values.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iStdDev(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_MA_METHOD maMethod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)maMethod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iStdDev, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Stochastic Oscillator indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="Kperiod">Averaging period (bars count) for the %K line calculation.</param>
|
||||
///<param name="Dperiod">Averaging period (bars count) for the %D line calculation.</param>
|
||||
///<param name="slowing">Slowing value.</param>
|
||||
///<param name="maMethod">Type of averaging. Can be any of the ENUM_MA_METHOD values.</param>
|
||||
///<param name="priceField">Parameter of price selection for calculations. Can be one of the ENUM_STO_PRICE values.</param>
|
||||
public int iStochastic(string symbol, ENUM_TIMEFRAMES period, int Kperiod, int Dperiod, int slowing, ENUM_MA_METHOD maMethod, ENUM_STO_PRICE priceField)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, Kperiod, Dperiod, slowing, (int)maMethod, (int)priceField };
|
||||
return SendCommand<int>(Mt5CommandType.iStochastic, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Triple Exponential Moving Average indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period (bars count) for calculation.</param>
|
||||
///<param name="maShift">Shift of indicator relative to the price chart.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iTEMA(string symbol, ENUM_TIMEFRAMES period, int maPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, maShift, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iTEMA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Triple Exponential Moving Averages Oscillator indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="maPeriod">Averaging period (bars count) for calculation.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iTriX(string symbol, ENUM_TIMEFRAMES period, int maPeriod, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, maPeriod, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iTriX, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Larry Williams' Percent Range indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="calcPeriod">Period (bars count) for the indicator calculation.</param>
|
||||
public int iWPR(string symbol, ENUM_TIMEFRAMES period, int calcPeriod)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, calcPeriod };
|
||||
return SendCommand<int>(Mt5CommandType.iWPR, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Variable Index Dynamic Average indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="cmoPeriod">Period (bars count) for the Chande Momentum Oscillator calculation.</param>
|
||||
///<param name="emaPeriod">EMA period (bars count) for smoothing factor calculation.</param>
|
||||
///<param name="maShift">Shift of the indicator relative to the price chart.</param>
|
||||
///<param name="appliedPrice">The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.</param>
|
||||
public int iVIDyA(string symbol, ENUM_TIMEFRAMES period, int cmoPeriod, int emaPeriod, int maShift, ENUM_APPLIED_PRICE appliedPrice)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, cmoPeriod, emaPeriod, maShift, (int)appliedPrice };
|
||||
return SendCommand<int>(Mt5CommandType.iVIDyA, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Volumes indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="appliedVolume">The volume used. Can be any of the ENUM_APPLIED_VOLUME values.</param>
|
||||
public int iVolumes(string symbol, ENUM_TIMEFRAMES period, ENUM_APPLIED_VOLUME appliedVolume)
|
||||
{
|
||||
var commandParameters = new ArrayList { symbol, (int)period, (int)appliedVolume };
|
||||
return SendCommand<int>(Mt5CommandType.iVolumes, commandParameters);
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Volumes indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="name">The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/Examples, its name must be specified like: "Examples\\indicator_name" (it is necessary to use a double slash instead of the single slash as a separator).</param>
|
||||
///<param name="parameters">input-parameters of a custom indicator. If there is no parameters specified, then default values will be used.</param>
|
||||
public int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, double[] parameters)
|
||||
{
|
||||
var response = SendRequest<ICustomResponse>(new ICustomRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Timeframe = (int)period,
|
||||
Name = name,
|
||||
Params = new ArrayList(parameters),
|
||||
ParamsType = ICustomRequest.ParametersType.Double
|
||||
});
|
||||
return response?.Value ?? 0;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
///The function returns the handle of the Volumes indicator.
|
||||
///</summary>
|
||||
///<param name="symbol">The symbol name of the security, the data of which should be used to calculate the indicator.</param>
|
||||
///<param name="period">The value of the period can be one of the ENUM_TIMEFRAMES enumeration values, 0 means the current timeframe.</param>
|
||||
///<param name="name">The name of the custom indicator, with path relative to the root directory of indicators (MQL5/Indicators/). If an indicator is located in a subdirectory, for example, in MQL5/Indicators/Examples, its name must be specified like: "Examples\\indicator_name" (it is necessary to use a double slash instead of the single slash as a separator).</param>
|
||||
///<param name="parameters">input-parameters of a custom indicator. If there is no parameters specified, then default values will be used.</param>
|
||||
public int iCustom(string symbol, ENUM_TIMEFRAMES period, string name, int[] parameters)
|
||||
{
|
||||
var response = SendRequest<ICustomResponse>(new ICustomRequest
|
||||
{
|
||||
Symbol = symbol,
|
||||
Timeframe = (int)period,
|
||||
Name = name,
|
||||
Params = new ArrayList(parameters),
|
||||
ParamsType = ICustomRequest.ParametersType.Int
|
||||
});
|
||||
return response?.Value ?? 0;
|
||||
}
|
||||
|
||||
#endregion // Public Methods
|
||||
|
||||
#region Properties
|
||||
///<summary>
|
||||
@@ -1659,8 +2450,7 @@ namespace MtApi5
|
||||
|
||||
private void OnConnected()
|
||||
{
|
||||
// INFO: disabled backtesting mode while solution of window handle in testing mode is not found
|
||||
//_isBacktestingMode = IsTesting();
|
||||
_isBacktestingMode = IsTesting();
|
||||
|
||||
if (_isBacktestingMode)
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace MtApi5
|
||||
|
||||
return new ArrayList { (int)request.Action, request.Magic, request.Order, request.Symbol, request.Volume
|
||||
, request.Price, request.Stoplimit, request.Sl, request.Tp, request.Deviation, (int)request.Type
|
||||
, (int)request.Type_filling, (int)request.Type_time, exp, request.Comment };
|
||||
, (int)request.Type_filling, (int)request.Type_time, exp, request.Comment, request.Position, request.PositionBy };
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -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.11.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.11.1")]
|
||||
[assembly: AssemblyVersion("1.0.14")]
|
||||
[assembly: AssemblyFileVersion("1.0.14")]
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections;
|
||||
|
||||
namespace MtApi5.Requests
|
||||
{
|
||||
internal class ICustomRequest : RequestBase
|
||||
{
|
||||
public enum ParametersType
|
||||
{
|
||||
Int = 0,
|
||||
Double = 1,
|
||||
String = 2,
|
||||
Boolean = 3
|
||||
}
|
||||
|
||||
public string Symbol { get; set; }
|
||||
public int Timeframe { get; set; }
|
||||
public string Name { get; set; }
|
||||
public ArrayList Params { get; set; }
|
||||
public ParametersType ParamsType { get; set; }
|
||||
|
||||
public override RequestType RequestType => RequestType.iCustom;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
internal enum RequestType
|
||||
{
|
||||
Unknown = 0,
|
||||
CopyTicks = 1
|
||||
CopyTicks = 1,
|
||||
iCustom = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace MtApi5.Responses
|
||||
{
|
||||
internal class ICustomResponse: ResponseBase
|
||||
{
|
||||
public int Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
<OutputType>Package</OutputType>
|
||||
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||
<WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
|
||||
<RunWixToolsOutOfProc>true</RunWixToolsOutOfProc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<OutputPath>..\build\installers\$(Configuration)\</OutputPath>
|
||||
|
||||
@@ -254,8 +254,11 @@
|
||||
</Grid>
|
||||
</Expander>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<Button Content="OrderSend" Command="{Binding OrderSendCommand}" Width="100" Height="25"/>
|
||||
<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"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using MtApi5;
|
||||
|
||||
@@ -29,7 +26,7 @@ namespace MtApi5TestClient
|
||||
}
|
||||
}
|
||||
|
||||
public uint Magic
|
||||
public ulong Magic
|
||||
{
|
||||
get { return TradeRequest.Magic; }
|
||||
set
|
||||
@@ -109,7 +106,7 @@ namespace MtApi5TestClient
|
||||
}
|
||||
}
|
||||
|
||||
public uint Deviation
|
||||
public ulong Deviation
|
||||
{
|
||||
get { return TradeRequest.Deviation; }
|
||||
set
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace MtApi5TestClient
|
||||
public DelegateCommand DisconnectCommand { get; private set; }
|
||||
|
||||
public DelegateCommand OrderSendCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetDoubleCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetIntegerCommand { get; private set; }
|
||||
public DelegateCommand HistoryDealGetStringCommand { get; private set; }
|
||||
|
||||
public DelegateCommand AccountInfoDoubleCommand { get; private set; }
|
||||
public DelegateCommand AccountInfoIntegerCommand { get; private set; }
|
||||
@@ -193,6 +196,9 @@ namespace MtApi5TestClient
|
||||
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
|
||||
|
||||
OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
|
||||
HistoryDealGetDoubleCommand = new DelegateCommand(ExecuteHistoryDealGetDouble);
|
||||
HistoryDealGetIntegerCommand = new DelegateCommand(ExecuteHistoryDealGetInteger);
|
||||
HistoryDealGetStringCommand = new DelegateCommand(ExecuteHistoryDealGetString);
|
||||
|
||||
AccountInfoDoubleCommand = new DelegateCommand(ExecuteAccountInfoDouble);
|
||||
AccountInfoIntegerCommand = new DelegateCommand(ExecuteAccountInfoInteger);
|
||||
@@ -271,6 +277,36 @@ namespace MtApi5TestClient
|
||||
AddLog(message);
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryDealGetDouble(object o)
|
||||
{
|
||||
const ulong ticket = 12345;
|
||||
const ENUM_DEAL_PROPERTY_DOUBLE propertyId = ENUM_DEAL_PROPERTY_DOUBLE.DEAL_PROFIT;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.HistoryDealGetDouble(ticket, propertyId));
|
||||
|
||||
AddLog($"HistoryDealGetDouble: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryDealGetInteger(object o)
|
||||
{
|
||||
const ulong ticket = 12345;
|
||||
const ENUM_DEAL_PROPERTY_INTEGER propertyId = ENUM_DEAL_PROPERTY_INTEGER.DEAL_TICKET;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.HistoryDealGetInteger(ticket, propertyId));
|
||||
|
||||
AddLog($"HistoryDealGetInteger: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteHistoryDealGetString(object o)
|
||||
{
|
||||
const ulong ticket = 12345;
|
||||
const ENUM_DEAL_PROPERTY_STRING propertyId = ENUM_DEAL_PROPERTY_STRING.DEAL_SYMBOL;
|
||||
|
||||
var retVal = await Execute(() => _mtApiClient.HistoryDealGetString(ticket, propertyId));
|
||||
|
||||
AddLog($"HistoryDealGetString: {retVal}");
|
||||
}
|
||||
|
||||
private async void ExecuteAccountInfoDouble(object o)
|
||||
{
|
||||
var result = await Execute(() => _mtApiClient.AccountInfoDouble(AccountInfoDoublePropertyId));
|
||||
@@ -745,13 +781,14 @@ namespace MtApi5TestClient
|
||||
const string symbol = "EURUSD";
|
||||
const ENUM_ORDER_TYPE orderType = ENUM_ORDER_TYPE.ORDER_TYPE_BUY;
|
||||
const double volume = 0.1;
|
||||
const double price = 1.013;
|
||||
const double sl = 1.00;
|
||||
const double tp = 1.020;
|
||||
const double price = 1.18129;
|
||||
const double sl = 1.1811;
|
||||
const double tp = 1.1814;
|
||||
const string comment = "Test PositionOpen";
|
||||
MqlTradeResult tradeResult = null;
|
||||
|
||||
var retVal = await Execute (() => _mtApiClient.PositionOpen(symbol, orderType, volume, price, sl, tp, comment));
|
||||
AddLog($"PositionOpen: symbol EURUSD result = {retVal}");
|
||||
var retVal = await Execute (() => _mtApiClient.PositionOpen(symbol, orderType, volume, price, sl, tp, comment, out tradeResult));
|
||||
AddLog($"PositionOpen: symbol EURUSD retVal = {retVal}, result = {tradeResult}");
|
||||
}
|
||||
|
||||
private async void ExecutePrint(object obj)
|
||||
|
||||
+141
-34
@@ -197,9 +197,18 @@
|
||||
this.button38 = new System.Windows.Forms.Button();
|
||||
this.button37 = new System.Windows.Forms.Button();
|
||||
this.tabPage10 = new System.Windows.Forms.TabPage();
|
||||
this.button68 = new System.Windows.Forms.Button();
|
||||
this.comboBox11 = new System.Windows.Forms.ComboBox();
|
||||
this.button4 = new System.Windows.Forms.Button();
|
||||
this.button68 = new System.Windows.Forms.Button();
|
||||
this.tabPage11 = new System.Windows.Forms.TabPage();
|
||||
this.button69 = new System.Windows.Forms.Button();
|
||||
this.textBoxAccountLogin = new System.Windows.Forms.TextBox();
|
||||
this.textBoxAccountPassword = new System.Windows.Forms.TextBox();
|
||||
this.label31 = new System.Windows.Forms.Label();
|
||||
this.label32 = new System.Windows.Forms.Label();
|
||||
this.textBoxAccountHost = new System.Windows.Forms.TextBox();
|
||||
this.label33 = new System.Windows.Forms.Label();
|
||||
this.button70 = new System.Windows.Forms.Button();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@@ -218,6 +227,7 @@
|
||||
this.tabPage8.SuspendLayout();
|
||||
this.tabPage9.SuspendLayout();
|
||||
this.tabPage10.SuspendLayout();
|
||||
this.tabPage11.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBoxServerName
|
||||
@@ -240,7 +250,7 @@
|
||||
this.buttonConnect.Location = new System.Drawing.Point(17, 73);
|
||||
this.buttonConnect.Name = "buttonConnect";
|
||||
this.buttonConnect.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonConnect.TabIndex = 4;
|
||||
this.buttonConnect.TabIndex = 2;
|
||||
this.buttonConnect.Text = "Connect";
|
||||
this.buttonConnect.UseVisualStyleBackColor = true;
|
||||
this.buttonConnect.Click += new System.EventHandler(this.buttonConnect_Click);
|
||||
@@ -322,7 +332,7 @@
|
||||
this.checkBox2.Location = new System.Drawing.Point(6, 296);
|
||||
this.checkBox2.Name = "checkBox2";
|
||||
this.checkBox2.Size = new System.Drawing.Size(281, 17);
|
||||
this.checkBox2.TabIndex = 16;
|
||||
this.checkBox2.TabIndex = 5;
|
||||
this.checkBox2.Text = "Use selected ExpertHandle (chart) as default executor";
|
||||
this.checkBox2.UseVisualStyleBackColor = true;
|
||||
this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox2_CheckedChanged);
|
||||
@@ -343,7 +353,7 @@
|
||||
this.listViewQuotes.MultiSelect = false;
|
||||
this.listViewQuotes.Name = "listViewQuotes";
|
||||
this.listViewQuotes.Size = new System.Drawing.Size(292, 271);
|
||||
this.listViewQuotes.TabIndex = 15;
|
||||
this.listViewQuotes.TabIndex = 4;
|
||||
this.listViewQuotes.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewQuotes.View = System.Windows.Forms.View.Details;
|
||||
this.listViewQuotes.SelectedIndexChanged += new System.EventHandler(this.listViewQuotes_SelectedIndexChanged);
|
||||
@@ -400,6 +410,7 @@
|
||||
this.tabControl1.Controls.Add(this.tabPage8);
|
||||
this.tabControl1.Controls.Add(this.tabPage9);
|
||||
this.tabControl1.Controls.Add(this.tabPage10);
|
||||
this.tabControl1.Controls.Add(this.tabPage11);
|
||||
this.tabControl1.Location = new System.Drawing.Point(324, 12);
|
||||
this.tabControl1.Multiline = true;
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
@@ -442,7 +453,7 @@
|
||||
this.button22.Location = new System.Drawing.Point(216, 293);
|
||||
this.button22.Name = "button22";
|
||||
this.button22.Size = new System.Drawing.Size(75, 23);
|
||||
this.button22.TabIndex = 19;
|
||||
this.button22.TabIndex = 31;
|
||||
this.button22.Text = "OrderModify";
|
||||
this.button22.UseVisualStyleBackColor = true;
|
||||
this.button22.Click += new System.EventHandler(this.button22_Click);
|
||||
@@ -452,7 +463,7 @@
|
||||
this.button21.Location = new System.Drawing.Point(216, 264);
|
||||
this.button21.Name = "button21";
|
||||
this.button21.Size = new System.Drawing.Size(75, 23);
|
||||
this.button21.TabIndex = 18;
|
||||
this.button21.TabIndex = 30;
|
||||
this.button21.Text = "OrderDelete";
|
||||
this.button21.UseVisualStyleBackColor = true;
|
||||
this.button21.Click += new System.EventHandler(this.button21_Click);
|
||||
@@ -471,7 +482,7 @@
|
||||
this.textBoxOppositeTicket.Location = new System.Drawing.Point(303, 239);
|
||||
this.textBoxOppositeTicket.Name = "textBoxOppositeTicket";
|
||||
this.textBoxOppositeTicket.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBoxOppositeTicket.TabIndex = 16;
|
||||
this.textBoxOppositeTicket.TabIndex = 28;
|
||||
this.textBoxOppositeTicket.Text = "0";
|
||||
//
|
||||
// button15
|
||||
@@ -479,7 +490,7 @@
|
||||
this.button15.Location = new System.Drawing.Point(410, 237);
|
||||
this.button15.Name = "button15";
|
||||
this.button15.Size = new System.Drawing.Size(92, 23);
|
||||
this.button15.TabIndex = 15;
|
||||
this.button15.TabIndex = 29;
|
||||
this.button15.Text = "OrderCloseBy";
|
||||
this.button15.UseVisualStyleBackColor = true;
|
||||
this.button15.Click += new System.EventHandler(this.button15_Click);
|
||||
@@ -490,7 +501,7 @@
|
||||
this.checkBox1.Location = new System.Drawing.Point(297, 208);
|
||||
this.checkBox1.Name = "checkBox1";
|
||||
this.checkBox1.Size = new System.Drawing.Size(205, 17);
|
||||
this.checkBox1.TabIndex = 14;
|
||||
this.checkBox1.TabIndex = 27;
|
||||
this.checkBox1.Text = "Close order by current price on market";
|
||||
this.checkBox1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -499,7 +510,7 @@
|
||||
this.button20.Location = new System.Drawing.Point(216, 202);
|
||||
this.button20.Name = "button20";
|
||||
this.button20.Size = new System.Drawing.Size(75, 23);
|
||||
this.button20.TabIndex = 13;
|
||||
this.button20.TabIndex = 26;
|
||||
this.button20.Text = "OrderClose";
|
||||
this.button20.UseVisualStyleBackColor = true;
|
||||
this.button20.Click += new System.EventHandler(this.button20_Click);
|
||||
@@ -509,7 +520,7 @@
|
||||
this.button17.Location = new System.Drawing.Point(558, 158);
|
||||
this.button17.Name = "button17";
|
||||
this.button17.Size = new System.Drawing.Size(75, 23);
|
||||
this.button17.TabIndex = 12;
|
||||
this.button17.TabIndex = 25;
|
||||
this.button17.Text = "GetOrders";
|
||||
this.button17.UseVisualStyleBackColor = true;
|
||||
this.button17.Click += new System.EventHandler(this.button17_Click);
|
||||
@@ -524,7 +535,7 @@
|
||||
this.comboBox2.Location = new System.Drawing.Point(341, 158);
|
||||
this.comboBox2.Name = "comboBox2";
|
||||
this.comboBox2.Size = new System.Drawing.Size(114, 21);
|
||||
this.comboBox2.TabIndex = 11;
|
||||
this.comboBox2.TabIndex = 23;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
@@ -536,14 +547,14 @@
|
||||
this.comboBox1.Location = new System.Drawing.Point(216, 158);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(119, 21);
|
||||
this.comboBox1.TabIndex = 10;
|
||||
this.comboBox1.TabIndex = 22;
|
||||
//
|
||||
// button16
|
||||
//
|
||||
this.button16.Location = new System.Drawing.Point(461, 158);
|
||||
this.button16.Name = "button16";
|
||||
this.button16.Size = new System.Drawing.Size(75, 23);
|
||||
this.button16.TabIndex = 9;
|
||||
this.button16.TabIndex = 24;
|
||||
this.button16.Text = "GetOrder";
|
||||
this.button16.UseVisualStyleBackColor = true;
|
||||
this.button16.Click += new System.EventHandler(this.button16_Click);
|
||||
@@ -562,7 +573,7 @@
|
||||
this.textBoxIndexTicket.Location = new System.Drawing.Point(290, 132);
|
||||
this.textBoxIndexTicket.Name = "textBoxIndexTicket";
|
||||
this.textBoxIndexTicket.Size = new System.Drawing.Size(109, 20);
|
||||
this.textBoxIndexTicket.TabIndex = 7;
|
||||
this.textBoxIndexTicket.TabIndex = 21;
|
||||
this.textBoxIndexTicket.Text = "0";
|
||||
//
|
||||
// comboBoxSelectedCommand
|
||||
@@ -596,7 +607,7 @@
|
||||
this.comboBoxSelectedCommand.Location = new System.Drawing.Point(213, 344);
|
||||
this.comboBoxSelectedCommand.Name = "comboBoxSelectedCommand";
|
||||
this.comboBoxSelectedCommand.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBoxSelectedCommand.TabIndex = 6;
|
||||
this.comboBoxSelectedCommand.TabIndex = 32;
|
||||
//
|
||||
// label15
|
||||
//
|
||||
@@ -624,14 +635,14 @@
|
||||
this.listBoxClosedOrders.Location = new System.Drawing.Point(213, 85);
|
||||
this.listBoxClosedOrders.Name = "listBoxClosedOrders";
|
||||
this.listBoxClosedOrders.Size = new System.Drawing.Size(419, 43);
|
||||
this.listBoxClosedOrders.TabIndex = 5;
|
||||
this.listBoxClosedOrders.TabIndex = 20;
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(356, 342);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(87, 23);
|
||||
this.button2.TabIndex = 2;
|
||||
this.button2.TabIndex = 33;
|
||||
this.button2.Text = "Execute";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.button2_Click);
|
||||
@@ -675,7 +686,7 @@
|
||||
this.button19.Location = new System.Drawing.Point(87, 336);
|
||||
this.button19.Name = "button19";
|
||||
this.button19.Size = new System.Drawing.Size(75, 23);
|
||||
this.button19.TabIndex = 15;
|
||||
this.button19.TabIndex = 18;
|
||||
this.button19.Text = "Sell";
|
||||
this.button19.UseVisualStyleBackColor = true;
|
||||
this.button19.Click += new System.EventHandler(this.button19_Click);
|
||||
@@ -685,7 +696,7 @@
|
||||
this.button18.Location = new System.Drawing.Point(6, 336);
|
||||
this.button18.Name = "button18";
|
||||
this.button18.Size = new System.Drawing.Size(75, 23);
|
||||
this.button18.TabIndex = 14;
|
||||
this.button18.TabIndex = 17;
|
||||
this.button18.Text = "Buy";
|
||||
this.button18.UseVisualStyleBackColor = true;
|
||||
this.button18.Click += new System.EventHandler(this.button18_Click);
|
||||
@@ -700,28 +711,28 @@
|
||||
this.comboBoxOrderColor.Location = new System.Drawing.Point(69, 281);
|
||||
this.comboBoxOrderColor.Name = "comboBoxOrderColor";
|
||||
this.comboBoxOrderColor.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBoxOrderColor.TabIndex = 13;
|
||||
this.comboBoxOrderColor.TabIndex = 15;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(70, 255);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(120, 20);
|
||||
this.textBox2.TabIndex = 11;
|
||||
this.textBox2.TabIndex = 14;
|
||||
//
|
||||
// textBoxOrderMagic
|
||||
//
|
||||
this.textBoxOrderMagic.Location = new System.Drawing.Point(70, 229);
|
||||
this.textBoxOrderMagic.Name = "textBoxOrderMagic";
|
||||
this.textBoxOrderMagic.Size = new System.Drawing.Size(120, 20);
|
||||
this.textBoxOrderMagic.TabIndex = 11;
|
||||
this.textBoxOrderMagic.TabIndex = 13;
|
||||
//
|
||||
// textBoxOrderComment
|
||||
//
|
||||
this.textBoxOrderComment.Location = new System.Drawing.Point(70, 203);
|
||||
this.textBoxOrderComment.Name = "textBoxOrderComment";
|
||||
this.textBoxOrderComment.Size = new System.Drawing.Size(120, 20);
|
||||
this.textBoxOrderComment.TabIndex = 11;
|
||||
this.textBoxOrderComment.TabIndex = 12;
|
||||
//
|
||||
// textBoxOrderProffit
|
||||
//
|
||||
@@ -878,7 +889,7 @@
|
||||
this.button1.Location = new System.Drawing.Point(120, 307);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 12;
|
||||
this.button1.TabIndex = 16;
|
||||
this.button1.Text = "Send";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
@@ -909,7 +920,7 @@
|
||||
this.listBoxSendedOrders.Name = "listBoxSendedOrders";
|
||||
this.listBoxSendedOrders.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
|
||||
this.listBoxSendedOrders.Size = new System.Drawing.Size(419, 43);
|
||||
this.listBoxSendedOrders.TabIndex = 1;
|
||||
this.listBoxSendedOrders.TabIndex = 19;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
@@ -1106,6 +1117,13 @@
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
this.tabPage3.Controls.Add(this.button70);
|
||||
this.tabPage3.Controls.Add(this.label33);
|
||||
this.tabPage3.Controls.Add(this.label32);
|
||||
this.tabPage3.Controls.Add(this.label31);
|
||||
this.tabPage3.Controls.Add(this.textBoxAccountHost);
|
||||
this.tabPage3.Controls.Add(this.textBoxAccountPassword);
|
||||
this.tabPage3.Controls.Add(this.textBoxAccountLogin);
|
||||
this.tabPage3.Controls.Add(this.button67);
|
||||
this.tabPage3.Controls.Add(this.button66);
|
||||
this.tabPage3.Controls.Add(this.button65);
|
||||
@@ -2008,6 +2026,16 @@
|
||||
this.tabPage10.Text = "Object Functions";
|
||||
this.tabPage10.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button68
|
||||
//
|
||||
this.button68.Location = new System.Drawing.Point(6, 39);
|
||||
this.button68.Name = "button68";
|
||||
this.button68.Size = new System.Drawing.Size(75, 23);
|
||||
this.button68.TabIndex = 2;
|
||||
this.button68.Text = "ObjectName";
|
||||
this.button68.UseVisualStyleBackColor = true;
|
||||
this.button68.Click += new System.EventHandler(this.button68_Click);
|
||||
//
|
||||
// comboBox11
|
||||
//
|
||||
this.comboBox11.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
@@ -2027,15 +2055,84 @@
|
||||
this.button4.UseVisualStyleBackColor = true;
|
||||
this.button4.Click += new System.EventHandler(this.button4_Click);
|
||||
//
|
||||
// button68
|
||||
// tabPage11
|
||||
//
|
||||
this.button68.Location = new System.Drawing.Point(6, 39);
|
||||
this.button68.Name = "button68";
|
||||
this.button68.Size = new System.Drawing.Size(75, 23);
|
||||
this.button68.TabIndex = 2;
|
||||
this.button68.Text = "ObjectName";
|
||||
this.button68.UseVisualStyleBackColor = true;
|
||||
this.button68.Click += new System.EventHandler(this.button68_Click);
|
||||
this.tabPage11.Controls.Add(this.button69);
|
||||
this.tabPage11.Location = new System.Drawing.Point(4, 40);
|
||||
this.tabPage11.Name = "tabPage11";
|
||||
this.tabPage11.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabPage11.Size = new System.Drawing.Size(638, 383);
|
||||
this.tabPage11.TabIndex = 11;
|
||||
this.tabPage11.Text = "Backtesting";
|
||||
this.tabPage11.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// button69
|
||||
//
|
||||
this.button69.Location = new System.Drawing.Point(6, 6);
|
||||
this.button69.Name = "button69";
|
||||
this.button69.Size = new System.Drawing.Size(75, 23);
|
||||
this.button69.TabIndex = 4;
|
||||
this.button69.Text = "UnlockTicks";
|
||||
this.button69.UseVisualStyleBackColor = true;
|
||||
this.button69.Click += new System.EventHandler(this.button69_Click);
|
||||
//
|
||||
// textBoxAccountLogin
|
||||
//
|
||||
this.textBoxAccountLogin.Location = new System.Drawing.Point(232, 212);
|
||||
this.textBoxAccountLogin.Name = "textBoxAccountLogin";
|
||||
this.textBoxAccountLogin.Size = new System.Drawing.Size(238, 20);
|
||||
this.textBoxAccountLogin.TabIndex = 15;
|
||||
//
|
||||
// textBoxAccountPassword
|
||||
//
|
||||
this.textBoxAccountPassword.Location = new System.Drawing.Point(234, 238);
|
||||
this.textBoxAccountPassword.Name = "textBoxAccountPassword";
|
||||
this.textBoxAccountPassword.Size = new System.Drawing.Size(238, 20);
|
||||
this.textBoxAccountPassword.TabIndex = 16;
|
||||
//
|
||||
// label31
|
||||
//
|
||||
this.label31.AutoSize = true;
|
||||
this.label31.Location = new System.Drawing.Point(168, 214);
|
||||
this.label31.Name = "label31";
|
||||
this.label31.Size = new System.Drawing.Size(36, 13);
|
||||
this.label31.TabIndex = 17;
|
||||
this.label31.Text = "Login:";
|
||||
//
|
||||
// label32
|
||||
//
|
||||
this.label32.AutoSize = true;
|
||||
this.label32.Location = new System.Drawing.Point(168, 241);
|
||||
this.label32.Name = "label32";
|
||||
this.label32.Size = new System.Drawing.Size(56, 13);
|
||||
this.label32.TabIndex = 17;
|
||||
this.label32.Text = "Password:";
|
||||
//
|
||||
// textBoxAccountHost
|
||||
//
|
||||
this.textBoxAccountHost.Location = new System.Drawing.Point(234, 266);
|
||||
this.textBoxAccountHost.Name = "textBoxAccountHost";
|
||||
this.textBoxAccountHost.Size = new System.Drawing.Size(238, 20);
|
||||
this.textBoxAccountHost.TabIndex = 17;
|
||||
//
|
||||
// label33
|
||||
//
|
||||
this.label33.AutoSize = true;
|
||||
this.label33.Location = new System.Drawing.Point(168, 269);
|
||||
this.label33.Name = "label33";
|
||||
this.label33.Size = new System.Drawing.Size(66, 13);
|
||||
this.label33.TabIndex = 17;
|
||||
this.label33.Text = "MT4 Server:";
|
||||
//
|
||||
// button70
|
||||
//
|
||||
this.button70.Location = new System.Drawing.Point(371, 292);
|
||||
this.button70.Name = "button70";
|
||||
this.button70.Size = new System.Drawing.Size(97, 23);
|
||||
this.button70.TabIndex = 18;
|
||||
this.button70.Text = "ChangeAccount";
|
||||
this.button70.UseVisualStyleBackColor = true;
|
||||
this.button70.Click += new System.EventHandler(this.button70_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
@@ -2081,6 +2178,7 @@
|
||||
this.tabPage9.ResumeLayout(false);
|
||||
this.tabPage9.PerformLayout();
|
||||
this.tabPage10.ResumeLayout(false);
|
||||
this.tabPage11.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -2259,6 +2357,15 @@
|
||||
private System.Windows.Forms.ComboBox comboBox11;
|
||||
private System.Windows.Forms.TextBox textBoxChartId;
|
||||
private System.Windows.Forms.Button button68;
|
||||
private System.Windows.Forms.TabPage tabPage11;
|
||||
private System.Windows.Forms.Button button69;
|
||||
private System.Windows.Forms.Label label33;
|
||||
private System.Windows.Forms.Label label32;
|
||||
private System.Windows.Forms.Label label31;
|
||||
private System.Windows.Forms.TextBox textBoxAccountHost;
|
||||
private System.Windows.Forms.TextBox textBoxAccountPassword;
|
||||
private System.Windows.Forms.TextBox textBoxAccountLogin;
|
||||
private System.Windows.Forms.Button button70;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace TestApiClientUI
|
||||
_apiClient.QuoteRemoved += apiClient_QuoteRemoved;
|
||||
_apiClient.ConnectionStateChanged += apiClient_ConnectionStateChanged;
|
||||
_apiClient.OnLastTimeBar += _apiClient_OnLastTimeBar;
|
||||
_apiClient.OnChartEvent += _apiClient_OnChartEvent;
|
||||
|
||||
InitOrderCommandsGroup();
|
||||
|
||||
@@ -134,14 +135,22 @@ namespace TestApiClientUI
|
||||
private void _apiClient_OnLastTimeBar(object sender, TimeBarArgs e)
|
||||
{
|
||||
var msg =
|
||||
$"TimeBar: Symbol = {e.TimeBar.Symbol}, OpenTime = {e.TimeBar.OpenTime}, CloseTime = {e.TimeBar.CloseTime}, Open = {e.TimeBar.Open}, Close = {e.TimeBar.Close}, High = {e.TimeBar.High}, Low = {e.TimeBar.Low}";
|
||||
$"TimeBar: ExpertHandle = {e.ExpertHandle}, Symbol = {e.TimeBar.Symbol}, OpenTime = {e.TimeBar.OpenTime}, CloseTime = {e.TimeBar.CloseTime}, Open = {e.TimeBar.Open}, Close = {e.TimeBar.Close}, High = {e.TimeBar.High}, Low = {e.TimeBar.Low}";
|
||||
Console.WriteLine(msg);
|
||||
PrintLog(msg);
|
||||
}
|
||||
|
||||
private void _apiClient_OnChartEvent(object sender, ChartEventArgs e)
|
||||
{
|
||||
var msg =
|
||||
$"OnChartEvent: ExpertHandle = {e.ExpertHandle}, ChartId = {e.ChartId}, EventId = {e.EventId}, Lparam = {e.Lparam}, Dparam = {e.Dparam}, Sparam = {e.Sparam}";
|
||||
Console.WriteLine(msg);
|
||||
PrintLog(msg);
|
||||
}
|
||||
|
||||
private void apiClient_QuoteUpdated(object sender, string symbol, double bid, double ask)
|
||||
{
|
||||
Console.WriteLine(@"Quote: Symbol = {0}, Bid = {1}, Ask = {2}", symbol, bid, ask);
|
||||
Console.WriteLine(@"Quote: Symbol = {0}, Bid = {1}, Ask = {2}", symbol, bid, ask);
|
||||
}
|
||||
|
||||
private void _apiClient_QuoteUpdate(object sender, MtQuoteEventArgs e)
|
||||
@@ -673,6 +682,8 @@ namespace TestApiClientUI
|
||||
//OrderSend
|
||||
private async void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ticket = -1;
|
||||
|
||||
var symbol = textBoxOrderSymbol.Text;
|
||||
|
||||
var cmd = (TradeOperation) comboBoxOrderCommand.SelectedIndex;
|
||||
@@ -693,28 +704,43 @@ namespace TestApiClientUI
|
||||
|
||||
var comment = textBoxOrderComment.Text;
|
||||
|
||||
int magic;
|
||||
int.TryParse(textBoxOrderMagic.Text, out magic);
|
||||
|
||||
var expiration = DateTime.Now;
|
||||
|
||||
Color arrowColor;
|
||||
switch (comboBoxOrderColor.SelectedIndex)
|
||||
if (string.IsNullOrEmpty(comment))
|
||||
{
|
||||
case 0:
|
||||
arrowColor = Color.Green;
|
||||
break;
|
||||
case 1:
|
||||
arrowColor = Color.Blue;
|
||||
break;
|
||||
case 2:
|
||||
arrowColor = Color.Red;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit));
|
||||
}
|
||||
else
|
||||
{
|
||||
int magic;
|
||||
if (!int.TryParse(textBoxOrderMagic.Text, out magic))
|
||||
{
|
||||
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (comboBoxOrderColor.SelectedIndex < 0 || comboBoxOrderColor.SelectedIndex > 2)
|
||||
{
|
||||
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic));
|
||||
}
|
||||
else
|
||||
{
|
||||
var expiration = DateTime.Now.AddDays(1);
|
||||
Color arrowColor = Color.White;
|
||||
switch (comboBoxOrderColor.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
arrowColor = Color.Green;
|
||||
break;
|
||||
case 1:
|
||||
arrowColor = Color.Blue;
|
||||
break;
|
||||
case 2:
|
||||
arrowColor = Color.Red;
|
||||
break;
|
||||
}
|
||||
ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrowColor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var ticket = await Execute(() => _apiClient.OrderSend(symbol, cmd, volume, price, slippage, stoploss, takeprofit, comment, magic, expiration, arrowColor));
|
||||
|
||||
PrintLog($"Sended order result: ticket = {ticket}");
|
||||
}
|
||||
@@ -1402,5 +1428,39 @@ namespace TestApiClientUI
|
||||
var result = await Execute(() => _apiClient.ObjectName(chartId, objectIndex));
|
||||
PrintLog($"ObjectName result: {result}");
|
||||
}
|
||||
|
||||
private void button69_Click(object sender, EventArgs e)
|
||||
{
|
||||
_apiClient.UnlockTicks();
|
||||
}
|
||||
|
||||
private async void button70_Click(object sender, EventArgs e)
|
||||
{
|
||||
var login = textBoxAccountLogin.Text;
|
||||
var password = textBoxAccountPassword.Text;
|
||||
var host = textBoxAccountHost.Text;
|
||||
|
||||
if (string.IsNullOrEmpty(login))
|
||||
{
|
||||
MessageBox.Show(@"Login is not defined!", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
textBoxAccountLogin.Focus();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(password))
|
||||
{
|
||||
MessageBox.Show(@"Password is not defined!", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
textBoxAccountPassword.Focus();
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(host))
|
||||
{
|
||||
MessageBox.Show(@"Host is not defined!", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
textBoxAccountHost.Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
var result = await Execute(() => _apiClient.ChangeAccount(login, password, host));
|
||||
PrintLog($"ChangeAccount result: {result}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,163 @@
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| mql4-auth.mqh |
|
||||
//+----------------------------------------------------------------------------+
|
||||
//| Built by Sergey Lukin |
|
||||
//| contact@sergeylukin.com |
|
||||
//+----------------------------------------------------------------------------+
|
||||
|
||||
#include <WinUser32.mqh>
|
||||
|
||||
#import "user32.dll"
|
||||
int GetAncestor(int,int);
|
||||
int GetLastActivePopup(int);
|
||||
int GetDlgItem(int,int);
|
||||
int GetParent(int hWnd);
|
||||
#import
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
bool loginDialogIsOpen()
|
||||
{
|
||||
int hwnd=WindowHandle(Symbol(),Period());
|
||||
int hMetaTrader,hLoginDialog=0;
|
||||
|
||||
// Retrieve Terminal Window Handler
|
||||
while(!IsStopped())
|
||||
{
|
||||
hwnd=GetParent(hwnd);
|
||||
if(hwnd==0) break;
|
||||
hMetaTrader=hwnd;
|
||||
}
|
||||
|
||||
hLoginDialog=GetLastActivePopup(hMetaTrader);
|
||||
if(hLoginDialog!=0)
|
||||
{
|
||||
return(true);
|
||||
} else {
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
void closeLoginDialog()
|
||||
{
|
||||
int hwnd=WindowHandle(Symbol(),Period());
|
||||
int hMetaTrader,hLoginDialog=0,hCancelButton=0;
|
||||
|
||||
// Retrieve Terminal Window Handler
|
||||
while(!IsStopped())
|
||||
{
|
||||
hwnd=GetParent(hwnd);
|
||||
if(hwnd==0) break;
|
||||
hMetaTrader=hwnd;
|
||||
}
|
||||
|
||||
Sleep(60);
|
||||
|
||||
hLoginDialog=GetLastActivePopup(hMetaTrader);
|
||||
if(hLoginDialog!=0)
|
||||
{
|
||||
hCancelButton=GetDlgItem(hLoginDialog,0x2);
|
||||
if(hCancelButton!=0)
|
||||
{
|
||||
// Click "Cancel" button in Login Dialog
|
||||
PostMessageA(hCancelButton,0x00F5,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
bool auth(string login,string passwd,string server)
|
||||
{
|
||||
datetime s=TimeLocal();
|
||||
int h = 0, e = 0, a = GetAncestor(WindowHandle(Symbol(), NULL), 2);
|
||||
int i = 0;
|
||||
|
||||
PostMessageA(a,WM_COMMAND,35429,0);
|
||||
|
||||
while(e==0)
|
||||
{
|
||||
// Give us up to a minute to find the Login dialog
|
||||
if(TimeLocal()-s>60)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
|
||||
h=GetLastActivePopup(a);
|
||||
|
||||
// Select login field
|
||||
e=GetDlgItem(h,0x49d);
|
||||
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
// Press DELETE key many times in login field to remove current value
|
||||
for(i=1; i<=100; i++)
|
||||
{
|
||||
PostMessageA(e,WM_KEYDOWN,0x2E,1);
|
||||
}
|
||||
// Iterate over characters in "login" string and pass them to login field one by one
|
||||
char login_chars[];
|
||||
string2CharsArray(login,login_chars);
|
||||
for(i=0; i<ArraySize(login_chars); i++)
|
||||
{
|
||||
PostMessageA(e,WM_CHAR,login_chars[i],0);
|
||||
}
|
||||
|
||||
// Select password field
|
||||
e=GetDlgItem(h,0x4c4);
|
||||
// Press DELETE key many times in password field to remove current value
|
||||
for(i=1; i<=100; i++)
|
||||
{
|
||||
PostMessageA(e,WM_KEYDOWN,0x2E,1);
|
||||
}
|
||||
// Iterate over characters in "passwd" string and pass them to password field one by one
|
||||
char password_chars[];
|
||||
string2CharsArray(passwd,password_chars);
|
||||
for(i=0; i<ArraySize(password_chars); i++)
|
||||
{
|
||||
PostMessageA(e,WM_CHAR,password_chars[i],0);
|
||||
}
|
||||
|
||||
// Select server field
|
||||
e=GetDlgItem(h,0x50d);
|
||||
// Press DELETE key many times in server field to remove current value
|
||||
for(i=1; i<=100; i++)
|
||||
{
|
||||
PostMessageA(e,WM_KEYDOWN,0x2E,1);
|
||||
}
|
||||
// Iterate over characters in "server" string and pass them to server field one by one
|
||||
char server_chars[];
|
||||
string2CharsArray(server,server_chars);
|
||||
|
||||
for(i=0; i<ArraySize(server_chars); i++)
|
||||
{
|
||||
PostMessageA(e,WM_CHAR,server_chars[i],0);
|
||||
}
|
||||
Sleep(2*1000);
|
||||
// Press submit button
|
||||
e=GetDlgItem(h,0x1);
|
||||
SendMessageA(e,0x00F5,0,0);
|
||||
|
||||
return(true);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| |
|
||||
//+------------------------------------------------------------------+
|
||||
/*
|
||||
* Iterates over string and puts each character code in array
|
||||
*/
|
||||
void string2CharsArray(string myString,char &chars[])
|
||||
{
|
||||
int cnt=StringLen(myString);
|
||||
ArrayResize(chars,cnt);
|
||||
|
||||
for(int i=0; i<cnt; i++)
|
||||
{
|
||||
chars[i]=StringGetChar(myString,i);
|
||||
}
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
|
||||
Binary file not shown.
+5284
-1486
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user