Apply 1r1 EURUSD Level 1 Fix ...

This commit is contained in:
2024-08-23 22:05:24 +03:30
parent f9f1baa4a7
commit f52241934e
7 changed files with 39130 additions and 13 deletions
+350
View File
@@ -4703,6 +4703,356 @@ public:
return result;
}
//
// Check Cycles Switched to Bullish or not ...
bool IsCyclesSwitchedToBullish(
int barIndex, // Bar Index
ENUM_X_MARKET_CYCLES &cycles[] //
)
{
//
bool result = false;
//
int cyclesCount = ArraySize(cycles);
result = IsValidSize(cyclesCount);
if (!result)
{
return result;
}
//
int cIndex = barIndex;
int pIndex = cIndex + 1;
//
XOHCL cBars[];
XOHCL pBars[];
for (int i = 0; i < cyclesCount; i++)
{
//
XOHCL iCBar;
XOHCL iPBar;
//
switch (cycles[i])
{
//
// CURRENT ...
case X_MARKET_CYCLE_UNKNOWN:
result = CAsOHCL(iCBar, cIndex);
break;
//
// SHORT ...
case X_MARKET_CYCLE_SHORT:
result = SAsOHCL(iCBar, cIndex);
break;
//
// MEDIUM ...
case X_MARKET_CYCLE_MEDIUM:
result = MAsOHCL(iCBar, cIndex);
break;
//
// LONG ...
case X_MARKET_CYCLE_LONG:
result = LAsOHCL(iCBar, cIndex);
break;
//
// HIND ...
case X_MARKET_CYCLE_HIND:
result = HAsOHCL(iCBar, cIndex);
break;
}
if (!result)
{
break;
}
AddRef(
iCBar,
cBars //
);
//
switch (cycles[i])
{
//
// CURRENT ...
case X_MARKET_CYCLE_UNKNOWN:
result = CAsOHCL(iPBar, pIndex);
break;
//
// SHORT ...
case X_MARKET_CYCLE_SHORT:
result = SAsOHCL(iPBar, pIndex);
break;
//
// MEDIUM ...
case X_MARKET_CYCLE_MEDIUM:
result = MAsOHCL(iPBar, pIndex);
break;
//
// LONG ...
case X_MARKET_CYCLE_LONG:
result = LAsOHCL(iPBar, pIndex);
break;
//
// HIND ...
case X_MARKET_CYCLE_HIND:
result = HAsOHCL(iPBar, pIndex);
break;
}
if (!result)
{
break;
}
AddRef(
iPBar,
pBars //
);
}
//
int cBarsCount = ArraySize(cBars);
int pBarsCount = ArraySize(pBars);
result =
//
IsValidSize(cBarsCount) &&
cBarsCount == cyclesCount &&
//
IsValidSize(pBarsCount) &&
pBarsCount == cyclesCount
//
;
if (!result)
{
return result;
}
//
bool isCIndexBullish = true;
for (int i = 0; i < cBarsCount; i++)
{
isCIndexBullish = isCIndexBullish && cBars[i].IsBullish();
}
//
bool isPIndexBullish = true;
for (int i = 0; i < pBarsCount; i++)
{
isPIndexBullish = isPIndexBullish && pBars[i].IsBullish();
}
//
result = isCIndexBullish &&
!isPIndexBullish;
//
return result;
}
//
// Check Cycles Switched to Bearish or not ...
bool IsCyclesSwitchedToBearish(
int barIndex, // Bar Index
ENUM_X_MARKET_CYCLES &cycles[] //
)
{
//
bool result = false;
//
int cyclesCount = ArraySize(cycles);
result = IsValidSize(cyclesCount);
if (!result)
{
return result;
}
//
int cIndex = barIndex;
int pIndex = cIndex + 1;
//
XOHCL cBars[];
XOHCL pBars[];
for (int i = 0; i < cyclesCount; i++)
{
//
XOHCL iCBar;
XOHCL iPBar;
//
switch (cycles[i])
{
//
// CURRENT ...
case X_MARKET_CYCLE_UNKNOWN:
result = CAsOHCL(iCBar, cIndex);
break;
//
// SHORT ...
case X_MARKET_CYCLE_SHORT:
result = SAsOHCL(iCBar, cIndex);
break;
//
// MEDIUM ...
case X_MARKET_CYCLE_MEDIUM:
result = MAsOHCL(iCBar, cIndex);
break;
//
// LONG ...
case X_MARKET_CYCLE_LONG:
result = LAsOHCL(iCBar, cIndex);
break;
//
// HIND ...
case X_MARKET_CYCLE_HIND:
result = HAsOHCL(iCBar, cIndex);
break;
}
if (!result)
{
break;
}
AddRef(
iCBar,
cBars //
);
//
switch (cycles[i])
{
//
// CURRENT ...
case X_MARKET_CYCLE_UNKNOWN:
result = CAsOHCL(iPBar, pIndex);
break;
//
// SHORT ...
case X_MARKET_CYCLE_SHORT:
result = SAsOHCL(iPBar, pIndex);
break;
//
// MEDIUM ...
case X_MARKET_CYCLE_MEDIUM:
result = MAsOHCL(iPBar, pIndex);
break;
//
// LONG ...
case X_MARKET_CYCLE_LONG:
result = LAsOHCL(iPBar, pIndex);
break;
//
// HIND ...
case X_MARKET_CYCLE_HIND:
result = HAsOHCL(iPBar, pIndex);
break;
}
if (!result)
{
break;
}
AddRef(
iPBar,
pBars //
);
}
//
int cBarsCount = ArraySize(cBars);
int pBarsCount = ArraySize(pBars);
result =
//
IsValidSize(cBarsCount) &&
cBarsCount == cyclesCount &&
//
IsValidSize(pBarsCount) &&
pBarsCount == cyclesCount
//
;
if (!result)
{
return result;
}
//
bool isCIndexBearish = true;
for (int i = 0; i < cBarsCount; i++)
{
isCIndexBearish = isCIndexBearish && cBars[i].IsBearish();
}
//
bool isPIndexBearish = true;
for (int i = 0; i < pBarsCount; i++)
{
isPIndexBearish = isPIndexBearish && pBars[i].IsBearish();
}
//
result = isCIndexBearish &&
!isPIndexBearish;
//
return result;
}
//
// Check All Cycles Switched to Bullish or not ...
bool IsSwitchedToBullish(
int barIndex // Bar Index
)
{
//
bool result = false;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
result = IsValidSize(cyclesCount);
if (!result)
{
return result;
}
//
result = IsCyclesSwitchedToBullish(
barIndex,
cycles //
);
//
return result;
}
//
// Check All Cycles Switched to Bearish or not ...
bool IsSwitchedToBearish(
int barIndex // Bar Index
)
{
//
bool result = false;
//
ENUM_X_MARKET_CYCLES cycles[];
int cyclesCount = GetAllMarketCycles(cycles);
result = IsValidSize(cyclesCount);
if (!result)
{
return result;
}
//
result = IsCyclesSwitchedToBearish(
barIndex,
cycles //
);
//
return result;
}
//
// Conditions ...