update workspace ...

This commit is contained in:
2024-05-17 04:54:01 +03:30
parent 3fa288c92c
commit 642713072e
429 changed files with 111729 additions and 9330 deletions
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
File diff suppressed because it is too large Load Diff
Binary file not shown.
Binary file not shown.
@@ -22,16 +22,13 @@
//
// START Inputs ...
//
input group "Logging";
input bool enableLogging = true; // Enable Logging
// input group "Logging";
// input bool enableLogging = true; // Enable Logging
bool enableLogging = true; // Enable Logging
//
// END Inputs ...
//
//
// Including Models ...
#include "x-saherelm.models.lib.mq5"
//
// START Global Definitions: Variables, Properties and etc ...
//
@@ -74,6 +71,22 @@ void LogEmptyLine()
LogMessage(" ");
}
//
void LogError(
int error = -1 // Specific Error
) {
//
if (error <= -1) {
error = GetLastError();
}
//
string errorMsg = GetErrorDescription(error);
//
LogMessage("Error: " + errorMsg);
}
//
// Logging an Array ...
void LogArray(int &array[])
@@ -115,3 +128,957 @@ void LogArray(string &array[])
//
// END Provided Functions ...
//
//
// Error Descriptions Functions ...
//
//
// Retrieve Specified Error Code Description ...
string GetErrorDescription(int err_code)
{
//
string result = "";
//
switch (err_code)
{
//
//--- Constant Description
//
case ERR_SUCCESS:
result = "The operation completed successfully";
break;
//
case ERR_INTERNAL_ERROR:
result = "Unexpected internal error";
break;
//
case ERR_WRONG_INTERNAL_PARAMETER:
result = "Wrong parameter in the inner call of the client terminal function";
break;
//
case ERR_INVALID_PARAMETER:
result = "Wrong parameter when calling the system function";
break;
//
case ERR_NOT_ENOUGH_MEMORY:
result = "Not enough memory to perform the system function";
break;
//
case ERR_STRUCT_WITHOBJECTS_ORCLASS:
result = "The structure contains objects of strings and/or dynamic arrays and/or structure of such objects and/or classes";
break;
//
case ERR_INVALID_ARRAY:
result = "Array of a wrong type, wrong size, or a damaged object of a dynamic array";
break;
//
case ERR_ARRAY_RESIZE_ERROR:
result = "Not enough memory for the relocation of an array, or an attempt to change the size of a static array";
break;
//
case ERR_STRING_RESIZE_ERROR:
result = "Not enough memory for the relocation of string";
break;
//
case ERR_NOTINITIALIZED_STRING:
result = "Not initialized string";
break;
//
case ERR_INVALID_DATETIME:
result = "Invalid date and/or time";
break;
//
case ERR_ARRAY_BAD_SIZE:
result = "Requested array size exceeds 2 GB";
break;
//
case ERR_INVALID_POINTER:
result = "Wrong pointer";
break;
//
case ERR_INVALID_POINTER_TYPE:
result = "Wrong type of pointer";
break;
//
case ERR_FUNCTION_NOT_ALLOWED:
result = "System function is not allowed to call";
break;
//
//--- Charts
//
case ERR_CHART_WRONG_ID:
result = "Wrong chart ID";
break;
//
case ERR_CHART_NO_REPLY:
result = "Chart does not respond";
break;
//
case ERR_CHART_NOT_FOUND:
result = "Chart not found";
break;
//
case ERR_CHART_NO_EXPERT:
result = "No Expert Advisor in the chart that could handle the event";
break;
//
case ERR_CHART_CANNOT_OPEN:
result = "Chart opening error";
break;
//
case ERR_CHART_CANNOT_CHANGE:
result = "Failed to change chart symbol and period";
break;
//
case ERR_CHART_CANNOT_CREATE_TIMER:
result = "Failed to create timer";
break;
//
case ERR_CHART_WRONG_PROPERTY:
result = "Wrong chart property ID";
break;
//
case ERR_CHART_SCREENSHOT_FAILED:
result = "Error creating screenshots";
break;
//
case ERR_CHART_NAVIGATE_FAILED:
result = "Error navigating through chart";
break;
//
case ERR_CHART_TEMPLATE_FAILED:
result = "Error applying template";
break;
//
case ERR_CHART_WINDOW_NOT_FOUND:
result = "Subwindow containing the indicator was not found";
break;
//
case ERR_CHART_INDICATOR_CANNOT_ADD:
result = "Error adding an indicator to chart";
break;
//
case ERR_CHART_INDICATOR_CANNOT_DEL:
result = "Error deleting an indicator from the chart";
break;
//
case ERR_CHART_INDICATOR_NOT_FOUND:
result = "Indicator not found on the specified chart";
break;
//
//--- Graphical Objects
case ERR_OBJECT_ERROR:
result = "Error working with a graphical object";
break;
//
case ERR_OBJECT_NOT_FOUND:
result = "Graphical object was not found";
break;
//
case ERR_OBJECT_WRONG_PROPERTY:
result = "Wrong ID of a graphical object property";
break;
//
case ERR_OBJECT_GETDATE_FAILED:
result = "Unable to get date corresponding to the value";
break;
//
case ERR_OBJECT_GETVALUE_FAILED:
result = "Unable to get value corresponding to the date";
break;
//
//--- MarketInfo
//
case ERR_MARKET_UNKNOWN_SYMBOL:
result = "Unknown symbol";
break;
//
case ERR_MARKET_NOT_SELECTED:
result = "Symbol is not selected in MarketWatch";
break;
//
case ERR_MARKET_WRONG_PROPERTY:
result = "Wrong identifier of a symbol property";
break;
//
case ERR_MARKET_LASTTIME_UNKNOWN:
result = "Time of the last tick is not known (no ticks)";
break;
//
case ERR_MARKET_SELECT_ERROR:
result = "Error adding or deleting a symbol in MarketWatch";
break;
//
//--- History Access
//
case ERR_HISTORY_NOT_FOUND:
result = "Requested history not found";
break;
//
case ERR_HISTORY_WRONG_PROPERTY:
result = "Wrong ID of the history property";
break;
//
//--- Global_Variables
//
case ERR_GLOBALVARIABLE_NOT_FOUND:
result = "Global variable of the client terminal is not found";
break;
//
case ERR_GLOBALVARIABLE_EXISTS:
result = "Global variable of the client terminal with the same name already exists";
break;
//
case ERR_MAIL_SEND_FAILED:
result = "Email sending failed";
break;
//
case ERR_PLAY_SOUND_FAILED:
result = "Sound playing failed";
break;
//
case ERR_MQL5_WRONG_PROPERTY:
result = "Wrong identifier of the program property";
break;
//
case ERR_TERMINAL_WRONG_PROPERTY:
result = "Wrong identifier of the terminal property";
break;
//
case ERR_FTP_SEND_FAILED:
result = "File sending via ftp failed";
break;
//
case ERR_NOTIFICATION_SEND_FAILED:
result = "Error in sending notification";
break;
//
//--- Custom Indicator Buffers
//
case ERR_BUFFERS_NO_MEMORY:
result = "Not enough memory for the distribution of indicator buffers";
break;
//
case ERR_BUFFERS_WRONG_INDEX:
result = "Wrong indicator buffer index";
break;
//
//--- Custom Indicator Properties
//
case ERR_CUSTOM_WRONG_PROPERTY:
result = "Wrong ID of the custom indicator property";
break;
//
//--- Account
//
case ERR_ACCOUNT_WRONG_PROPERTY:
result = "Wrong account property ID";
break;
//
case ERR_TRADE_WRONG_PROPERTY:
result = "Wrong trade property ID";
break;
//
case ERR_TRADE_DISABLED:
result = "Trading by Expert Advisors prohibited";
break;
//
case ERR_TRADE_POSITION_NOT_FOUND:
result = "Position not found";
break;
//
case ERR_TRADE_ORDER_NOT_FOUND:
result = "Order not found";
break;
//
case ERR_TRADE_DEAL_NOT_FOUND:
result = "Deal not found";
break;
//
case ERR_TRADE_SEND_FAILED:
result = "Trade request sending failed";
break;
//
//--- Indicators
//
case ERR_INDICATOR_UNKNOWN_SYMBOL:
result = "Unknown symbol";
break;
//
case ERR_INDICATOR_CANNOT_CREATE:
result = "Indicator cannot be created";
break;
//
case ERR_INDICATOR_NO_MEMORY:
result = "Not enough memory to add the indicator";
break;
//
case ERR_INDICATOR_CANNOT_APPLY:
result = "The indicator cannot be applied to another indicator";
break;
//
case ERR_INDICATOR_CANNOT_ADD:
result = "Error applying an indicator to chart";
break;
//
case ERR_INDICATOR_DATA_NOT_FOUND:
result = "Requested data not found";
break;
//
case ERR_INDICATOR_WRONG_HANDLE:
result = "Wrong indicator handle";
break;
//
case ERR_INDICATOR_WRONG_PARAMETERS:
result = "Wrong number of parameters when creating an indicator";
break;
//
case ERR_INDICATOR_PARAMETERS_MISSING:
result = "No parameters when creating an indicator";
break;
//
case ERR_INDICATOR_CUSTOM_NAME:
result = "The first parameter in the array must be the name of the custom indicator";
break;
//
case ERR_INDICATOR_PARAMETER_TYPE:
result = "Invalid parameter type in the array when creating an indicator";
break;
//
case ERR_INDICATOR_WRONG_INDEX:
result = "Wrong index of the requested indicator buffer";
break;
//
//--- Depth of Market
//
case ERR_BOOKS_CANNOT_ADD:
result = "Depth Of Market can not be added";
break;
//
case ERR_BOOKS_CANNOT_DELETE:
result = "Depth Of Market can not be removed";
break;
//
case ERR_BOOKS_CANNOT_GET:
result = "The data from Depth Of Market can not be obtained";
break;
//
case ERR_BOOKS_CANNOT_SUBSCRIBE:
result = "Error in subscribing to receive new data from Depth Of Market";
break;
//
//--- File Operations
//
case ERR_TOO_MANY_FILES:
result = "More than 64 files cannot be opened at the same time";
break;
//
case ERR_WRONG_FILENAME:
result = "Invalid file name";
break;
//
case ERR_TOO_LONG_FILENAME:
result = "Too long file name";
break;
//
case ERR_CANNOT_OPEN_FILE:
result = "File opening error";
break;
//
case ERR_FILE_CACHEBUFFER_ERROR:
result = "Not enough memory for cache to read";
break;
//
case ERR_CANNOT_DELETE_FILE:
result = "File deleting error";
break;
//
case ERR_INVALID_FILEHANDLE:
result = "A file with this handle was closed, or was not opening at all";
break;
//
case ERR_WRONG_FILEHANDLE:
result = "Wrong file handle";
break;
//
case ERR_FILE_NOTTOWRITE:
result = "The file must be opened for writing";
break;
//
case ERR_FILE_NOTTOREAD:
result = "The file must be opened for reading";
break;
//
case ERR_FILE_NOTBIN:
result = "The file must be opened as a binary one";
break;
//
case ERR_FILE_NOTTXT:
result = "The file must be opened as a text";
break;
//
case ERR_FILE_NOTTXTORCSV:
result = "The file must be opened as a text or CSV";
break;
//
case ERR_FILE_NOTCSV:
result = "The file must be opened as CSV";
break;
//
case ERR_FILE_READERROR:
result = "File reading error";
break;
//
case ERR_FILE_BINSTRINGSIZE:
result = "String size must be specified, because the file is opened as binary";
break;
//
case ERR_INCOMPATIBLE_FILE:
result = "A text file must be for string arrays, for other arrays - binary";
break;
//
case ERR_FILE_IS_DIRECTORY:
result = "This is not a file, this is a directory";
break;
//
case ERR_FILE_NOT_EXIST:
result = "File does not exist";
break;
//
case ERR_FILE_CANNOT_REWRITE:
result = "File can not be rewritten";
break;
//
case ERR_WRONG_DIRECTORYNAME:
result = "Wrong directory name";
break;
//
case ERR_DIRECTORY_NOT_EXIST:
result = "Directory does not exist";
break;
//
case ERR_FILE_ISNOT_DIRECTORY:
result = "This is a file, not a directory";
break;
//
case ERR_CANNOT_DELETE_DIRECTORY:
result = "The directory cannot be removed";
break;
//
case ERR_CANNOT_CLEAN_DIRECTORY:
result = "Failed to clear the directory (probably one or more files are blocked and removal operation failed)";
break;
//
case ERR_FILE_WRITEERROR:
result = "Failed to write a resource to a file";
break;
//
//--- String Casting
//
case ERR_NO_STRING_DATE:
result = "No date in the string";
break;
//
case ERR_WRONG_STRING_DATE:
result = "Wrong date in the string";
break;
//
case ERR_WRONG_STRING_TIME:
result = "Wrong time in the string";
break;
//
case ERR_STRING_TIME_ERROR:
result = "Error converting string to date";
break;
//
case ERR_STRING_OUT_OF_MEMORY:
result = "Not enough memory for the string";
break;
//
case ERR_STRING_SMALL_LEN:
result = "The string length is less than expected";
break;
//
case ERR_STRING_TOO_BIGNUMBER:
result = "Too large number, more than ULONG_MAX";
break;
//
case ERR_WRONG_FORMATSTRING:
result = "Invalid format string";
break;
//
case ERR_TOO_MANY_FORMATTERS:
result = "Amount of format specifiers more than the parameters";
break;
//
case ERR_TOO_MANY_PARAMETERS:
result = "Amount of parameters more than the format specifiers";
break;
//
case ERR_WRONG_STRING_PARAMETER:
result = "Damaged parameter of string type";
break;
//
case ERR_STRINGPOS_OUTOFRANGE:
result = "Position outside the string";
break;
//
case ERR_STRING_ZEROADDED:
result = "0 added to the string end, a useless operation";
break;
//
case ERR_STRING_UNKNOWNTYPE:
result = "Unknown data type when converting to a string";
break;
//
case ERR_WRONG_STRING_OBJECT:
result = "Damaged string object";
break;
//
//--- Operations with Arrays
//
case ERR_INCOMPATIBLE_ARRAYS:
result = "Copying incompatible arrays. String array can be copied only to a string array, and a numeric array - in numeric array only";
break;
//
case ERR_SMALL_ASSERIES_ARRAY:
result = "The receiving array is declared as AS_SERIES, and it is of insufficient size";
break;
//
case ERR_SMALL_ARRAY:
result = "Too small array, the starting position is outside the array";
break;
//
case ERR_ZEROSIZE_ARRAY:
result = "An array of zero length";
break;
//
case ERR_NUMBER_ARRAYS_ONLY:
result = "Must be a numeric array";
break;
//
case ERR_ONEDIM_ARRAYS_ONLY:
result = "Must be a one-dimensional array";
break;
//
case ERR_SERIES_ARRAY:
result = "Timeseries cannot be used";
break;
//
case ERR_DOUBLE_ARRAY_ONLY:
result = "Must be an array of type double";
break;
//
case ERR_FLOAT_ARRAY_ONLY:
result = "Must be an array of type float";
break;
//
case ERR_LONG_ARRAY_ONLY:
result = "Must be an array of type long";
break;
//
case ERR_INT_ARRAY_ONLY:
result = "Must be an array of type int";
break;
//
case ERR_SHORT_ARRAY_ONLY:
result = "Must be an array of type short";
break;
//
case ERR_CHAR_ARRAY_ONLY:
result = "Must be an array of type char";
break;
//
//--- Operations with OpenCL
//
case ERR_OPENCL_NOT_SUPPORTED:
result = "OpenCL functions are not supported on this computer";
break;
//
case ERR_OPENCL_INTERNAL:
result = "Internal error occurred when running OpenCL";
break;
//
case ERR_OPENCL_INVALID_HANDLE:
result = "Invalid OpenCL handle";
break;
//
case ERR_OPENCL_CONTEXT_CREATE:
result = "Error creating the OpenCL context";
break;
//
case ERR_OPENCL_QUEUE_CREATE:
result = "Failed to create a run queue in OpenCL";
break;
//
case ERR_OPENCL_PROGRAM_CREATE:
result = "Error occurred when compiling an OpenCL program";
break;
//
case ERR_OPENCL_TOO_LONG_KERNEL_NAME:
result = "Too long kernel name (OpenCL kernel)";
break;
//
case ERR_OPENCL_KERNEL_CREATE:
result = "Error creating an OpenCL kernel";
break;
//
case ERR_OPENCL_SET_KERNEL_PARAMETER:
result = "Error occurred when setting parameters for the OpenCL kernel";
break;
//
case ERR_OPENCL_EXECUTE:
result = "OpenCL program runtime error";
break;
//
case ERR_OPENCL_WRONG_BUFFER_SIZE:
result = "Invalid size of the OpenCL buffer";
break;
//
case ERR_OPENCL_WRONG_BUFFER_OFFSET:
result = "Invalid offset in the OpenCL buffer";
break;
//
case ERR_OPENCL_BUFFER_CREATE:
result = "Failed to create and OpenCL buffer";
break;
//
//--- User-Defined Errors
default:
result = "UNKNOWN Erro ...";
break;
}
//
return result;
}
//
// Retrieve Specified Error Code Description ...
string GetTradeServerReturnCodeDescription(int return_code)
{
//
string result = "";
//
switch (return_code)
{
//
case TRADE_RETCODE_REQUOTE:
result = "Requote";
break;
//
case TRADE_RETCODE_REJECT:
result = "Request rejected";
break;
//
case TRADE_RETCODE_CANCEL:
result = "Request canceled by trader";
break;
//
case TRADE_RETCODE_PLACED:
result = "Order placed";
break;
//
case TRADE_RETCODE_DONE:
result = "Request completed";
break;
//
case TRADE_RETCODE_DONE_PARTIAL:
result = "Only part of the request was completed";
break;
//
case TRADE_RETCODE_ERROR:
result = "Request processing error";
break;
//
case TRADE_RETCODE_TIMEOUT:
result = "Request canceled by timeout";
break;
//
case TRADE_RETCODE_INVALID:
result = "Invalid request";
break;
//
case TRADE_RETCODE_INVALID_VOLUME:
result = "Invalid volume in the request";
break;
//
case TRADE_RETCODE_INVALID_PRICE:
result = "Invalid price in the request";
break;
//
case TRADE_RETCODE_INVALID_STOPS:
result = "Invalid stops in the request";
break;
//
case TRADE_RETCODE_TRADE_DISABLED:
result = "Trade is disabled";
break;
//
case TRADE_RETCODE_MARKET_CLOSED:
result = "Market is closed";
break;
//
case TRADE_RETCODE_NO_MONEY:
result = "There is not enough money to complete the request";
break;
//
case TRADE_RETCODE_PRICE_CHANGED:
result = "Prices changed";
break;
//
case TRADE_RETCODE_PRICE_OFF:
result = "There are no quotes to process the request";
break;
//
case TRADE_RETCODE_INVALID_EXPIRATION:
result = "Invalid order expiration date in the request";
break;
//
case TRADE_RETCODE_ORDER_CHANGED:
result = "Order state changed";
break;
//
case TRADE_RETCODE_TOO_MANY_REQUESTS:
result = "Too frequent requests";
break;
//
case TRADE_RETCODE_NO_CHANGES:
result = "No changes in request";
break;
//
case TRADE_RETCODE_SERVER_DISABLES_AT:
result = "Autotrading disabled by server";
break;
//
case TRADE_RETCODE_CLIENT_DISABLES_AT:
result = "Autotrading disabled by client terminal";
break;
//
case TRADE_RETCODE_LOCKED:
result = "Request locked for processing";
break;
//
case TRADE_RETCODE_FROZEN:
result = "Order or position frozen";
break;
//
case TRADE_RETCODE_INVALID_FILL:
result = "Invalid order filling type";
break;
//
case TRADE_RETCODE_CONNECTION:
result = "No connection with the trade server";
break;
//
case TRADE_RETCODE_ONLY_REAL:
result = "Operation is allowed only for live accounts";
break;
//
case TRADE_RETCODE_LIMIT_ORDERS:
result = "The number of pending orders has reached the limit";
break;
//
case TRADE_RETCODE_LIMIT_VOLUME:
result = "The volume of orders and positions for the symbol has reached the limit";
break;
//
default:
result = "Invalid return code of the trade server";
break;
}
//
return result;
}
Binary file not shown.
@@ -1,238 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Models Library
// ---------------------------------------
// Name: XModels
// Description: provides all required models ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// START Inputs ...
//
//
// END Inputs ...
//
//
// START Global Definitions: Variables, Properties and etc ...
//
//
// END Global Definitions: Variables, Properties and etc ...
//
//
// START Provided Functions ...
//
//
// How To Calculate Static Volume ...
enum ENUM_STATIC_VOLUME_METHODS
{
//
// Based On Deposit ...
X_STATIC_VOLUME_BASED_ON_DEPOSIT,
//
// Based On Balance ...
X_STATIC_VOLUME_BASED_ON_BALANCE,
};
//
// START Model Definitions ...
//
//
// OHCL Candel Model ...
enum ENUM_X_PRICE
{
X_PRICE_HIGH,
X_PRICE_OPEN,
X_PRICE_CLOSE,
X_PRICE_LOW
};
//
// Swing Types Enum ...
enum ENUM_X_SWING_TYPE
{
X_NO_SWING = 0,
X_SWING_HIGH = 1,
X_SWING_LOW = -1,
};
//
// Available Guard Action ...
enum ENUM_X_GUARD_ACTIONS
{
X_GUARD_ACTION_HEDGE,
X_GUARD_PARTIAL_CLOSE,
X_GUARD_ACTION_TRAIL_STOP,
X_GUARD_ACTION_FORCE_CLOSE,
X_GUARD_ACTION_ADD_SUPPORT_SIGNAL,
X_GUARD_ACTION_CANCEL_PENDING_ORDERS,
};
//
// Model Guard Info ...
struct XGuard
{
string symbol;
string provider;
ENUM_TIMEFRAMES period;
ENUM_POSITION_TYPE type;
ENUM_X_GUARD_ACTIONS action;
//
double dblPayLoad;
string strPayload;
};
//
// Describe an Specific Candle ...
struct XOHCL
{
double high;
double open;
double close;
double low;
};
//
// Model Support and Resistance
// for Specific Bar ...
struct XOHCLSupRes
{
//
double res[];
//
double sup[];
};
//
// Available Order Modes ...
enum ENUM_X_ORDER_MODES
{
X_ORDER_MODE_MARKET = 0, // Market Order
X_ORDER_MODE_STOP = 1, // Pending Stop Order
X_ORDER_MODE_LIMIT = 2, // Pending Limit Order
X_ORDER_MODE_STOP_LIMIT = 3, // Pending Stop Limit Order
};
//
// Model a Signal ...
struct XSignal
{
//
string providers[];
//
string symbol;
//
ENUM_TIMEFRAMES period;
//
ENUM_POSITION_TYPE type;
//
ENUM_X_ORDER_MODES mode;
//
double entry;
//
double riskAmount;
//
double tp;
//
double sl;
//
double r2r;
//
double volume;
//
bool calculateTP;
//
bool useSupportAndResistance;
//
bool useRiskAmountAsVolume;
};
//
// EXTENSION Methods ...
//
void Add(
XSignal &item,
XSignal &buffer[])
{
//
ArrayResize(
buffer,
ArraySize(buffer) + 1);
//
buffer[ArraySize(buffer) - 1] = item;
}
//
// Clear an Specific Signal Item ...
void Clean(XSignal &item)
{
//
ArrayFree(item.providers);
ArrayResize(item.providers, 0);
//
item.symbol = "";
item.type = NULL;
item.mode = NULL;
item.period = NULL;
//
item.tp = 0;
item.sl = 0;
item.r2r = 0;
item.entry = 0;
item.volume = 0;
item.riskAmount = 0;
}
//
void Clean(XSignal &buffer[])
{
//
ArrayFree(buffer);
ArrayResize(buffer, 0);
}
//
void Clean(XGuard &buffer[])
{
//
ArrayFree(buffer);
ArrayResize(buffer, 0);
}
//
// END Provided Functions ...
//
@@ -1,85 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Seriallize Library
// ---------------------------------------
// Name: XSeriallizer
// Description: provides Seriallizing EA abilities ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
#include "../Libraries/x-saherelm.models.lib.mq5"
#include "../Libraries/x-saherelm.common.lib.mq5"
#include "../Classes/x-saherelm.xtrade.class.mq5"
//
string XProviderToken = "PRV";
string XSupportToken = "SP";
//
string GenerateSupportSignalComment(
ulong ticket // Position/Order Ticket
)
{
//
string result = "";
//
result = XSupportToken + "(" + (string)ticket + ")";
//
return result;
}
//
string ExtractParentTicketOfSupport(string comment)
{
//
string result = "";
if (StringLen(comment) <= 0)
{
return result;
}
//
result = ExtractString(
comment,
XSupportToken + "(",
")");
//
return result;
}
//
// Extract a Provider name if exists from a Comment ...
string ExtractProvider(string comment)
{
//
string result = "";
if (StringLen(comment) <= 0)
{
return result;
}
//
result = ExtractString(
comment,
XProviderToken + "(",
")");
//
return result;
}
@@ -1,241 +0,0 @@
///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 X12 Draw Library
// ------------------------------------------
// Name: X121Draw
// Description: provides Draw Requirements ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
#include "../Libraries/x-saherelm.draw.lib.mq5"
#include "../Libraries/x-saherelm.common.lib.mq5"
#include "../Libraries/x-saherelm.models.lib.mq5"
//
// START Draw Functions ...
//
//
// Draw Signal ...
void DrawSignal(const ulong ticket, XSignal &signal)
{
//
bool isLong = IsLong(signal.type);
//
string prefix = (string)ticket + "_" + ToString(signal.period);
//
// Retrieve Time ...
datetime time = iTime(
signal.symbol,
signal.period,
0);
//
// Retrieve 3 Time ...
datetime time3 = iTime(
signal.symbol,
signal.period,
3);
//
color posColor = isLong
? clrSpringGreen
: clrTomato;
color tpColor = clrSpringGreen;
color slColor = clrTomato;
color entryColor = clrGold;
//
ENUM_LINE_STYLE vLineStyle = STYLE_DOT;
ENUM_LINE_STYLE tpLineStyle = STYLE_SOLID;
ENUM_LINE_STYLE slLineStyle = STYLE_SOLID;
ENUM_LINE_STYLE entryLineStyle = STYLE_SOLID;
//
int lineWidth = 2;
//
long chartID = ChartID();
//
// Vertical Line ...
string vlName = prefix + "_" + (string)time;
//
DrawVerticalLine(
chartID,
vlName,
0,
time,
posColor,
vLineStyle,
lineWidth);
//
// TP ...
double profit = (MathAbs(signal.tp - signal.entry)) * signal.volume;
string tpName = prefix + "_TP_" + (string)profit;
//
DrawTrendLine(
chartID,
tpName,
0,
time3,
signal.tp,
time,
signal.tp,
tpColor,
tpLineStyle,
lineWidth);
//
// SL ...
double lost = (MathAbs(signal.sl - signal.entry)) * signal.volume;
string slName = prefix + "_SL_" + (string)lost;
//
DrawTrendLine(
chartID,
slName,
0,
time3,
signal.sl,
time,
signal.sl,
slColor,
slLineStyle,
lineWidth);
//
// ENTRY ...
string entryName = prefix + "_ENTRY_" + (string)lost;
//
DrawTrendLine(
chartID,
entryName,
0,
time3,
signal.entry,
time,
signal.entry,
entryColor,
entryLineStyle,
lineWidth);
}
//
// Draw Support and Resistance ...
void DrawSupportResistance(
int bar_index,
XOHCLSupRes &data,
string prefix = "",
color supportColor = clrOrange,
color resistanceColor = clrOrange)
{
//
datetime barTime = GetCandleTime(
_Symbol,
_Period,
bar_index);
//
datetime prevBarTime = GetCandleTime(
_Symbol,
_Period,
bar_index + 5);
//
long chID = ChartID();
int subWindiw = 0;
int lineWidth = 1;
//
string mPrefix = prefix + "_" + (string)barTime + "_";
//
// SUPPORTS ...
//
int supCount = ArraySize(data.sup);
if (supCount > 0)
{
//
for (int i = 0; i < supCount; i++)
{
//
double iSup = data.sup[i];
//
string supTlName = mPrefix + "SUP[" + (string)(i + 1) + "]_(" + (string)iSup + ")";
//
// Draw Support ...
DrawTrendLine(
chID,
supTlName,
subWindiw,
prevBarTime,
iSup,
barTime,
iSup,
supportColor,
STYLE_DOT,
lineWidth,
true);
}
}
//
// RESISTANCES ...
//
int resCount = ArraySize(data.res);
if (resCount > 0)
{
//
for (int i = 0; i < resCount; i++)
{
//
double iRes = data.res[i];
//
string resTlName = mPrefix + "RES[" + (string)(i + 1) + "]_(" + (string)iRes + ")";
//
// Draw Support ...
DrawTrendLine(
chID,
resTlName,
subWindiw,
prevBarTime,
iRes,
barTime,
iRes,
resistanceColor,
STYLE_DOT,
lineWidth,
true);
}
}
}
//
// END Draw Functions ...
//
File diff suppressed because it is too large Load Diff