complete XCHICH Helper and Integrated it to XCH Strategy ...

This commit is contained in:
2024-08-06 00:06:06 +03:30
parent 423d2ef693
commit 4fcc0bc70b
7 changed files with 4998 additions and 1408 deletions
+68
View File
@@ -11333,4 +11333,72 @@ ENUM_TIMEFRAMES GetCyclePeriod(
return result;
}
//
// Calculate a Cycle Length based on Host Period ...
int GetCycleLengthOn(
ENUM_TIMEFRAMES _hostPeriod,
ENUM_X_MARKET_CYCLES _cycle,
ENUM_X_PERIOD_METHOD _method,
ENUM_TIMEFRAMES _period //
)
{
//
int result = 0;
//
// Validate ...
bool isValid =
//
IsValid(_hostPeriod) &&
IsValid(_method, _Period)
//
;
if (!isValid)
{
return result;
}
//
// Calculate Period ...
isValid =
_method != X_PERIOD_NOTHING &&
_cycle != X_MARKET_CYCLE_UNKNOWN;
if (!isValid)
{
return result;
}
//
if (_method == X_PERIOD_AUTO)
{
//
_period = GetCyclePeriod(
_cycle,
_hostPeriod //
);
}
isValid = IsValid(_period);
if (!isValid)
{
return result;
}
//
int _hostPeriodSeconds = PeriodSeconds(_hostPeriod);
int _periodSeconds = PeriodSeconds(_period);
//
isValid = _periodSeconds >= _hostPeriodSeconds;
if (!isValid)
{
return result;
}
//
result = _periodSeconds / _hostPeriodSeconds;
//
return result;
}
//