last ...
This commit is contained in:
@@ -2799,30 +2799,156 @@ struct X121SMCStrategyConditionParser
|
||||
IsBearish(iBarPosDir);
|
||||
|
||||
//
|
||||
// result = isBarValidForBullish ||
|
||||
// isBarValidForBearish;
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// zBar.Clean();
|
||||
// cBar.Clean();
|
||||
// pBar.Clean();
|
||||
// cState.Clean();
|
||||
// chState.Clean();
|
||||
// insideBox.Clean();
|
||||
// ZeroMemory(cHelper);
|
||||
// cConditions.Clean();
|
||||
// cXConditions.Clean();
|
||||
// ZeroMemory(chHelper);
|
||||
// chConditions.Clean();
|
||||
// chXConditions.Clean();
|
||||
XSignalBox iSignalBox;
|
||||
count = ArraySize(waitingBoxes);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XSignalBox iBox = waitingBoxes[i];
|
||||
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
bool isBullish = iBox.ob.IsBullish();
|
||||
bool hasFVG = iBox.fvg.IsValid();
|
||||
|
||||
//
|
||||
bool isFVGBullishRejected =
|
||||
//
|
||||
hasFVG &&
|
||||
cBar.low < iBox.fvg.upper &&
|
||||
cBar.GetDown() > iBox.fvg.upper
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isFVGBearishRejected =
|
||||
//
|
||||
hasFVG &&
|
||||
cBar.high > iBox.fvg.lower &&
|
||||
cBar.GetUp() < iBox.fvg.lower
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isOBBullishRejected =
|
||||
//
|
||||
cBar.low < iBox.ob.upper &&
|
||||
cBar.GetDown() > iBox.ob.upper
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isOBBearishRejected =
|
||||
//
|
||||
cBar.high > iBox.ob.lower &&
|
||||
cBar.GetUp() < iBox.ob.lower
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has =
|
||||
isBullish
|
||||
? isBarValidForBullish &&
|
||||
(hasFVG
|
||||
? isFVGBullishRejected
|
||||
: isOBBullishRejected)
|
||||
: isBarValidForBearish &&
|
||||
(hasFVG
|
||||
? isFVGBearishRejected
|
||||
: isOBBearishRejected);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iSignalBox = iBox;
|
||||
iBox.Clean();
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
has = iSignalBox.IsValid();
|
||||
|
||||
//
|
||||
// Detecting Signal Conditions ...
|
||||
// Retest Signal ...
|
||||
int retests = 0;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
bool hasFVG = iSignalBox.fvg.IsValid();
|
||||
XBoxZone iBox;
|
||||
if (hasFVG)
|
||||
{
|
||||
iBox = iSignalBox.fvg;
|
||||
}
|
||||
else
|
||||
{
|
||||
iBox = iSignalBox.ob;
|
||||
}
|
||||
|
||||
//
|
||||
int iFromIDX = GetBarIndex(
|
||||
cBar.symbol,
|
||||
cBar.period,
|
||||
iBox.from //
|
||||
);
|
||||
has = IsValidIndex(iFromIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Counting Retests ...
|
||||
for (int i = iFromIDX; i >= barIndex; i--)
|
||||
{
|
||||
//
|
||||
XOHCL iBar;
|
||||
has = iBar.Init(
|
||||
cBar.symbol,
|
||||
cBar.period,
|
||||
i //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBullishRetested =
|
||||
//
|
||||
iBar.low < iBox.upper &&
|
||||
iBar.GetDown() > iBox.upper
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isBearishRetested =
|
||||
//
|
||||
iBar.high > iBox.lower &&
|
||||
iBar.GetUp() < iBox.lower
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has = iBox.IsBullish()
|
||||
? isBullishRetested
|
||||
: isBearishRetested;
|
||||
if (has)
|
||||
{
|
||||
retests++;
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
bool isSignalBoxRetested = retests > 1;
|
||||
bool hasSignalBox = iSignalBox.IsValid();
|
||||
bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir);
|
||||
|
||||
//
|
||||
// Bullish Conditions ...
|
||||
@@ -2831,11 +2957,10 @@ struct X121SMCStrategyConditionParser
|
||||
// Base Condition ...
|
||||
(
|
||||
//
|
||||
false
|
||||
// cBar.IsBullish() &&
|
||||
// isBarValidForBullish &&
|
||||
// cBar.close > cXConditions.x3maFastBuffer[cIDX] &&
|
||||
// cXConditions.x3maFastBuffer[cIDX] < cXConditions.x3maSlowBuffer[cIDX]
|
||||
hasSignalBox &&
|
||||
isSignalBoxBullish &&
|
||||
isSignalBoxRetested &&
|
||||
isBarValidForBullish
|
||||
//
|
||||
)
|
||||
//
|
||||
@@ -2848,11 +2973,10 @@ struct X121SMCStrategyConditionParser
|
||||
// Base Condition ...
|
||||
(
|
||||
//
|
||||
false
|
||||
// cBar.IsBearish() &&
|
||||
// isBarValidForBearish &&
|
||||
// cBar.close < cXConditions.x3maFastBuffer[cIDX] &&
|
||||
// cXConditions.x3maFastBuffer[cIDX] > cXConditions.x3maSlowBuffer[cIDX]
|
||||
hasSignalBox &&
|
||||
!isSignalBoxBullish &&
|
||||
isSignalBoxRetested &&
|
||||
isBarValidForBearish
|
||||
//
|
||||
)
|
||||
//
|
||||
@@ -2872,13 +2996,17 @@ struct X121SMCStrategyConditionParser
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
box.dir = dir;
|
||||
if (iSignalBox.fvg.IsValid())
|
||||
{
|
||||
box = iSignalBox.fvg;
|
||||
}
|
||||
else
|
||||
{
|
||||
box = iSignalBox.ob;
|
||||
}
|
||||
|
||||
//
|
||||
box.to = TimeCurrent();
|
||||
// box.from = insideBox.from;
|
||||
// box.upper = insideBox.upper;
|
||||
// box.lower = insideBox.lower;
|
||||
box.symbol = cXConditions.symbol;
|
||||
box.period = cXConditions.period;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2896,7 +3024,7 @@ struct X121SMCStrategyConditionParser
|
||||
pBar.Clean();
|
||||
cState.Clean();
|
||||
chState.Clean();
|
||||
// insideBox.Clean();
|
||||
iSignalBox.Clean();
|
||||
ZeroMemory(cHelper);
|
||||
cConditions.Clean();
|
||||
cStateEvents.Clean();
|
||||
|
||||
Reference in New Issue
Block a user