complete XCHICH Helper and Integrated it to XCH Strategy ...
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user