last works on xom1 ea ...

This commit is contained in:
2025-09-07 18:48:24 +03:30
parent 19497ba6ef
commit 5987194e51
7 changed files with 4771 additions and 749 deletions
+121
View File
@@ -35,6 +35,67 @@ input long eaMagicNumber = 1694056; // Magic Number
input int eaSlippage = 10; // Slippgae
input string eaLogSuffix = ""; // Log Suffix
//
// Management ...
// eaSessions => (ST_04:00_08:30),(TL_10:30_12:00),(NY_16:00_20:00)
input group "Management";
input bool eaAllowGuards = false; // Allow Guards
input bool eaAllowTrade = true; // Allow Trade on Signals
input bool eaAllowLongs = true; // Allow Long Trades
input bool eaAllowShorts = true; // Allow Short Trades
input string eaSessions = ""; // Active Sessions
input ENUM_XTRADE_RESTRICTION_PERIOD eaRestrictionsPeriod = XTRADE_RESTRICATION_NONE; // Restrictions Period
input int eaMaxAllowedTPs = 0; // Max Allowed TP(s) in Restrictions Period
input int eaMaxAllowedSLs = 0; // Max Allowed SL(s) in Restrictions Period
input int eaMaxAllowedTrades = 0; // Max Allowed Trades in Restrictions Period
input int eaMaxAllowedPositions = 5; // Max Allowed Same Time Trades
input double eaMaxAllowedSpread = 25; // Max Allowed Spread For Trade
input double eaMaxAllowedDrawdownFactor = 0.3; // Max Allowed DrawDown for Trade
input string eaCloseAllOpenTradesAt = ""; // Close All Open Trades per Day At Specified Time
//
// Volume ...
input group "Volume";
input ENUM_X_VOLUME_SELECT_TYPE eaVolumeSelect = X_VOLUME_CONSTANT; // Volume Applying Type
input double eaStaticVoluem = 0.0; // Static Volume
input double eaDynamicVolumeStepBalance = 0.0; // Step of Balance for Increase Volume
input double eaDynamicVolumeStepVolume = X_MIN_VOLUME; // Step of Volume Increasing
input double eaConstantRiskBalance = 0.0; // Constant Risk Balance per Trade
input double eaConstantPercent = 1; // Constant Percent of Balance Per Trade
input double eaConstantBalance = 1000.0; // Constant Balance for Calculations
//
// Alert ...
input group "Alert";
input bool eaEnableAlerts = true; // Enable Alerts
input bool eaSaveAlerts = true; // Save Alerts
input bool eaLogAlerts = true; // Log Alerts
input bool eaMailAlerts = false; // Mail Alerts
input bool eaPushAlerts = true; // Push Alerts
input bool eaTerminalAlerts = false; // Terminal Alerts
//
// Reports ...
input group "Reports";
input bool eaReportNewMonths = false; // Report New Month
input bool eaReportNewWeeks = false; // Report New Weeks
input bool eaReportNewDays = true; // Report New Days
input bool eaReportNewHours = false; // Report New Hours
input bool eaReportTrades = true; // Report Trades
input bool eaReportSignals = true; // Report Signals
input bool eaReportRestrictions = true; // Report Restrictions
input bool eaReportProtector = true; // Report Protector Actions
input bool eaReportAfterTradesBalance = true; // Report Balance after a Trade Finished
//
// Collector ...
input group "Collector";
input bool eaSaveTrades = true; // Save Trades
input bool eaSaveSignals = true; // Save Signals
input bool eaSaveWins = true; // Save Winning Conditions
input bool eaSaveLosts = true; // Save Lost Conditions
input bool eaSaveRestrictions = true; // Save Restriction Reports
//
// Variables ...
@@ -78,14 +139,74 @@ int OnInit()
//
// Setting All Inputs to Expert Adviser Class ...
//
// Management ...
eaExpert.eaAllowGuards = eaAllowGuards;
eaExpert.eaAllowTrade = eaAllowTrade;
eaExpert.eaAllowLongs = eaAllowLongs;
eaExpert.eaAllowShorts = eaAllowShorts;
eaExpert.eaSessions = eaSessions;
eaExpert.eaRestrictionsPeriod = eaRestrictionsPeriod;
eaExpert.eaMaxAllowedTPs = eaMaxAllowedTPs;
eaExpert.eaMaxAllowedSLs = eaMaxAllowedSLs;
eaExpert.eaMaxAllowedTrades = eaMaxAllowedTrades;
eaExpert.eaMaxAllowedPositions = eaMaxAllowedPositions;
eaExpert.eaMaxAllowedSpread = eaMaxAllowedSpread;
eaExpert.eaMaxAllowedDrawdownFactor = eaMaxAllowedDrawdownFactor;
eaExpert.eaCloseAllOpenTradesAt = eaCloseAllOpenTradesAt;
//
// Volume ...
eaExpert.eaVolumeSelect = eaVolumeSelect;
eaExpert.eaStaticVoluem = eaStaticVoluem;
eaExpert.eaDynamicVolumeStepBalance = eaDynamicVolumeStepBalance;
eaExpert.eaDynamicVolumeStepVolume = eaDynamicVolumeStepVolume;
eaExpert.eaConstantRiskBalance = eaConstantRiskBalance;
eaExpert.eaConstantPercent = eaConstantPercent;
eaExpert.eaConstantBalance = eaConstantBalance;
//
// Alert ...
eaExpert.eaEnableAlerts = eaEnableAlerts;
eaExpert.eaSaveAlerts = eaSaveAlerts;
eaExpert.eaLogAlerts = eaLogAlerts;
eaExpert.eaMailAlerts = eaMailAlerts;
eaExpert.eaPushAlerts = eaPushAlerts;
eaExpert.eaTerminalAlerts = eaTerminalAlerts;
//
// Reports ...
eaExpert.eaReportNewMonths = eaReportNewMonths;
eaExpert.eaReportNewWeeks = eaReportNewWeeks;
eaExpert.eaReportNewDays = eaReportNewDays;
eaExpert.eaReportNewHours = eaReportNewHours;
eaExpert.eaReportTrades = eaReportTrades;
eaExpert.eaReportSignals = eaReportSignals;
eaExpert.eaReportRestrictions = eaReportRestrictions;
eaExpert.eaReportProtector = eaReportProtector;
eaExpert.eaReportAfterTradesBalance = eaReportAfterTradesBalance;
//
// Collector ...
eaExpert.eaSaveTrades = eaSaveTrades;
eaExpert.eaSaveSignals = eaSaveSignals;
eaExpert.eaSaveWins = eaSaveWins;
eaExpert.eaSaveLosts = eaSaveLosts;
eaExpert.eaSaveRestrictions = eaSaveRestrictions;
//
// Try to Initialize eaExpert ...
bool isInited = eaExpert.HandleOnInit();
if (!isInited)
{
//
Print(ShortName, ": Initialization Failed ...");
return INIT_FAILED;
}
//
Print(ShortName, ": Initialized Successfully ...");
return INIT_SUCCEEDED;
}