refactor xTest EA to XGPUS5 for start Implementation ...

This commit is contained in:
2024-03-25 03:40:02 +03:30
parent 5e71ec1b9d
commit 81a38420b2
16 changed files with 40313 additions and 6150 deletions
File diff suppressed because it is too large Load Diff
@@ -36,21 +36,21 @@ input bool xGPUS5EnableProvider = true; // Enable Provider
input int xGPUS5NumberOfItemsPerTick = 30; // Number Of items Readed In Each Tick
//
// Alerts ...
input bool xGPUS5EnableAlerts = true; // Enable Events Alert
input bool xGPUS5EnableHourlyAlerts = false; // Send Alert on each new Hour
input bool xGPUS5EnableDailyAlerts = false; // Send Alert on each new Day
input bool xGPUS5EnableWeeklyAlerts = false; // Send Alert on each new Week
input bool xGPUS5EnableMonthlyAlerts = true; // Send Alert on each new Month
input bool xGPUS5EnableAlerts = true; // Enable Events Alert
input bool xGPUS5EnableHourlyAlerts = false; // Send Alert on each new Hour
input bool xGPUS5EnableDailyAlerts = false; // Send Alert on each new Day
input bool xGPUS5EnableWeeklyAlerts = false; // Send Alert on each new Week
input bool xGPUS5EnableMonthlyAlerts = false; // Send Alert on each new Month
//
// Reports ...
input bool xGPUS5EnableDailyReports = false; // Send Report on each new Day
input bool xGPUS5EnableWeeklyReports = false; // Send Report on each new Week
input bool xGPUS5EnableMonthlyReports = true; // Send Report on each new Month
input bool xGPUS5EnableDailyReports = false; // Send Report on each new Day
input bool xGPUS5EnableWeeklyReports = false; // Send Report on each new Week
input bool xGPUS5EnableMonthlyReports = false; // Send Report on each new Month
//
// Trader and Expert Specific Configurations ...
input group "XGPUS5 Trader";
input int xGPUS5MagicNumber = 16940561; // Trader MagicNumber
input int xGPUS5MagicNumber = 16940563; // Trader MagicNumber
input int xGPUS5Slippage = 10; // Trader Slippage
//
@@ -63,18 +63,16 @@ input bool xGPUS5AllowShortTrades = true; // Allow Short Trades
// Risk Management Configurations ...
input group "XGPUS5 Risk Management";
//
input bool xGPUS5UseVirtualTPSl = false; // Use Virtual TP SL
//
// Trade Count ...
input int xGPUS5MaxAllowedTrades = 10; // Max Allowed Trades at Same Time
input ENUM_X_CROSS_SIGNAL_METHOD xGPUS5CrossSignalsMethod = X_CROSS_SIGNAL_REGULAR; // Handle Cross Signals Method
//
// Max Allowed Trade Age ...
input int xGPUS5MaxAllowedTradeAge = 2000; // Detect Long Time Trades
input int xGPUS5MaxAllowedTradeAge = 300; // Detect Long Time Trades
input ENUM_X_GUARD_ACTIONS xGPUS5OldTradesAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // What to do with Old Trades
//
// Trade Volume Specific Configurations ...
input double xGPUS5StaticVolumeFactor = 0.0002; // Static Volume baesd on Balance
input double xGPUS5StaticVolumeFactor = 0.0004; // Static Volume baesd on Balance
input ENUM_STATIC_VOLUME_METHODS xGPUS5StaticVolumeMethod = X_STATIC_VOLUME_BASED_ON_BALANCE; // How to Calculate Static Volume
input double xGPUS5VolumeMultiplier = 0; // Volume Increase Multiplier
input double xGPUS5ApplyVolumeMultiplierFactor = 0; // Apply Volume Multiplier Rate based on Balance
@@ -82,22 +80,27 @@ input double xGPUS5MaxSupportedVolumePerTradeFactor = 0;
input double xGPUS5IncreasedMaxSupportedVolumeRate = 0; // Increase Max Supported Volume based on Balance
//
// Trade Profits ...
input double xGPUS5MinRewardInPips = 150; // Minimum Reward Per Trade in Pips
input double xGPUS5RiskFreeStepInPips = 60; // Make Trades Risk Free Steps in Pips
input double xGPUS5RiskFreeRate = 0.6; // Volume Multiplier for Risk Free Trades
input double xGPUS5MinRewardInPips = 60; // Minimum Reward Per Trade in Pips
input double xGPUS5RiskFreeStepInPips = 0; // Make Trades Risk Free Steps in Pips
input double xGPUS5RiskFreeRate = 0; // Volume Multiplier for Risk Free Trades
//
// Guard Riskable Money and Profits ...
input double xGPUS5CriticalDrawDownFactor = 0.43; // Critical Allowed Drawdown Factor based on Balance
input ENUM_X_GUARD_ACTIONS xGPUS5CriticalGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_5; // Specify Guard Action on Critical Drawdown
input double xGPUS5MaxAllowedDrawDownFactor = 0.45; // Max Allowed Drawdown Factor based on Balance
input ENUM_X_GUARD_ACTIONS xGPUS5MaxAllowedGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_10; // Specify Guard Action on Max Allowed Drawdown
input int xGPUS5GuardStopoutFiredAfterTouches = 5; // Guard Stopout all Trades if Max Allowed Drawdown touched
input double xGPUS5CriticalDrawDownFactor = 0.10; // Critical Allowed Drawdown Factor based on Balance
input ENUM_X_GUARD_ACTIONS xGPUS5CriticalGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // Specify Guard Action on Critical Drawdown
input double xGPUS5MaxAllowedDrawDownFactor = 0.15; // Max Allowed Drawdown Factor based on Balance
input ENUM_X_GUARD_ACTIONS xGPUS5MaxAllowedGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_5; // Specify Guard Action on Max Allowed Drawdown
input int xGPUS5GuardStopoutFiredAfterTouches = 5; // Guard Stopout all Trades if Max Allowed Drawdown touched
//
// Account Conditions for Trading ...
input double xGPUS5BalanceFactorForOpenTrades = 0.5; // Minimum Balance for Open Trades
input double xGPUS5FreeMarginFactorForOpenTrades = 0.8; // Minimum Free Margin for Open Trades
//
// May be Used Later as Input Params ...
bool xGPUS5UseVirtualTPSl = false; // Use Virtual TP SL
bool xGPUS5EnableSignalAlerts = false; // Send Signal Alert
//
// Validate Inputs before Initialization ...
bool XGPUS5ValidateInputs()
@@ -209,7 +212,7 @@ bool XGPUS5ValidateInputs()
//
result =
xGPUS5CriticalDrawDownFactor == 0 || (xGPUS5CriticalDrawDownFactor > 0 &&
xGPUS5CriticalDrawDownFactor < 1);
xGPUS5CriticalDrawDownFactor < 1);
if (!result)
{
//
@@ -222,7 +225,7 @@ bool XGPUS5ValidateInputs()
//
result =
xGPUS5MaxAllowedDrawDownFactor == 0 || (xGPUS5MaxAllowedDrawDownFactor > 0 &&
xGPUS5MaxAllowedDrawDownFactor < 1);
xGPUS5MaxAllowedDrawDownFactor < 1);
if (!result)
{
//
@@ -513,6 +513,9 @@ void XGPUS5HandleOpenTrades()
// Update Reports ...
XGPUS5UpdateReports();
//
xGPUS5WaitUntilNextCandle = true;
//
// Open Long Trades ...
if (