This commit is contained in:
2026-07-10 04:24:32 +03:30
parent 76f57aff36
commit 369e6f0863
25 changed files with 1679 additions and 24 deletions
+136
View File
@@ -0,0 +1,136 @@
# XCAccount
it is a module which used for Accoess Trading Account Data in SaherElm's XTrade Framework.
## Dependencies
there is no Dependencies on this modules.
## Instancing
there is not any args in Constructor.
## Instructions
use provided Actions for Access Account informations in where you need.
## Actions
### long GetUserAccount()
retrieve Current User Identifier.
### long GetLeverage()
retrieve Current Account Leverage.
### bool CanExpertTrade()
retrieve Flag which Specified Trading using Experts or Manual.
### ENUM_ACCOUNT_TRADE_MODE GetTradeMode()
retrieve Current Account Trading Mode.
- ACCOUNT_TRADE_MODE_DEMO;
- ACCOUNT_TRADE_MODE_CONTEST;
- ACCOUNT_TRADE_MODE_REAL;
### double GetBalance()
retrieve Current Account Balance.
### double GetCredit()
retrieve Current Account Credit.
### double GetProfit()
retrieve Current Account's Amount of Profits.
### double GetEquity()
retrieve Current Account's Amount of Equity.
### double GetMargin()
retrieve Current Account's Amount of Margin.
### double GetFreeMargin()
retrieve Current Account's Amount of Free Margin.
### double GetMarginLevel()
retrieve Current Account's Margin Level.
### double GetMarginCall()
retrieve Current Account's Margin Call Level.
### double GetMarginStopOut()
retrieve Current Account's Margin Stopout Level.
### string GetName()
retrieve Current Account's User Name.
### string GetServerName()
retrieve Current Account's Server Name.
### string GetCurrency()
retrieve Current Account's Currency.
### string GetCompany()
retrieve Current Account's Market Name.
### double CalculateTradeProfit(const string symbol, ENUM_ORDER_TYPE type, double volume, double entry, double exit)
Calculate and Retrieved Trade Profit based on Account Currency.
### double CalculateMarging(const string symbol, ENUM_ORDER_TYPE type, double volume, double entry)
Calculate and Retrieved Specified Trades used Marigin.
### double CalculateFreeMarging(const string symbol, ENUM_ORDER_TYPE type, double volume, double entry)
Calculate and Retrieved Specified Trades Free Marigin.
### double CalculateMaxVolume(const string symbol, ENUM_ORDER_TYPE type, double entry, double percent = 100)
Calculate Max Allowed Specified Trade's Volume for Entry.
### double GetPointValue(string symbol)
Retrieve Specified Symbol's Point Value.
### double CalculateRiskAmount(string symbol, double points, double volume)
Calculate How many Risk Currency in a Trade when risk Points and Trade Volume is Specified.
used when we have to know how many risk in $ Currency, for a Trade when we risk 100 Point, by Providing 0.01 Lot as Volume.
### double CalculateRiskPoints(string symbol, double volume, double amount)
Calculate Risk Points in a Trade when Volume and Curreny Amount is Specified.
used when we want to know How many points risk in a Trade when we have to risk 5$ in a Trade by 0.01 Lot as Volume.
### double CalculateVolume(string symbol, double amount, double points)
Calculate Trade Volume when Risk Amount in Currency and Risk Amount in Points Specified.
used when we want to know Open a Trade by how Size of Volume when we have to risk 5$ in a Trade when 100 points risking.
### string GetBalanceReportMessage()
Prepare and Retrieve Balance Report Message for Current Account.
## Maintainer
Hadi Khazaee asl
[https://www.saherelm.ir](https://www.saherelm.ir)
[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com)
+143
View File
@@ -0,0 +1,143 @@
# XCAlert
it is a module which used for Providing Logs in SaherElm's XTrade Framework.
## Dependencies
this Module used XCDataCollector for Saving Logs in Files.
## Instancing
using this syntax for instancing :
```mql5
XCAlert(
string prefix = "X-Alert", // Alerts Prefixe
bool enableAlerts = true, // Enable Alerts
bool logAlerts = true, // Log Alerts
bool terminalAlerts = false, // Terminal Alerts
bool mailAlerts = false, // Mail Alerts
bool pushAlerts = false, // Push Alerts
bool saveAlerts = false // Save Alerts
) {}
```
all of Constructor Input args is Optional, means have default values.
you can set them after instancing using Properties Setter/Getter (s).
## Instructions
- Prefix: string, Specified Logger Prefix. this for Separate Different Logger Instances.
- EnableAlerts: boolean, Specified Logging is Enabled or not.
- SaveAlerts: boolean, Specified Saving Log(s) or not.
- LogAlerts: boolean, Specified Can Print Logs on Console or not.
- TerminalAlerts: boolean, Specified Send Logs in Terminal or not.
- MailAlerts: boolean, Specified Send Logs as Mail or not.
- PushAlerts: boolean, Specified Send Logs as Push or not.
## Actions
### LogAlert(string message)
do specified type of Logs.
do log by Print in Console.
### TerminalAlert(string message)
do specified type of Logs.
do log by sending Terminal Alert.
### MailAlert(string message)
do specified type of Logs.
do log by sending Mail Alert.
### PushAlert(string message)
do specified type of Logs.
do log by sending Push Notification Alert.
### SendAlert(string message)
do sending log by configuration.
retrieve log and based on configuration send each specified enabled logs separately.
### Log(string message)
Checking Log Flag and Print Message.
### Log(string tag, string message)
Checking Log Flag and Print Specified Tag & Message.
### LogEmpty()
Checking Log Flag and Print Empty Message.
### LogArray(T &array[], string label = NULL)
Checking Log Flag and Print Array.
### LogError(int error = -1)
Checking Log Flag and then Generate Error Message based on provided error number,
then Print Tag Specified Message.
### string GetErrorDescription(int err_code)
Generate Specified Error Messaged based on Provided error code.
### string GetTradeServerReturnCodeDescription(int return_code)
Generate Specified Error Message based on Provided server error code.
### bool CanLog()
protected
return a Flag for Specified Flag which allowed Print Logs or not.
### bool CanLogAlert()
protected
return a Flag for Specified Flag which allowed Print Logs and also Enabled or not.
### bool CanTerminalAlert()
protected
return a Flag for Specified Flag which allowed Sending Logs to Terminal and also Enabled or not.
### bool CanMailAlert()
protected
return a Flag for Specified Flag which allowed Sending Logs as Mail and also Enabled or not.
### bool CanPushAlert()
protected
return a Flag for Speified Flag which allowed Sending Logs as Push and also Enabled or not.
### Save(string message)
protected
Saving Specified Message into Logger File. if alert Saving is Enabled.
#### Descriptions
- Preparing a File Name by Combining setted Prefix + ".XLogs".
- Generating File Path based on XCDataCollector instance Path.
- Validate Generated filePath.
- Preparing Log Message for Saving in Log File by attaching Current Time.
- Append prepared Message to Log File using XCDataCollector instance.
### string PrepareMessage(string message)
private
Replace Escaped strings and Attach Prefix to Message.
## Maintainer
Hadi Khazaee asl
[https://www.saherelm.ir](https://www.saherelm.ir)
[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com)
+80
View File
@@ -0,0 +1,80 @@
# XCDataCollector
it is a module which used for Save and Retrieve Data in SaherElm's XTrade Framework.
this tool helps all required modules to save data for next usage and analytics.
we can implement Save To File and Read From File actions to all Structures and Classes and Modules.
## Dependencies
there is no Dependencies on this modules.
## Instancing
there is not any args in Constructor.
## Instructions
- using Path Action of instance for Setting File Path;
- using Save, Append, Read for File Manipulations;
## Actions
### Path
is a Property Setter and Getter Action for Setting Collector Path.
for setter it's have an input Parameters (string value) which Specified the File's Path.
### GetFilePath(string fileName)
retrieve Full path (including provided file name) based on Current Configured Path for instance.
### GetFileHandlerForWrite(string filePath)
retrieve File Handler by Write Access for Writing Data to File.
you have to provide Fully File Path for access Handler.
this for Use Implementing Custom Collecting Senarios out of Instance Box.
commonly it's used by built in Actions for Regular Saving Data.
### GetFileHandlerForRead(string filePath)
retrieve File Handler by Read Access for Reading Data from File.
you have to provide Fully File Path for access Handler.
this for Use Implementing Custom Retrieving Senarios out of Instance Box.
commonly it's used by built in Actions for Regular Reading Data.
### Save(string fileName, string content)
Save Specified Content to Specified File Nmae.
here the file name must Contains fully file path including file name.
it's only one time writing file. if it's file exists before overwrite it's content.
### Append(string fileName, string content)
Append Specified Contonet to end of Specified File.
here the file name must Contains fully file path including file name.
if file Exists, add to end of it. if not, Create file at Specified Provided path, then write content.
### Read(string fileName, string &content)
Read all of File Content at once from Specified File.
here the file name must Contains fully file path including file name.
content arg is a reference string variable to hold file content.
### Read(string fileName, string &content[])
Read all of File Content Lines at once from Specified File.
here the file name must Contains fully file path including file name.
content arg is a reference string array variable to hold file content lines.
### IsExists(string fileName)
Check Specified File Exists or not ...
here the file name must Contains fully file path including file name.
## Maintainer
Hadi Khazaee asl
[https://www.saherelm.ir](https://www.saherelm.ir)
[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com)
View File
+11
View File
@@ -0,0 +1,11 @@
# XCTrade
it is a module which used for Providing Trade Related Actions in SaherElm's XTrade Framework.
## Maintainer
Hadi Khazaee asl
[https://www.saherelm.ir](https://www.saherelm.ir)
[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com)
+25
View File
@@ -0,0 +1,25 @@
# XCVolume
it is a module which used for Accoess Trading Account Data in SaherElm's XTrade Framework.
## Dependencies
there is no Dependencies on this modules.
## Instancing
there is not any args in Constructor.
## Instructions
use provided Actions for Access Account informations in where you need.
## Actions
## Maintainer
Hadi Khazaee asl
[https://www.saherelm.ir](https://www.saherelm.ir)
[hadi_khazaee_asl@yahoo.com](mailto:hadi_khazaee_asl@yahoo.com)