Resolve XUSPY5 XTD All Longs Stopouts in AMarkets-Real, GrowthNext ...
This commit is contained in:
@@ -254,14 +254,14 @@ struct XMarketConditions
|
||||
//
|
||||
|
||||
//
|
||||
class XCPriver : public XCBase
|
||||
class XCProvider : public XCBase
|
||||
{
|
||||
//
|
||||
// Public ...
|
||||
public:
|
||||
//
|
||||
// Constructor ...
|
||||
XCPriver(
|
||||
XCProvider(
|
||||
//
|
||||
// Common Requirements ...
|
||||
string xSymbol, // Which Symbol is Used
|
||||
@@ -362,7 +362,7 @@ public:
|
||||
|
||||
//
|
||||
// Deconstructor ...
|
||||
~XCPriver() {}
|
||||
~XCProvider() {}
|
||||
|
||||
//
|
||||
// START Common Functions ...
|
||||
|
||||
@@ -0,0 +1,399 @@
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 Expert Advisor
|
||||
// ----------------------------------------
|
||||
// Name: XUSPY5
|
||||
// Description: this is an expert controller
|
||||
// advisors which provides a mechanism for use them ...
|
||||
//
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm XUSPY5 EA"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// START Inputs ...
|
||||
//
|
||||
|
||||
input group "Commons";
|
||||
|
||||
//
|
||||
// XCTIMER inputs ...
|
||||
input bool xUSPY5ShowCandleTimer = true; // Show Condle Remaining Time
|
||||
input color xUSPY5CandleTimerColot = clrYellow; // Candle Timer Color
|
||||
input ENUM_BASE_CORNER xUSPY5CandleTimerCorner = CORNER_RIGHT_LOWER; // Where to Show Candle Timer
|
||||
|
||||
//
|
||||
// END Inputs ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Including Providers ...
|
||||
//
|
||||
|
||||
//
|
||||
// Logger Library ...
|
||||
#include "../Libraries/x-saherelm.log.lib.mq5"
|
||||
|
||||
//
|
||||
// Common Library ...
|
||||
#include "../Libraries/x-saherelm.common.lib.mq5"
|
||||
|
||||
//
|
||||
// Alert Library ...
|
||||
#include "../Libraries/x-saherelm.alert.lib.mq5"
|
||||
|
||||
//
|
||||
// Draw Library ...
|
||||
#include "../Libraries/x-saherelm.draw.lib.mq5"
|
||||
|
||||
//
|
||||
// XUSPY5 Signal Provider ...
|
||||
#include "../Providers/x-saherelm.xuspy5.provider.lib.mq5"
|
||||
|
||||
//
|
||||
// END Including Providers ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Global Definitions: Variables, Properties and etc ...
|
||||
//
|
||||
bool isXUSPY5NewHour;
|
||||
bool isXUSPY5NewDay;
|
||||
bool isXUSPY5NewWeek;
|
||||
bool isXUSPY5NewMonth;
|
||||
|
||||
//
|
||||
int xUSPY5CTimerHandler = INVALID_HANDLE;
|
||||
//
|
||||
// END Global Definitions: Variables, Properties and etc ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Event Handlers ...
|
||||
//
|
||||
|
||||
//
|
||||
// Initialization ...
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
logTag = "XUSPY5EA";
|
||||
drawPrefix = logTag;
|
||||
alertPrefix = logTag;
|
||||
|
||||
//
|
||||
// Apply default Chart Style for EA ...
|
||||
ApplyChartStyle();
|
||||
|
||||
//
|
||||
// Reset Timings ...
|
||||
ResetTiming();
|
||||
|
||||
//
|
||||
// Validate Inputs ...
|
||||
if (!ValidateInputs())
|
||||
{
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize XUSPY5 Provider ...
|
||||
if (!XUSPY5InitSignalProviderLibrary())
|
||||
{
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
//
|
||||
// Init XCTimer ...
|
||||
if (xUSPY5ShowCandleTimer)
|
||||
{
|
||||
if (!XUSPY5CTimerInit())
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Init Succeed ...
|
||||
return INIT_SUCCEEDED;
|
||||
}
|
||||
|
||||
//
|
||||
// DeInitialization ...
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//
|
||||
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
||||
// REASON_REMOVE 1 Program removed from a chart
|
||||
// REASON_RECOMPILE 2 Program recompiled
|
||||
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
||||
// REASON_CHARTCLOSE 4 Chart closed
|
||||
// REASON_PARAMETERS 5 Inputs changed by a user
|
||||
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
||||
// REASON_TEMPLATE 7 Another chart template applied
|
||||
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
||||
// REASON_CLOSE 9 Terminal closed
|
||||
|
||||
//
|
||||
// Here we can handle De Initialization Reasons ...
|
||||
|
||||
//
|
||||
// De Initialize XUSPY5 Provider ...
|
||||
XUSPY5DeinitSignalProviderLibrary(reason);
|
||||
|
||||
//
|
||||
// De Init XDraw Library ...
|
||||
// OnDeinitDrawLibrary();
|
||||
|
||||
//
|
||||
IndicatorRelease(xUSPY5CTimerHandler);
|
||||
}
|
||||
|
||||
//
|
||||
// On Tick Handler ...
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
// Handle Monthly Alert ...
|
||||
bool isFirstMonth = xMonth == -1;
|
||||
isXUSPY5NewMonth = IsNewMonth();
|
||||
bool canMonthlyAlert =
|
||||
isXUSPY5NewMonth &&
|
||||
xUSPY5EnableAlerts &&
|
||||
xUSPY5EnableMonthlyAlerts;
|
||||
bool canMonthlyReport =
|
||||
!isFirstMonth &&
|
||||
canMonthlyAlert &&
|
||||
xUSPY5EnableMonthlyReports;
|
||||
if (canMonthlyAlert)
|
||||
{
|
||||
//
|
||||
string message = "New Month ...";
|
||||
|
||||
//
|
||||
// Prepare Monthly Report ...
|
||||
if (canMonthlyReport)
|
||||
{
|
||||
//
|
||||
string report = xUSPY5Reporter.GenerateReportString(XREPORT_MONTHLY);
|
||||
|
||||
//
|
||||
message = "Last Month Report:\n" + report;
|
||||
}
|
||||
|
||||
//
|
||||
// Reset Report ...
|
||||
xUSPY5Reporter.Reset(XREPORT_MONTHLY);
|
||||
|
||||
//
|
||||
SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Weekly Alert ...
|
||||
bool isFirstWeek = xDayOfWeek == -1;
|
||||
isXUSPY5NewWeek = IsNewWeek();
|
||||
bool canWeeklyAlert =
|
||||
isXUSPY5NewWeek &&
|
||||
xUSPY5EnableAlerts &&
|
||||
xUSPY5EnableWeeklyAlerts;
|
||||
bool canWeeklyReport =
|
||||
!isFirstWeek &&
|
||||
canWeeklyAlert &&
|
||||
xUSPY5EnableWeeklyReports;
|
||||
if (canWeeklyAlert)
|
||||
{
|
||||
//
|
||||
string message = "New Week ...";
|
||||
|
||||
//
|
||||
// Prepare Weekly Report ...
|
||||
if (canWeeklyReport)
|
||||
{
|
||||
//
|
||||
string report = xUSPY5Reporter.GenerateReportString(XREPORT_WEEKLY);
|
||||
|
||||
//
|
||||
message = "Last Week Report:\n" + report;
|
||||
}
|
||||
|
||||
//
|
||||
// Reset Report ...
|
||||
xUSPY5Reporter.Reset(XREPORT_WEEKLY);
|
||||
|
||||
//
|
||||
SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Daily Alert ...
|
||||
bool isFirstDay = xDay == -1;
|
||||
isXUSPY5NewDay = IsNewDay();
|
||||
bool canDailyAlert =
|
||||
isXUSPY5NewDay &&
|
||||
xUSPY5EnableAlerts &&
|
||||
xUSPY5EnableDailyAlerts;
|
||||
bool canDailyReport =
|
||||
!isFirstDay &&
|
||||
canDailyAlert &&
|
||||
xUSPY5EnableDailyReports;
|
||||
if (canDailyAlert)
|
||||
{
|
||||
//
|
||||
string message = "New Day ...";
|
||||
|
||||
//
|
||||
// Prepare Daily Report ...
|
||||
if (canDailyReport)
|
||||
{
|
||||
//
|
||||
string report = xUSPY5Reporter.GenerateReportString(XREPORT_DAILY);
|
||||
|
||||
//
|
||||
message = "Last Week Report:\n" + report;
|
||||
}
|
||||
|
||||
//
|
||||
// Reset Report ...
|
||||
xUSPY5Reporter.Reset(XREPORT_DAILY);
|
||||
|
||||
//
|
||||
SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Hourly Alert ...
|
||||
bool isFirstHour = xHour == -1;
|
||||
isXUSPY5NewHour = IsNewHour();
|
||||
bool canHourlyAlert =
|
||||
isXUSPY5NewHour &&
|
||||
xUSPY5EnableAlerts &&
|
||||
xUSPY5EnableHourlyAlerts;
|
||||
if (canHourlyAlert)
|
||||
{
|
||||
//
|
||||
string message = "New Hour ...";
|
||||
|
||||
//
|
||||
SendAlert(message);
|
||||
}
|
||||
|
||||
//
|
||||
// Prevent Going Forward if user Disable it ...
|
||||
if (xUSPY5EnableProvider)
|
||||
{
|
||||
//
|
||||
// Handle Processing on XUSPY5 Signal Provider ...
|
||||
XUSPY5SignalProviderDoControlState();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Can Ignore Tick or not ..
|
||||
bool canIgnoreTick = xUSPY5IsTestMode
|
||||
? !IsNewCandle()
|
||||
: !IsNewCandle() && xUSPY5WaitUntilNextCandle;
|
||||
if (canIgnoreTick)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
xUSPY5WaitUntilNextCandle = false;
|
||||
|
||||
//
|
||||
// Prevent Going Forward if user Disable it ...
|
||||
if (xUSPY5EnableProvider)
|
||||
{
|
||||
//
|
||||
// Handle Processing on XUSPY5 Signal Provider ...
|
||||
XUSPY5SignalProviderHandleTick();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Handle Trade Events ...
|
||||
void OnTrade()
|
||||
{
|
||||
|
||||
//
|
||||
// Prevent Going Forward if user Disable it ...
|
||||
if (xUSPY5EnableProvider)
|
||||
{
|
||||
//
|
||||
// Handle Processing Trades on XUSPY5 Signal Provider ...
|
||||
XUSPY5SignalProviderHandleTrade();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// END Event Handlers ...
|
||||
//
|
||||
|
||||
//
|
||||
// START Functions ...
|
||||
//
|
||||
|
||||
//
|
||||
// Validate Input Args for Initialization ...
|
||||
bool ValidateInputs()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
|
||||
//
|
||||
// Validate XUSPY5 Provider Inputs ...
|
||||
result = XUSPY5ValidateInputs();
|
||||
if (!result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Logging State ...
|
||||
string message = "Validation of (" + logTag + ") Inputs " + (result ? "Succeeded" : "Failed") + " ...";
|
||||
LogMessage(message);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool XUSPY5CTimerInit()
|
||||
{
|
||||
//
|
||||
bool result = true;
|
||||
|
||||
//
|
||||
xUSPY5CTimerHandler = iCustom(
|
||||
_Symbol,
|
||||
_Period,
|
||||
"x-saherelm.xctimer.indicator",
|
||||
//
|
||||
// Inputs ...
|
||||
xUSPY5CandleTimerColot,
|
||||
xUSPY5CandleTimerCorner);
|
||||
|
||||
//
|
||||
if (xUSPY5CTimerHandler == INVALID_HANDLE)
|
||||
{
|
||||
result = false;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
//
|
||||
// END Functions ...
|
||||
//
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,283 @@
|
||||
///////////////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center MQL5 XUSPY5 Signal Provider Library Inputs
|
||||
// -----------------------------------------------------------
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////
|
||||
//
|
||||
// Global Properties ...
|
||||
#property library
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://www.saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property strict
|
||||
|
||||
//
|
||||
// Include Logger ...
|
||||
#include "../Libraries/x-saherelm.log.lib.mq5"
|
||||
|
||||
//
|
||||
// Include Classes ...
|
||||
#include "../Classes/x-saherelm.class.lib.mq5"
|
||||
|
||||
//
|
||||
input group "XUSPY5 Provider";
|
||||
|
||||
//
|
||||
// Commonly Used Configurations ...
|
||||
input group "XUSPY5 Common";
|
||||
//
|
||||
// Provider ...
|
||||
input bool xUSPY5EnableProvider = true; // Enable Provider
|
||||
input int xUSPY5NumberOfItemsPerTick = 30; // Number Of items Readed In Each Tick
|
||||
//
|
||||
// Alerts ...
|
||||
input bool xUSPY5EnableAlerts = true; // Enable Events Alert
|
||||
input bool xUSPY5EnableHourlyAlerts = false; // Send Alert on each new Hour
|
||||
input bool xUSPY5EnableDailyAlerts = false; // Send Alert on each new Day
|
||||
input bool xUSPY5EnableWeeklyAlerts = false; // Send Alert on each new Week
|
||||
input bool xUSPY5EnableMonthlyAlerts = false; // Send Alert on each new Month
|
||||
//
|
||||
// Reports ...
|
||||
input bool xUSPY5EnableDailyReports = false; // Send Report on each new Day
|
||||
input bool xUSPY5EnableWeeklyReports = false; // Send Report on each new Week
|
||||
input bool xUSPY5EnableMonthlyReports = false; // Send Report on each new Month
|
||||
|
||||
//
|
||||
// Trader and Expert Specific Configurations ...
|
||||
input group "XUSPY5 Trader";
|
||||
input int xUSPY5MagicNumber = 16940563; // Trader MagicNumber
|
||||
input int xUSPY5Slippage = 10; // Trader Slippage
|
||||
|
||||
//
|
||||
// Trades Management Configurations ...
|
||||
input group "XUSPY5 Trade Management";
|
||||
input bool xUSPY5AllowLongTrades = true; // Allow Long Trades
|
||||
input bool xUSPY5AllowShortTrades = true; // Allow Short Trades
|
||||
|
||||
//
|
||||
// Risk Management Configurations ...
|
||||
input group "XUSPY5 Risk Management";
|
||||
//
|
||||
// Trade Count ...
|
||||
input int xUSPY5MaxAllowedTrades = 10; // Max Allowed Trades at Same Time
|
||||
input ENUM_X_CROSS_SIGNAL_METHOD xUSPY5CrossSignalsMethod = X_CROSS_SIGNAL_REGULAR; // Handle Cross Signals Method
|
||||
//
|
||||
// Max Allowed Trade Age ...
|
||||
input int xUSPY5MaxAllowedTradeAge = 1500; // Detect Long Time Trades
|
||||
input ENUM_X_GUARD_ACTIONS xUSPY5OldTradesAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // What to do with Old Trades
|
||||
//
|
||||
// Trade Volume Specific Configurations ...
|
||||
input double xUSPY5StaticVolumeFactor = 0.0001; // Static Volume baesd on Balance
|
||||
input ENUM_STATIC_VOLUME_METHODS xUSPY5StaticVolumeMethod = X_STATIC_VOLUME_BASED_ON_BALANCE; // How to Calculate Static Volume
|
||||
input double xUSPY5VolumeMultiplier = 0; // Volume Increase Multiplier
|
||||
input double xUSPY5ApplyVolumeMultiplierFactor = 0; // Apply Volume Multiplier Rate based on Balance
|
||||
input double xUSPY5MaxSupportedVolumePerTradeFactor = 0; // Max Supported Volume Per Trade Factor based on Balance
|
||||
input double xUSPY5IncreasedMaxSupportedVolumeRate = 0; // Increase Max Supported Volume based on Balance
|
||||
//
|
||||
// Trade Profits ...
|
||||
input double xUSPY5MinRewardInPips = 3; // Minimum Reward Per Trade in Pips
|
||||
input double xUSPY5RiskFreeStepInPips = 0; // Make Trades Risk Free Steps in Pips
|
||||
input double xUSPY5RiskFreeRate = 0; // Volume Multiplier for Risk Free Trades
|
||||
//
|
||||
// Guard Riskable Money and Profits ...
|
||||
input double xUSPY5CriticalDrawDownFactor = 0.30; // Critical Allowed Drawdown Factor based on Balance
|
||||
input ENUM_X_GUARD_ACTIONS xUSPY5CriticalGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_1; // Specify Guard Action on Critical Drawdown
|
||||
input double xUSPY5MaxAllowedDrawDownFactor = 0.40; // Max Allowed Drawdown Factor based on Balance
|
||||
input ENUM_X_GUARD_ACTIONS xUSPY5MaxAllowedGuardAction = X_GUARD_PARTIAL_CLOSE_MAX_IN_DD_5; // Specify Guard Action on Max Allowed Drawdown
|
||||
input int xUSPY5GuardStopoutFiredAfterTouches = 5; // Guard Stopout all Trades if Max Allowed Drawdown touched
|
||||
|
||||
//
|
||||
// Account Conditions for Trading ...
|
||||
input double xUSPY5BalanceFactorForOpenTrades = 0.5; // Minimum Balance for Open Trades
|
||||
input double xUSPY5FreeMarginFactorForOpenTrades = 0.8; // Minimum Free Margin for Open Trades
|
||||
|
||||
//
|
||||
// May be Used Later as Input Params ...
|
||||
bool xUSPY5UseVirtualTPSl = false; // Use Virtual TP SL
|
||||
bool xUSPY5EnableSignalAlerts = false; // Send Signal Alert
|
||||
|
||||
//
|
||||
// Validate Inputs before Initialization ...
|
||||
bool XUSPY5ValidateInputs()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Implement Other Verifications ...
|
||||
|
||||
//
|
||||
// Check Trading Availability ...
|
||||
bool isTradeAvailable = xUSPY5AllowLongTrades || xUSPY5AllowShortTrades;
|
||||
if (!isTradeAvailable)
|
||||
{
|
||||
LogMessage("XUSPY5 => Warning: Trading disabled ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Chekc Number of reading items per tick ...
|
||||
result = xUSPY5NumberOfItemsPerTick >= 5;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 invalid Number of items Reading Per Tick ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Max Allowed Trades Count ...
|
||||
result = isTradeAvailable && xUSPY5MaxAllowedTrades >= 1;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Number of Trades not valid ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Free Margin ...
|
||||
result =
|
||||
isTradeAvailable &&
|
||||
xUSPY5FreeMarginFactorForOpenTrades > 0 &&
|
||||
xUSPY5FreeMarginFactorForOpenTrades < 1;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Free Margin ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check min Balance for Open Trades ...
|
||||
result =
|
||||
isTradeAvailable &&
|
||||
xUSPY5BalanceFactorForOpenTrades > 0 &&
|
||||
xUSPY5BalanceFactorForOpenTrades < 1;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Min Balance for Open Trades ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Min Reward Per Trade ...
|
||||
result = xUSPY5MinRewardInPips > 0;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Min Reward Per Trade ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Trades Volume ...
|
||||
result = xUSPY5StaticVolumeFactor > 0;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Static Volume ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Volume Multiplier ...
|
||||
result = xUSPY5VolumeMultiplier >= 0;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Volume Multiplier ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xUSPY5CriticalDrawDownFactor == 0 || (xUSPY5CriticalDrawDownFactor > 0 &&
|
||||
xUSPY5CriticalDrawDownFactor < 1);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Critical DrawDown Factor ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
xUSPY5MaxAllowedDrawDownFactor == 0 || (xUSPY5MaxAllowedDrawDownFactor > 0 &&
|
||||
xUSPY5MaxAllowedDrawDownFactor < 1);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Invalid Max Allowed DrawDown Factor ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Guard Actions ...
|
||||
//
|
||||
result =
|
||||
xUSPY5CriticalDrawDownFactor > 0 &&
|
||||
xUSPY5CriticalDrawDownFactor < 1 &&
|
||||
xUSPY5MaxAllowedDrawDownFactor > 0 &&
|
||||
xUSPY5MaxAllowedDrawDownFactor < 1;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 For Critical Drawdown, you have to Specify Max Drawdown also ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = xUSPY5CriticalDrawDownFactor > 0 && xUSPY5CriticalDrawDownFactor < xUSPY5MaxAllowedDrawDownFactor;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
LogMessage("XUSPY5 Critical Drawdown must Smaller than Max Drawdown ...");
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (xUSPY5CriticalDrawDownFactor > 0 && xUSPY5CriticalGuardAction == X_GUARD_DO_NOTHING)
|
||||
{
|
||||
LogMessage("XUSPY5 IMPORTANT you Specified Critical Drawdown, but there is no any Guard Action ...");
|
||||
}
|
||||
|
||||
//
|
||||
if (xUSPY5MaxAllowedDrawDownFactor > 0 && xUSPY5MaxAllowedGuardAction == X_GUARD_DO_NOTHING)
|
||||
{
|
||||
LogMessage("XUSPY5 IMPORTANT you Specified Max Allowed Drawdown, but there is no any Guard Action ...");
|
||||
}
|
||||
|
||||
//
|
||||
result = true;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user