add adxtd into indicator for control behaviour ...

This commit is contained in:
2024-06-21 15:59:30 +03:30
parent 9041f22045
commit fdf5442255
9 changed files with 3821 additions and 339 deletions
+143 -62
View File
@@ -39,21 +39,25 @@ input group "Makret Cycles";
input group "Short";
input ENUM_X_PERIOD_METHOD scMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES scPeriod = NULL; // Time Period
// input int scLength = 0; // Length
//
input group "Medium";
input ENUM_X_PERIOD_METHOD mcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES mcPeriod = NULL; // Time Period
// input int mcLength = 0; // Length
//
input group "Long";
input ENUM_X_PERIOD_METHOD lcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES lcPeriod = NULL; // Time Period
// input int lcLength = 0; // Length
//
input group "Hind";
input ENUM_X_PERIOD_METHOD hcMethod = X_PERIOD_AUTO; // How to Find Period
input ENUM_TIMEFRAMES hcPeriod = NULL; // Time Period
// input int hcLength = 0; // Length
//
input group "Fibonacci";
@@ -381,24 +385,32 @@ int maxLength;
double mHideColorIDX = 0;
//
XMarketCycle sc;
// XMarketCycle sc;
int mSCLength = 0;
double mLastSCHH = 0;
double mLastSCLL = 0;
ENUM_TIMEFRAMES mSCPeriod = NULL;
//
XMarketCycle mc;
// XMarketCycle mc;
int mMCLength = 0;
double mLastMCHH = 0;
double mLastMCLL = 0;
ENUM_TIMEFRAMES mMCPeriod = NULL;
//
XMarketCycle lc;
// XMarketCycle lc;
int mLCLength = 0;
double mLastLCHH = 0;
double mLastLCLL = 0;
ENUM_TIMEFRAMES mLCPeriod = NULL;
//
XMarketCycle hc;
// XMarketCycle hc;
int mHCLength = 0;
double mLastHCHH = 0;
double mLastHCLL = 0;
ENUM_TIMEFRAMES mHCPeriod = NULL;
//
double lastPeak = 0;
@@ -516,10 +528,10 @@ bool ValidateInputs()
//
bool result =
//
IsValid(scMethod, scPeriod) &&
IsValid(mcMethod, mcPeriod) &&
IsValid(lcMethod, lcPeriod) &&
IsValid(hcMethod, hcPeriod)
(IsValid(scMethod, scPeriod) &&
IsValid(mcMethod, mcPeriod) &&
IsValid(lcMethod, lcPeriod) &&
IsValid(hcMethod, hcPeriod))
//
;
@@ -536,9 +548,9 @@ int ExtractMaxLengthOfInputs()
int result = 0;
//
result = MathMax(sc.length, mc.length);
result = MathMax(result, lc.length);
result = MathMax(result, hc.length);
result = MathMax(mSCLength, mMCLength);
result = MathMax(result, mLCLength);
result = MathMax(result, mHCLength);
//
return result;
@@ -834,60 +846,101 @@ bool InitMarketCycles()
bool result = false;
//
// Short ...
result = sc.Init(
_Symbol,
_Period,
X_MARKET_CYCLE_SHORT,
scMethod,
scPeriod
//
);
if (!result)
int cPeriodSeconds = PeriodSeconds(_Period);
//
// Find Cycle Period ...
if (scMethod == X_PERIOD_AUTO)
{
return result;
//
// Select Period ...
mSCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_SHORT,
_Period //
);
}
else
{
mSCPeriod = scPeriod;
}
//
// Medium ...
result = mc.Init(
_Symbol,
_Period,
X_MARKET_CYCLE_MEDIUM,
mcMethod,
mcPeriod
//
);
if (!result)
if (IsValid(mSCPeriod))
{
return result;
mSCLength = PeriodSeconds(mSCPeriod) / cPeriodSeconds;
}
//
// Long ...
result = lc.Init(
_Symbol,
_Period,
X_MARKET_CYCLE_LONG,
lcMethod,
lcPeriod
//
);
if (!result)
// Find Cycle Period ...
if (mcMethod == X_PERIOD_AUTO)
{
return result;
//
// Select Period ...
mMCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_MEDIUM,
_Period //
);
}
else
{
mMCPeriod = mcPeriod;
}
//
// Hind ...
result = hc.Init(
_Symbol,
_Period,
X_MARKET_CYCLE_HIND,
hcMethod,
hcPeriod
if (IsValid(mMCPeriod))
{
mMCLength = PeriodSeconds(mMCPeriod) / cPeriodSeconds;
}
//
// Find Cycle Period ...
if (lcMethod == X_PERIOD_AUTO)
{
//
);
// Select Period ...
mLCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_LONG,
_Period //
);
}
else
{
mLCPeriod = lcPeriod;
}
//
if (IsValid(mLCPeriod))
{
mLCLength = PeriodSeconds(mLCPeriod) / cPeriodSeconds;
}
//
// Find Cycle Period ...
if (hcMethod == X_PERIOD_AUTO)
{
//
// Select Period ...
mHCPeriod = GetCyclePeriod(
X_MARKET_CYCLE_HIND,
_Period //
);
}
else
{
mHCPeriod = hcPeriod;
}
//
if (IsValid(mHCPeriod))
{
mHCLength = PeriodSeconds(mHCPeriod) / cPeriodSeconds;
}
//
result = mSCLength > 0 &&
mMCLength > mSCLength &&
mLCLength > mMCLength &&
mHCLength > mLCLength;
//
return result;
@@ -897,7 +950,7 @@ bool InitMarketCycles()
// Calculate Specified Cycles HH and LL ...
void CalculateCycle(
int barIndex,
XMarketCycle &cycle,
ENUM_X_MARKET_CYCLES cycle,
double &lastHH,
double &hhBuffer[],
double &hhColorBuffer[],
@@ -906,9 +959,6 @@ void CalculateCycle(
double &llColorBuffer[] //
)
{
//
cycle.Update(barIndex);
//
XOHCL bar;
bar.Init(
@@ -918,9 +968,40 @@ void CalculateCycle(
//
);
//
int mLength = 0;
switch (cycle)
{
//
case X_MARKET_CYCLE_SHORT:
mLength = mSCLength;
break;
//
case X_MARKET_CYCLE_MEDIUM:
mLength = mMCLength;
break;
//
case X_MARKET_CYCLE_LONG:
mLength = mLCLength;
break;
//
case X_MARKET_CYCLE_HIND:
mLength = mHCLength;
break;
}
//
if (mLength <= 0)
{
return;
}
//
double hhValue = bar.FindHighest(
cycle.length,
mLength,
hhMode
//
);
@@ -946,7 +1027,7 @@ void CalculateCycle(
//
double llValue = bar.FindLowest(
cycle.length,
mLength,
llMode
//
);
@@ -981,7 +1062,7 @@ void CalculateCycles(
// Short ...
CalculateCycle(
barIndex,
sc,
X_MARKET_CYCLE_SHORT,
//
mLastSCHH,
scHHBuffer,
@@ -997,7 +1078,7 @@ void CalculateCycles(
// Medium ...
CalculateCycle(
barIndex,
mc,
X_MARKET_CYCLE_MEDIUM,
//
mLastMCHH,
mcHHBuffer,
@@ -1013,7 +1094,7 @@ void CalculateCycles(
// Long ...
CalculateCycle(
barIndex,
lc,
X_MARKET_CYCLE_LONG,
//
mLastLCHH,
lcHHBuffer,
@@ -1029,7 +1110,7 @@ void CalculateCycles(
// Hind ...
CalculateCycle(
barIndex,
hc,
X_MARKET_CYCLE_HIND,
//
mLastHCHH,
hcHHBuffer,