last works on Position Protector ...

This commit is contained in:
2024-09-17 16:49:45 +03:30
parent f6c4b46da3
commit a1c0a364af
4 changed files with 619 additions and 22 deletions
+52 -10
View File
@@ -21,9 +21,9 @@
//
// Imports ...
#include <Trade/Trade.mqh>
#include "../Libraries/x-saherelm.draw.lib.mq5"
#include "../Libraries/x-saherelm.common.lib.mq5"
#include "../Libraries/x-saherelm.draw.lib.mq5"
#include <Trade/Trade.mqh>
//
// Definitions ...
@@ -130,14 +130,15 @@ enum ENUM_X_POSITION_SELECT_METHODS
enum ENUM_X_SIGNAL_EXECUTION_RESULT
{
//
X_SIGNAL_EXECUTION_UNKNOWN, // Unknown
X_SIGNAL_EXECUTION_SUCCEED, // Succed
X_SIGNAL_EXECUTION_FAILED_SPREAD, // Spread more than Max Allowed
X_SIGNAL_EXECUTION_FAILED_NOT_ALLOWED, // Not Allowed Trade Type
X_SIGNAL_EXECUTION_FAILED_NO_EQUITY, // No Equity for Trade
X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR, // Price Error
X_SIGNAL_EXECUTION_FAILED_MAX_REACHED, // Max Allowed Positions Reached
X_SIGNAL_EXECUTION_FAILED_INVALID_PARAMS, // Invalid Params
X_SIGNAL_EXECUTION_UNKNOWN, // Unknown
X_SIGNAL_EXECUTION_SUCCEED, // Succed
X_SIGNAL_EXECUTION_FAILED_SPREAD, // Spread more than Max Allowed
X_SIGNAL_EXECUTION_FAILED_NOT_ALLOWED, // Not Allowed Trade Type
X_SIGNAL_EXECUTION_FAILED_NO_EQUITY, // No Equity for Trade
X_SIGNAL_EXECUTION_FAILED_PRICE_ERROR, // Price Error
X_SIGNAL_EXECUTION_FAILED_MAX_REACHED, // Max Allowed Positions Reached
X_SIGNAL_EXECUTION_FAILED_DELAY_NOT_PASSED, // Same Positions Delay Not Passed
X_SIGNAL_EXECUTION_FAILED_INVALID_PARAMS, // Invalid Params
};
//
@@ -546,6 +547,47 @@ struct XPosition
return result;
}
//
double GetPointsValue()
{
//
double result = 0;
//
if (!IsValid())
{
return result;
}
//
result = GetPoints(symbol);
//
return result;
}
//
double GetProfitInPoint()
{
//
double result = 0;
//
if (!IsValid())
{
return result;
}
//
double point = GetPoints(symbol);
//
result = profit / point;
//
return result;
}
//
// Find Reward ...
double GetReward()