Prepare X121 Workspace Requirements for Start ...

This commit is contained in:
2024-10-07 03:58:19 +03:30
parent aa1da78648
commit f0d7b6134a
36 changed files with 367 additions and 1300 deletions
+43 -269
View File
@@ -28,14 +28,6 @@
#include "../Helpers/x-saherelm.xcc.helper.mq5"
#include "../Helpers/x-saherelm.xct.helper.mq5"
//
#include "../Parsers/x-saherelm.xch.parser.mq5"
#include "../Strategies/x-saherelm.xch.strategy.mq5"
//
#include "../Parsers/x-saherelm.xch.che.parser.mq5"
#include "../Strategies/x-saherelm.xch.che.strategy.mq5"
//
#include "../Parsers/x-saherelm.x121.parser.mq5"
#include "../Strategies/x-saherelm.x121.strategy.mq5"
@@ -56,9 +48,9 @@ input string eaLogSuffix = ""; // Log Suffix
//
// Symbols ...
input group "Symbols";
input bool eaMultiSymbol = false; // Use Multi Symbol
input bool eaUseMaxAllowedTradesPerSymbol = true; // Use Max Allowed Trades Per Symbol
input string eaSymbols = "EURUSDb,GBPUSDb,EURGBPb,USDJPYb,EURJPYb,USDCHFb,EURCHFb,AUDUSDb,EURAUDb,NZDUSDb,EURNZDb,USDCADb,EURCADb,XAUUSDb,XAGUSDb,BRENT,DowJones30"; // Trading Symbols
input bool eaMultiSymbol = false; // Use Multi Symbol
input bool eaUseMaxAllowedTradesPerSymbol = true; // Use Max Allowed Trades Per Symbol
input string eaSymbols = "EURUSDb,GBPUSDb,EURGBPb,USDJPYb,EURJPYb,USDCHFb,EURCHFb,AUDUSDb,EURAUDb,NZDUSDb,EURNZDb,USDCADb,EURCADb"; // Trading Symbols
//
// Risk Management ...
@@ -78,7 +70,7 @@ input group "Volume";
input bool eaUseDynamicVolume = false; // Use Dynamic Volume
input double eaDynamicVolumeStep = 0.01; // Increase Volume Step
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
input double eaVolume = 0.05; // Static Volume
input double eaVolume = 0.01; // Static Volume
//
// Risk Management > Trade Management ...
@@ -92,9 +84,9 @@ input double eaMaxDrawdownPercentForOpenTrades = 3; // Max Drawdown Percent for
//
// Protector ...
input group "Protector";
input bool eaUseForceMomentumsInProtection = false; // Use Force Momentums In Protection;
input int eaDelayBarBetweenTwoSignal = 5; // Delay Bars Between Two Signal
input double mAcceptNextSameTypeSignalWhenLastInProfit = 50; // Accept Next Same Type Signal When Last in Profit in Point
input bool eaUseForceMomentumsInProtection = true; // Use Force Momentums In Protection;
input int eaDelayBarBetweenTwoSignal = 5; // Delay Bars Between Two Signal
input double eaAcceptNextSameTypeSignalWhenLastInProfit = 50; // Accept Next Same Type Signal When Last in Profit in Point
//
// Protector > Hedging Properties ...
@@ -131,8 +123,8 @@ input group "In Drawdown Positions Protecting";
//
// Protect ...
input group "Protect";
input bool eaAllowProtect = true; // Allow Proptecting
input int eaProtectionDelay = 300; // Delay Between two Protection in Secconds
input bool eaAllowProtect = false; // Allow Proptecting
input int eaProtectionDelay = 3000; // Delay Between two Protection in Secconds
input int eaMaxAllowedProtection = 1; // Max Allowed Protection
input bool eaUseEntryAsProtectionSL = true; // Use Position Entry For SL of Protect
input bool eaProtectOnConditions = true; // Do Protection only when Conditions happens
@@ -198,9 +190,7 @@ X121SCTradeHandler *eaTradeHandler;
// Strategy and it's not related to Public
// TradeHandler for Seperation of Concern issue,
// we do this here ...
XCHStartegyConditionsParser chParser;
XCHCHEStartegyConditionsParser chcheParser;
X121StartegyConditionsParser chichwapParser;
X121StartegyConditionsParser x121Parser;
//
string mTag = "";
@@ -587,8 +577,9 @@ bool InitEA()
// Configure Position Protector ...
//
eaTradeHandler.UseForceMomentumsInProtection(eaUseForceMomentumsInProtection);
eaTradeHandler.DelayBarBetweenTwoSignal(eaDelayBarBetweenTwoSignal);
eaTradeHandler.UseForceMomentumsInProtection(eaUseForceMomentumsInProtection);
eaTradeHandler.AcceptNextSameTypeSignalWhenLastInProfit(eaAcceptNextSameTypeSignalWhenLastInProfit);
//
// Configure Hedging ...
@@ -642,7 +633,7 @@ bool InitEA()
{
//
// Register XICHWAP Strategy ...
// Register Strategy ...
//
bool isEURUSD = _symbolParser.IsEURUSD(_Symbol);
@@ -676,8 +667,8 @@ bool InitEA()
{
//
// Create Class Instance ...
XSCXCHICHWAPStrategy *xchichwapStrategy;
xchichwapStrategy = new XSCXCHICHWAPStrategy(
XSCX121Strategy *x121Strategy;
x121Strategy = new XSCX121Strategy(
_Symbol,
_Period,
PERIOD_H1, // Analyzing Period
@@ -700,116 +691,22 @@ bool InitEA()
//
// Configuere Strategy ...
xchichwapStrategy.DrawImportantAreas(false);
xchichwapStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
x121Strategy.DrawImportantAreas(false);
x121Strategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
xchichwapStrategy.SetAlertPrefix(mTag);
xchichwapStrategy.SetAlertEnableAlerts(eAEnableAlerts);
xchichwapStrategy.SetAlertLogAlerts(eALogAlerts);
xchichwapStrategy.SetAlertMailAlerts(eAMailAlerts);
xchichwapStrategy.SetAlertPushAlerts(eAPushAlerts);
xchichwapStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
x121Strategy.SetAlertPrefix(mTag);
x121Strategy.SetAlertEnableAlerts(eAEnableAlerts);
x121Strategy.SetAlertLogAlerts(eALogAlerts);
x121Strategy.SetAlertMailAlerts(eAMailAlerts);
x121Strategy.SetAlertPushAlerts(eAPushAlerts);
x121Strategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(xchichwapStrategy);
RegisterStrategy(x121Strategy);
}
//
// Register XCH Strategy ...
//
// Create Class Instance ...
XSCXCHStrategy *xchStrategy;
xchStrategy = new XSCXCHStrategy(
_Symbol,
_Period,
PERIOD_H1, // Analyzing Period
eaVolume,
eaR2R, // R2R ...
eaSlippage,
eaMagicNumber,
true, // Ignore Signal Execution
eaUseFixedTPSLPoints, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaIgnoreTP,
eaIgnoreSL,
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts // Max Shorts
);
//
// Configuere Strategy ...
xchStrategy.EnableXCHM(true);
xchStrategy.EnableXCHHK(true);
xchStrategy.EnableXCHSTR(true);
xchStrategy.EnableXCHCHE(true);
xchStrategy.DrawImportantAreas(false);
xchStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
xchStrategy.SetAlertPrefix(mTag);
xchStrategy.SetAlertEnableAlerts(eAEnableAlerts);
xchStrategy.SetAlertLogAlerts(eALogAlerts);
xchStrategy.SetAlertMailAlerts(eAMailAlerts);
xchStrategy.SetAlertPushAlerts(eAPushAlerts);
xchStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(xchStrategy);
//
// Register XCHCHE Strategy ...
//
// Create Class Instance ...
XSCXCHCHEStrategy *xchcheStrategy;
xchcheStrategy = new XSCXCHCHEStrategy(
_Symbol,
_Period,
PERIOD_H1, // Analyzing Period
eaVolume,
eaR2R, // R2R ...
eaSlippage,
eaMagicNumber,
true, // Ignore Signal Execution
eaUseFixedTPSLPoints, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaIgnoreTP,
eaIgnoreSL,
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts // Max Shorts
);
//
// Configuere Strategy ...
xchcheStrategy.DrawImportantAreas(false);
xchcheStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
xchcheStrategy.SetAlertPrefix(mTag);
xchcheStrategy.SetAlertEnableAlerts(eAEnableAlerts);
xchcheStrategy.SetAlertLogAlerts(eALogAlerts);
xchcheStrategy.SetAlertMailAlerts(eAMailAlerts);
xchcheStrategy.SetAlertPushAlerts(eAPushAlerts);
xchcheStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(xchcheStrategy);
}
//
// Multi Symbol ...
@@ -870,8 +767,8 @@ bool InitEA()
{
//
// Create Class Instance ...
XSCXCHICHWAPStrategy *iXCHICHWAPStrategy;
iXCHICHWAPStrategy = new XSCXCHICHWAPStrategy(
XSCX121Strategy *iX121Strategy;
iX121Strategy = new XSCX121Strategy(
iSymbol,
_Period,
PERIOD_H1, // Analyzing Period
@@ -894,116 +791,22 @@ bool InitEA()
//
// Configuere Strategy ...
iXCHICHWAPStrategy.DrawImportantAreas(false);
iXCHICHWAPStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
iX121Strategy.DrawImportantAreas(false);
iX121Strategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
iXCHICHWAPStrategy.SetAlertPrefix(mTag);
iXCHICHWAPStrategy.SetAlertEnableAlerts(eAEnableAlerts);
iXCHICHWAPStrategy.SetAlertLogAlerts(eALogAlerts);
iXCHICHWAPStrategy.SetAlertMailAlerts(eAMailAlerts);
iXCHICHWAPStrategy.SetAlertPushAlerts(eAPushAlerts);
iXCHICHWAPStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
iX121Strategy.SetAlertPrefix(mTag);
iX121Strategy.SetAlertEnableAlerts(eAEnableAlerts);
iX121Strategy.SetAlertLogAlerts(eALogAlerts);
iX121Strategy.SetAlertMailAlerts(eAMailAlerts);
iX121Strategy.SetAlertPushAlerts(eAPushAlerts);
iX121Strategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(iXCHICHWAPStrategy);
RegisterStrategy(iX121Strategy);
}
//
// Register XCH Strategy ...
//
// Create Class Instance ...
XSCXCHStrategy *iXCHStrategy;
iXCHStrategy = new XSCXCHStrategy(
iSymbol,
_Period,
PERIOD_H1, // Analyzing Period
eaVolume,
eaR2R, // R2R ...
eaSlippage,
eaMagicNumber,
true, // Ignore Signal Execution
eaUseFixedTPSLPoints, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaIgnoreTP,
eaIgnoreSL,
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts // Max Shorts
);
//
// Configuere Strategy ...
iXCHStrategy.EnableXCHM(true);
iXCHStrategy.EnableXCHHK(true);
iXCHStrategy.EnableXCHSTR(true);
iXCHStrategy.EnableXCHCHE(true);
iXCHStrategy.DrawImportantAreas(false);
iXCHStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
iXCHStrategy.SetAlertPrefix(mTag);
iXCHStrategy.SetAlertEnableAlerts(eAEnableAlerts);
iXCHStrategy.SetAlertLogAlerts(eALogAlerts);
iXCHStrategy.SetAlertMailAlerts(eAMailAlerts);
iXCHStrategy.SetAlertPushAlerts(eAPushAlerts);
iXCHStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(iXCHStrategy);
//
// Register XCHCHE Strategy ...
//
// Create Class Instance ...
XSCXCHCHEStrategy *iXCHCHEStrategy;
iXCHCHEStrategy = new XSCXCHCHEStrategy(
iSymbol,
_Period,
PERIOD_H1, // Analyzing Period
eaVolume,
eaR2R, // R2R ...
eaSlippage,
eaMagicNumber,
true, // Ignore Signal Execution
eaUseFixedTPSLPoints, // Use TP SL Point
false, // Use Max
eaTPPoint, // TP
eaSLPoint, // SL
eaIgnoreTP,
eaIgnoreSL,
eaAllowLong,
eaAllowShort,
eaMaxAllowedLongs, // Max Longs
eaMaxAllowedShorts // Max Shorts
);
//
// Configuere Strategy ...
iXCHCHEStrategy.DrawImportantAreas(false);
iXCHCHEStrategy.AddXCHSignalEventHandler(OnSignalRecieved);
//
// Configure Alerts ...
iXCHCHEStrategy.SetAlertPrefix(mTag);
iXCHCHEStrategy.SetAlertEnableAlerts(eAEnableAlerts);
iXCHCHEStrategy.SetAlertLogAlerts(eALogAlerts);
iXCHCHEStrategy.SetAlertMailAlerts(eAMailAlerts);
iXCHCHEStrategy.SetAlertPushAlerts(eAPushAlerts);
iXCHCHEStrategy.SetAlertTerminalAlerts(eATerminalAlerts);
//
// Register Strategy ...
RegisterStrategy(iXCHCHEStrategy);
}
}
@@ -1336,26 +1139,10 @@ void OnSignalRecieved(
}
//
bool isXCHSignal = signal.provider == XCHStartegyToken;
bool isXCHCHESignal = signal.provider == XCHCHEStartegyToken;
bool isXCHICHWAPSignal = signal.provider == XCHICHWAPStartegyToken;
bool isFiltered =
isXCHSignal
? chParser.IsFiltered(
signal,
conditions //
)
: isXCHCHESignal
? chcheParser.IsFiltered(
signal,
conditions //
)
: isXCHICHWAPSignal
? chichwapParser.IsFiltered(
signal,
conditions //
)
: true;
bool isFiltered = x121Parser.IsFiltered(
signal,
conditions //
);
if (isFiltered)
{
//
@@ -1373,23 +1160,10 @@ void OnSignalRecieved(
);
//
signal.conditions =
isXCHSignal
? chParser.GenerateSignalConditions(
signal,
conditions //
)
: isXCHCHESignal
? chcheParser.GenerateSignalConditions(
signal,
conditions //
)
: isXCHICHWAPSignal
? chichwapParser.GenerateSignalConditions(
signal,
conditions //
)
: conditionsSummary;
signal.conditions = x121Parser.GenerateSignalConditions(
signal,
conditions //
);
//
// Check Signal Delay ...