last ...
This commit is contained in:
@@ -1053,3 +1053,994 @@ bool IsReject(
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasConditions(
|
||||||
|
ENUM_X_DIRECTION &conditionsDir,
|
||||||
|
XPOIState &state,
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditionsDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (forPeriod == NULL)
|
||||||
|
{
|
||||||
|
forPeriod = period;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
IsValid(symbol) &&
|
||||||
|
IsValid(period) &&
|
||||||
|
state.IsValid() &&
|
||||||
|
HasWorkingZone() &&
|
||||||
|
state.HasChild()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Conditions Based On Start Zones ...
|
||||||
|
bool hasStartZones = HasStartZones();
|
||||||
|
if (hasStartZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = CountStartZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCXWZZone iStartZone = startZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone insideBox;
|
||||||
|
bool isPriceInside = iStartZone.IsPriceInside(
|
||||||
|
insideBox,
|
||||||
|
barIndex,
|
||||||
|
forPeriod //
|
||||||
|
);
|
||||||
|
if (!isPriceInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iStartZone.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Print("PriceInside ...");
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasConditions = iStartZone.HasCondition(
|
||||||
|
insideBox,
|
||||||
|
state,
|
||||||
|
barIndex,
|
||||||
|
forPeriod //
|
||||||
|
);
|
||||||
|
if (!hasConditions)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iStartZone.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iStartZone.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Conditions Based On Working Zones ...
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Detect Result Based On WorkingZone ...
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasCondition(
|
||||||
|
XBoxZone &box,
|
||||||
|
XPOIState &state,
|
||||||
|
int barIndex = 0,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
box.IsValid() &&
|
||||||
|
HasDirection() &&
|
||||||
|
state.IsValid() &&
|
||||||
|
state.HasChild();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = box.symbol;
|
||||||
|
if (!IsValid(forPeriod))
|
||||||
|
{
|
||||||
|
forPeriod = box.period;
|
||||||
|
}
|
||||||
|
datetime cTime = iTime(
|
||||||
|
symbol,
|
||||||
|
forPeriod,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION forDir = box.dir;
|
||||||
|
bool isBullish = IsBullish(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
int supportsCount = 0;
|
||||||
|
bool hasSupports = false;
|
||||||
|
XCSupportZone *supports[];
|
||||||
|
|
||||||
|
//
|
||||||
|
int resistancesCount = 0;
|
||||||
|
bool hasResistances = false;
|
||||||
|
XCResistanceZone *resistances[];
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone supResBoxes[];
|
||||||
|
int supresBoxesCount = 0;
|
||||||
|
bool hasSupResBoxes = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
has = state.HasSupportZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountSupportZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *iZone = state.supportZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
iZone.To(cTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox;
|
||||||
|
bool hasBox = ToBox(
|
||||||
|
iBox,
|
||||||
|
iZone //
|
||||||
|
);
|
||||||
|
if (!hasBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check From ...
|
||||||
|
bool isInside = IsBoxInside(
|
||||||
|
iBox,
|
||||||
|
box //
|
||||||
|
);
|
||||||
|
if (!isInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
iZone,
|
||||||
|
supports //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
supResBoxes //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
supportsCount = ArraySize(supports);
|
||||||
|
hasSupports = IsValidSize(supportsCount);
|
||||||
|
|
||||||
|
//
|
||||||
|
supresBoxesCount = ArraySize(supResBoxes);
|
||||||
|
hasSupResBoxes = IsValidSize(supresBoxesCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
has = state.HasResistanceZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountResistanceZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *iZone = state.resistanceZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
iZone.To(cTime);
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox;
|
||||||
|
bool hasBox = ToBox(
|
||||||
|
iBox,
|
||||||
|
iZone //
|
||||||
|
);
|
||||||
|
if (!hasBox)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check From ...
|
||||||
|
bool isInside = IsBoxInside(
|
||||||
|
iBox,
|
||||||
|
box //
|
||||||
|
);
|
||||||
|
if (!isInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
iZone,
|
||||||
|
resistances //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
supResBoxes //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
resistancesCount = ArraySize(resistances);
|
||||||
|
hasResistances = IsValidSize(resistancesCount);
|
||||||
|
|
||||||
|
//
|
||||||
|
supresBoxesCount = ArraySize(supResBoxes);
|
||||||
|
hasSupResBoxes = IsValidSize(supresBoxesCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = hasSupResBoxes;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// //
|
||||||
|
// AddRef(
|
||||||
|
// box,
|
||||||
|
// supResBoxes //
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
result = zBar.Init(
|
||||||
|
symbol,
|
||||||
|
forPeriod,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = zBar.GetPreviousBar(cBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
result = cBar.GetPreviousBar(pBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL ppBar;
|
||||||
|
result = pBar.GetPreviousBar(ppBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
ppBar.Clean();
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
swingBar.Clean();
|
||||||
|
breakerBar.Clean();
|
||||||
|
appliedBox.Clean();
|
||||||
|
momentumBar.Clean();
|
||||||
|
rejectionBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Start Senario ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double fiboPressureLevel = GetFiboLevelValue(X_FIBO_LEVEL_382);
|
||||||
|
|
||||||
|
//
|
||||||
|
double fiboUpDown = GetFibonacciLevel(
|
||||||
|
pBar.high,
|
||||||
|
pBar.low,
|
||||||
|
X_FIBO_LEVEL_382,
|
||||||
|
X_DIRECTION_BEARISH //
|
||||||
|
);
|
||||||
|
double fiboDownUp = GetFibonacciLevel(
|
||||||
|
pBar.high,
|
||||||
|
pBar.low,
|
||||||
|
X_FIBO_LEVEL_382,
|
||||||
|
X_DIRECTION_BULLISH //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasFiboToUpPressure =
|
||||||
|
fiboDownUp > 0 &&
|
||||||
|
fiboDownUp <= pBar.GetDown();
|
||||||
|
bool hasFiboToDownPressure =
|
||||||
|
fiboUpDown > 0 &&
|
||||||
|
fiboUpDown >= pBar.GetUp();
|
||||||
|
|
||||||
|
//
|
||||||
|
int selectedBoxIDX = -1;
|
||||||
|
for (int j = 0; j < supresBoxesCount; j++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
double appliedPrice =
|
||||||
|
isBullish
|
||||||
|
? supResBoxes[j].lower
|
||||||
|
: supResBoxes[j].upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Swing Low ...
|
||||||
|
bool isSwingLow =
|
||||||
|
//
|
||||||
|
pBar.low < ppBar.low &&
|
||||||
|
pBar.low < cBar.low &&
|
||||||
|
zBar.open > pBar.low &&
|
||||||
|
//
|
||||||
|
appliedPrice > pBar.low &&
|
||||||
|
appliedPrice < pBar.GetDown()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
bool isPressuredSwingLow =
|
||||||
|
isSwingLow &&
|
||||||
|
hasFiboToUpPressure;
|
||||||
|
bool isPressuredStrongSwingLow =
|
||||||
|
pBar.IsBullish() &&
|
||||||
|
isPressuredSwingLow;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingHigh =
|
||||||
|
//
|
||||||
|
pBar.high > ppBar.high &&
|
||||||
|
pBar.high > cBar.high &&
|
||||||
|
zBar.open < pBar.high &&
|
||||||
|
//
|
||||||
|
appliedPrice < pBar.high &&
|
||||||
|
appliedPrice > pBar.GetUp()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
bool isPressuredSwingHigh =
|
||||||
|
isSwingHigh &&
|
||||||
|
hasFiboToDownPressure;
|
||||||
|
bool isPressuredStrongSwingHigh =
|
||||||
|
pBar.IsBearish() &&
|
||||||
|
isPressuredSwingHigh;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasValidSwing =
|
||||||
|
isBullish
|
||||||
|
? isSwingLow
|
||||||
|
: isSwingHigh;
|
||||||
|
bool hasValidPressuredSwing =
|
||||||
|
isBullish
|
||||||
|
? isPressuredSwingLow
|
||||||
|
: isPressuredSwingHigh;
|
||||||
|
bool hasValidPressuredStrongSwing =
|
||||||
|
isBullish
|
||||||
|
? isPressuredStrongSwingLow
|
||||||
|
: isPressuredStrongSwingHigh;
|
||||||
|
if (hasValidSwing)
|
||||||
|
{
|
||||||
|
swingBar = pBar;
|
||||||
|
}
|
||||||
|
if (hasValidPressuredSwing)
|
||||||
|
{
|
||||||
|
swingBar = pBar;
|
||||||
|
}
|
||||||
|
if (hasValidPressuredStrongSwing)
|
||||||
|
{
|
||||||
|
swingBar = pBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
cBar //
|
||||||
|
);
|
||||||
|
if (isCBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = cBar;
|
||||||
|
}
|
||||||
|
bool isPBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
pBar //
|
||||||
|
);
|
||||||
|
if (!isCBarBreaked && isPBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = pBar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isPBarBreaked = false;
|
||||||
|
}
|
||||||
|
bool isPPBarBreaked = IsBarBreak(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
ppBar //
|
||||||
|
);
|
||||||
|
if (!isCBarBreaked &&
|
||||||
|
!isPBarBreaked &&
|
||||||
|
isPPBarBreaked)
|
||||||
|
{
|
||||||
|
breakerBar = ppBar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isPPBarBreaked = false;
|
||||||
|
}
|
||||||
|
bool isBoxBreaked = isCBarBreaked ||
|
||||||
|
isPBarBreaked ||
|
||||||
|
isPPBarBreaked;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
cBar //
|
||||||
|
);
|
||||||
|
if (isCBarRejected)
|
||||||
|
{
|
||||||
|
rejectionBar = cBar;
|
||||||
|
}
|
||||||
|
bool isPBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
pBar //
|
||||||
|
);
|
||||||
|
if (!isCBarRejected && isPBarRejected)
|
||||||
|
{
|
||||||
|
rejectionBar = pBar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isPBarRejected = false;
|
||||||
|
}
|
||||||
|
bool isPPBarRejected = IsBarReject(
|
||||||
|
appliedPrice,
|
||||||
|
forDir,
|
||||||
|
ppBar //
|
||||||
|
);
|
||||||
|
if (!isCBarRejected &&
|
||||||
|
!isPBarRejected &&
|
||||||
|
isPPBarRejected)
|
||||||
|
{
|
||||||
|
rejectionBar = ppBar;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isPPBarRejected = false;
|
||||||
|
}
|
||||||
|
bool isBoxRejected = isCBarRejected ||
|
||||||
|
isPBarRejected ||
|
||||||
|
isPPBarRejected;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasRejectionBar = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBullishRejectionBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iZone = state.bullishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasRejectionBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasRejectionBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!rejectionBar.IsValid())
|
||||||
|
{
|
||||||
|
rejectionBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBearishRejectionBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCRejectionBar *iZone = state.bearishRejectionBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasRejectionBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasRejectionBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!rejectionBar.IsValid())
|
||||||
|
{
|
||||||
|
rejectionBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasMomentumBar = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBullishMomentumBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iZone = state.bullishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasMomentumBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasMomentumBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!momentumBar.IsValid())
|
||||||
|
{
|
||||||
|
momentumBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountBearishMomentumBars();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCMomentumBar *iZone = state.bearishMomentumBars[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iZone.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasMomentumBar =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasMomentumBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!momentumBar.IsValid())
|
||||||
|
{
|
||||||
|
momentumBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasSwing = false;
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountSwingLows();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingLows[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iSwing.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSwing =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasSwing)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!swingBar.IsValid())
|
||||||
|
{
|
||||||
|
swingBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = state.CountSwingHighs();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSwing *iSwing = state.swingHighs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL iBar;
|
||||||
|
bool isFilled = iSwing.FillBar(iBar);
|
||||||
|
if (!isFilled)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int iBarIndex = iBar.Index();
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSwing =
|
||||||
|
//
|
||||||
|
(iBarIndex == cBar.Index() ||
|
||||||
|
iBarIndex == pBar.Index())
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (hasSwing)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!swingBar.IsValid())
|
||||||
|
{
|
||||||
|
swingBar = iBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasRequiredValidations =
|
||||||
|
//
|
||||||
|
(hasRejectionBar ||
|
||||||
|
hasMomentumBar)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasRejectionBar ||
|
||||||
|
hasSwing)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(hasMomentumBar ||
|
||||||
|
hasSwing)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
(isBoxBreaked &&
|
||||||
|
(hasRequiredValidations ||
|
||||||
|
hasValidPressuredSwing))
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(isBoxRejected &&
|
||||||
|
(hasRequiredValidations ||
|
||||||
|
hasValidPressuredSwing))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
selectedBoxIDX = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
(isBullish
|
||||||
|
? zBar.open >= box.upper
|
||||||
|
: zBar.open <= box.lower) &&
|
||||||
|
IsValidIndex(selectedBoxIDX);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
appliedBox = supResBoxes[selectedBoxIDX];
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
ppBar.Clean();
|
||||||
|
Clean(supports);
|
||||||
|
Clean(resistances);
|
||||||
|
Clean(supResBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
ulong chartID = visionCycleHelper.mPOIDrawer.ChartIdentification();
|
||||||
|
int subWindow = visionCycleHelper.mPOIDrawer.SubWindowIdentification();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (pivot > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string name = "Pivot_" + symbol + ToString(period) + ToString(pivot) + "_";
|
||||||
|
CChartObjectHLine *iObj;
|
||||||
|
iObj = new CChartObjectHLine();
|
||||||
|
bool isCreated = iObj.Create(
|
||||||
|
chartID,
|
||||||
|
name,
|
||||||
|
subWindow,
|
||||||
|
pivot //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iObj.Color(clrLime);
|
||||||
|
mObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (point > 0)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string name = "Point_" + symbol + ToString(period) + ToString(pivot) + "_";
|
||||||
|
CChartObjectHLine *iObj;
|
||||||
|
iObj = new CChartObjectHLine();
|
||||||
|
bool isCreated = iObj.Create(
|
||||||
|
chartID,
|
||||||
|
name,
|
||||||
|
subWindow,
|
||||||
|
point //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iObj.Color(clrLime);
|
||||||
|
mObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -225,139 +225,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
// Setup Conditions ...
|
// Setup Conditions ...
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL decisionZBar;
|
|
||||||
XOHCL decisionCBar;
|
|
||||||
XOHCL decisionPBar;
|
|
||||||
double decisionCBarBullishZoneChechValue = 0;
|
|
||||||
double decisionCBarBearishZoneChechValue = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = decisionZBar.Init(
|
|
||||||
decisionState.symbol,
|
|
||||||
decisionState.period,
|
|
||||||
0 //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(visionPoiEvents);
|
|
||||||
Clean(analysePoiEvents);
|
|
||||||
Clean(decisionPoiEvents);
|
|
||||||
Clean(visionCycleEvents);
|
|
||||||
Clean(analyseCycleEvents);
|
|
||||||
Clean(decisionCycleEvents);
|
|
||||||
Clean(consolidationPoiEvents);
|
|
||||||
Clean(consolidationCycleEvents);
|
|
||||||
|
|
||||||
//
|
|
||||||
visionState.Clean();
|
|
||||||
analyseState.Clean();
|
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
|
||||||
visionConditions.Clean();
|
|
||||||
analyseConditions.Clean();
|
|
||||||
visionXConditions.Clean();
|
|
||||||
consolidationState.Clean();
|
|
||||||
decisionConditions.Clean();
|
|
||||||
analyseXConditions.Clean();
|
|
||||||
decisionXConditions.Clean();
|
|
||||||
consolidationConditions.Clean();
|
|
||||||
consolidationXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
mConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = decisionZBar
|
|
||||||
.GetPreviousBar(decisionCBar);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(visionPoiEvents);
|
|
||||||
Clean(analysePoiEvents);
|
|
||||||
Clean(decisionPoiEvents);
|
|
||||||
Clean(visionCycleEvents);
|
|
||||||
Clean(analyseCycleEvents);
|
|
||||||
Clean(decisionCycleEvents);
|
|
||||||
Clean(consolidationPoiEvents);
|
|
||||||
Clean(consolidationCycleEvents);
|
|
||||||
|
|
||||||
//
|
|
||||||
visionState.Clean();
|
|
||||||
analyseState.Clean();
|
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
|
||||||
visionConditions.Clean();
|
|
||||||
analyseConditions.Clean();
|
|
||||||
visionXConditions.Clean();
|
|
||||||
consolidationState.Clean();
|
|
||||||
decisionConditions.Clean();
|
|
||||||
analyseXConditions.Clean();
|
|
||||||
decisionXConditions.Clean();
|
|
||||||
consolidationConditions.Clean();
|
|
||||||
consolidationXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
mConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = decisionCBar
|
|
||||||
.GetPreviousBar(decisionPBar);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Clean(visionPoiEvents);
|
|
||||||
Clean(analysePoiEvents);
|
|
||||||
Clean(decisionPoiEvents);
|
|
||||||
Clean(visionCycleEvents);
|
|
||||||
Clean(analyseCycleEvents);
|
|
||||||
Clean(decisionCycleEvents);
|
|
||||||
Clean(consolidationPoiEvents);
|
|
||||||
Clean(consolidationCycleEvents);
|
|
||||||
|
|
||||||
//
|
|
||||||
visionState.Clean();
|
|
||||||
analyseState.Clean();
|
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
|
||||||
visionConditions.Clean();
|
|
||||||
analyseConditions.Clean();
|
|
||||||
visionXConditions.Clean();
|
|
||||||
consolidationState.Clean();
|
|
||||||
decisionConditions.Clean();
|
|
||||||
analyseXConditions.Clean();
|
|
||||||
decisionXConditions.Clean();
|
|
||||||
consolidationConditions.Clean();
|
|
||||||
consolidationXConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
mConditions.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
decisionCBarBullishZoneChechValue = decisionCBar
|
|
||||||
.GetZoneCheckValue(X_DIRECTION_BULLISH);
|
|
||||||
decisionCBarBearishZoneChechValue = decisionCBar
|
|
||||||
.GetZoneCheckValue(X_DIRECTION_BEARISH);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Working Zone ...
|
// Check Working Zone ...
|
||||||
bool hasWorkingZone = mConditions.HasWorkingZone();
|
bool hasWorkingZone = mConditions.HasWorkingZone();
|
||||||
@@ -389,9 +256,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
visionState.Clean();
|
visionState.Clean();
|
||||||
analyseState.Clean();
|
analyseState.Clean();
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
visionConditions.Clean();
|
visionConditions.Clean();
|
||||||
analyseConditions.Clean();
|
analyseConditions.Clean();
|
||||||
@@ -448,9 +312,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
visionState.Clean();
|
visionState.Clean();
|
||||||
analyseState.Clean();
|
analyseState.Clean();
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
visionConditions.Clean();
|
visionConditions.Clean();
|
||||||
analyseConditions.Clean();
|
analyseConditions.Clean();
|
||||||
@@ -500,9 +361,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
visionState.Clean();
|
visionState.Clean();
|
||||||
analyseState.Clean();
|
analyseState.Clean();
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
visionConditions.Clean();
|
visionConditions.Clean();
|
||||||
analyseConditions.Clean();
|
analyseConditions.Clean();
|
||||||
@@ -526,28 +384,11 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Start Zones ...
|
bool hasStartZone = mConditions.DetectStartZones(
|
||||||
bool hasStartZone = mConditions.HasStartZones();
|
trend,
|
||||||
if (!hasStartZone)
|
analyseState,
|
||||||
{
|
decisionCycleHelper //
|
||||||
//
|
);
|
||||||
hasStartZone = mConditions.DetectStartZones(
|
|
||||||
trend,
|
|
||||||
analyseState,
|
|
||||||
decisionCycleHelper //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasStartZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mConditions.UpdateTo(cTime);
|
|
||||||
DrawConditions(
|
|
||||||
mConditions,
|
|
||||||
visionCycleHelper.mPOIDrawer //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
mConditions.UpdateTo(cTime);
|
mConditions.UpdateTo(cTime);
|
||||||
@@ -586,93 +427,59 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
// - What we looking for: Long or Short ...
|
// - What we looking for: Long or Short ...
|
||||||
// - Priority ...
|
// - Priority ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double pivot = 0;
|
||||||
|
double point = 0;
|
||||||
|
ENUM_X_DIRECTION conditionsDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Start Zone Conditions ...
|
||||||
|
bool hasConditions = mConditions
|
||||||
|
.HasConditions(
|
||||||
|
pivot,
|
||||||
|
point,
|
||||||
|
conditionsDir,
|
||||||
|
decisionState,
|
||||||
|
zIndex,
|
||||||
|
decisionState.period //
|
||||||
|
);
|
||||||
|
result = hasConditions;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(visionPoiEvents);
|
||||||
|
Clean(analysePoiEvents);
|
||||||
|
Clean(decisionPoiEvents);
|
||||||
|
Clean(visionCycleEvents);
|
||||||
|
Clean(analyseCycleEvents);
|
||||||
|
Clean(decisionCycleEvents);
|
||||||
|
Clean(consolidationPoiEvents);
|
||||||
|
Clean(consolidationCycleEvents);
|
||||||
|
|
||||||
|
//
|
||||||
|
visionState.Clean();
|
||||||
|
analyseState.Clean();
|
||||||
|
decisionState.Clean();
|
||||||
|
visionConditions.Clean();
|
||||||
|
analyseConditions.Clean();
|
||||||
|
visionXConditions.Clean();
|
||||||
|
consolidationState.Clean();
|
||||||
|
decisionConditions.Clean();
|
||||||
|
analyseXConditions.Clean();
|
||||||
|
decisionXConditions.Clean();
|
||||||
|
consolidationConditions.Clean();
|
||||||
|
consolidationXConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
DrawConditions(
|
DrawConditions(
|
||||||
mConditions,
|
mConditions,
|
||||||
visionCycleHelper.mPOIDrawer //
|
visionCycleHelper.mPOIDrawer //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
double pivot = 0;
|
|
||||||
double point = 0;
|
|
||||||
bool hasCondition = false;
|
|
||||||
ENUM_X_DIRECTION conditionsDir = X_DIRECTION_NONE;
|
|
||||||
//
|
|
||||||
// Detect Start Zone Conditions ...
|
|
||||||
hasCondition = mConditions
|
|
||||||
.HasConditions(
|
|
||||||
conditionsDir,
|
|
||||||
decisionState,
|
|
||||||
zIndex,
|
|
||||||
decisionState.period //
|
|
||||||
);
|
|
||||||
if (hasCondition)
|
|
||||||
{
|
|
||||||
// //
|
|
||||||
// XBoxZone startZoneBox;
|
|
||||||
// bool hasBox = mConditions.startZone.AsBox(startZoneBox);
|
|
||||||
// if (hasBox)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// bool isBullish = IsBullish(conditionsDir);
|
|
||||||
|
|
||||||
// //
|
|
||||||
// pivot =
|
|
||||||
// isBullish
|
|
||||||
// ? startZoneBox.lower
|
|
||||||
// : startZoneBox.upper;
|
|
||||||
|
|
||||||
// //
|
|
||||||
// point =
|
|
||||||
// isBullish
|
|
||||||
// ? startZoneBox.upper
|
|
||||||
// : startZoneBox.lower;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// //
|
|
||||||
// // Detect Supply and Deman Zone Based Conditions ...
|
|
||||||
// if (!hasCondition)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// bool isPriceInsideSupplyZone =
|
|
||||||
// bearishPriority == X121SMC_XWZ_PRIORITY_STRONG_HIGH;
|
|
||||||
|
|
||||||
// //
|
|
||||||
// bool isPriceInsideDemandZone =
|
|
||||||
// bullishPriority == X121SMC_XWZ_PRIORITY_STRONG_HIGH;
|
|
||||||
|
|
||||||
// //
|
|
||||||
// bool isPriceInsideSupDem = isPriceInsideSupplyZone ||
|
|
||||||
// isPriceInsideDemandZone;
|
|
||||||
// if (isPriceInsideSupDem)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// hasCondition = mConditions.HasWorkingZoneConditions(
|
|
||||||
// conditionsDir,
|
|
||||||
// decisionState //
|
|
||||||
// );
|
|
||||||
|
|
||||||
// //
|
|
||||||
// if (hasCondition)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// if (IsBullish(conditionsDir))
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// pivot = mConditions.demandZone.Lower();
|
|
||||||
// point = mConditions.demandZone.Upper();
|
|
||||||
// }
|
|
||||||
// else if (IsBearish(conditionsDir))
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// pivot = mConditions.supplyZone.Upper();
|
|
||||||
// point = mConditions.supplyZone.Lower();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullish = IsBullish(conditionsDir);
|
isBullish = IsBullish(conditionsDir);
|
||||||
isBearish = IsBearish(conditionsDir);
|
isBearish = IsBearish(conditionsDir);
|
||||||
@@ -690,6 +497,52 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
amountPercent //
|
amountPercent //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Apply Traget ...
|
||||||
|
switch (priority)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
||||||
|
//
|
||||||
|
target =
|
||||||
|
isBullish
|
||||||
|
? mConditions.workingZone.quarter3
|
||||||
|
: mConditions.workingZone.quarter1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||||
|
//
|
||||||
|
target =
|
||||||
|
isBullish
|
||||||
|
? mConditions.workingZone.quarter3
|
||||||
|
: mConditions.workingZone.quarter1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X121SMC_XWZ_PRIORITY_REGULAR:
|
||||||
|
//
|
||||||
|
target =
|
||||||
|
isBullish
|
||||||
|
? mConditions.workingZone.quarter2
|
||||||
|
: mConditions.workingZone.quarter2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X121SMC_XWZ_PRIORITY_LOW:
|
||||||
|
//
|
||||||
|
target =
|
||||||
|
isBullish
|
||||||
|
? mConditions.workingZone.quarter1
|
||||||
|
: mConditions.workingZone.quarter3;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
default:
|
||||||
|
target = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasLastBullishConsolidationZone = false;
|
bool hasLastBullishConsolidationZone = false;
|
||||||
bool hasLastBearishConsolidationZone = false;
|
bool hasLastBearishConsolidationZone = false;
|
||||||
@@ -699,6 +552,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
XConsolidationZone lastBearishConsolidationZone;
|
XConsolidationZone lastBearishConsolidationZone;
|
||||||
XConsolidationZone prevBullishConsolidationZone;
|
XConsolidationZone prevBullishConsolidationZone;
|
||||||
XConsolidationZone prevBearishConsolidationZone;
|
XConsolidationZone prevBearishConsolidationZone;
|
||||||
|
bool isLastBullishConsolidationZoneInsidePivot = false;
|
||||||
|
bool isPrevBullishConsolidationZoneInsidePivot = false;
|
||||||
|
bool isLastBearishConsolidationZoneInsidePivot = false;
|
||||||
|
bool isPrevBearishConsolidationZoneInsidePivot = false;
|
||||||
bool hasConsolidationZones = decisionCycleHelper.HasConsolidationZones();
|
bool hasConsolidationZones = decisionCycleHelper.HasConsolidationZones();
|
||||||
if (hasConsolidationZones)
|
if (hasConsolidationZones)
|
||||||
{
|
{
|
||||||
@@ -747,6 +604,38 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
hasLastBearishConsolidationZone = lastBearishConsolidationZone.IsValid();
|
hasLastBearishConsolidationZone = lastBearishConsolidationZone.IsValid();
|
||||||
hasPrevBullishConsolidationZone = prevBullishConsolidationZone.IsValid();
|
hasPrevBullishConsolidationZone = prevBullishConsolidationZone.IsValid();
|
||||||
hasPrevBearishConsolidationZone = prevBearishConsolidationZone.IsValid();
|
hasPrevBearishConsolidationZone = prevBearishConsolidationZone.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
isLastBullishConsolidationZoneInsidePivot =
|
||||||
|
//
|
||||||
|
hasLastBullishConsolidationZone &&
|
||||||
|
(lastBullishConsolidationZone.lower < point &&
|
||||||
|
lastBullishConsolidationZone.upper > pivot)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
isPrevBullishConsolidationZoneInsidePivot =
|
||||||
|
//
|
||||||
|
hasPrevBullishConsolidationZone &&
|
||||||
|
(prevBullishConsolidationZone.lower < point &&
|
||||||
|
prevBullishConsolidationZone.upper > pivot)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isLastBearishConsolidationZoneInsidePivot =
|
||||||
|
//
|
||||||
|
hasLastBearishConsolidationZone &&
|
||||||
|
(lastBearishConsolidationZone.upper > point &&
|
||||||
|
lastBearishConsolidationZone.lower < pivot)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
isPrevBearishConsolidationZoneInsidePivot =
|
||||||
|
//
|
||||||
|
hasPrevBearishConsolidationZone &&
|
||||||
|
(prevBearishConsolidationZone.upper > point &&
|
||||||
|
prevBearishConsolidationZone.lower < pivot)
|
||||||
|
//
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -823,15 +712,26 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
bool isConsolidationZonePassed =
|
bool isConsolidationZonePassed =
|
||||||
isBullish
|
isBullish
|
||||||
|
//
|
||||||
? (point > 0 &&
|
? (point > 0 &&
|
||||||
|
pivot > 0 &&
|
||||||
|
pivot < point &&
|
||||||
hasPrevBullishConsolidationZone &&
|
hasPrevBullishConsolidationZone &&
|
||||||
point >= prevBullishConsolidationZone.upper)
|
point > prevBullishConsolidationZone.upper &&
|
||||||
|
(isLastBullishConsolidationZoneInsidePivot ||
|
||||||
|
isPrevBullishConsolidationZoneInsidePivot))
|
||||||
: (point > 0 &&
|
: (point > 0 &&
|
||||||
|
pivot > 0 &&
|
||||||
|
pivot > point &&
|
||||||
hasPrevBearishConsolidationZone &&
|
hasPrevBearishConsolidationZone &&
|
||||||
point <= prevBearishConsolidationZone.lower);
|
point < prevBearishConsolidationZone.lower &&
|
||||||
|
(isLastBearishConsolidationZoneInsidePivot ||
|
||||||
|
isPrevBearishConsolidationZoneInsidePivot))
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = hasCondition &&
|
result = hasConditions &&
|
||||||
hasRewardAmount &&
|
hasRewardAmount &&
|
||||||
isPriorityPassed &&
|
isPriorityPassed &&
|
||||||
trend == conditionsDir &&
|
trend == conditionsDir &&
|
||||||
@@ -851,9 +751,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
visionState.Clean();
|
visionState.Clean();
|
||||||
analyseState.Clean();
|
analyseState.Clean();
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
visionConditions.Clean();
|
visionConditions.Clean();
|
||||||
analyseConditions.Clean();
|
analyseConditions.Clean();
|
||||||
@@ -878,52 +775,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Apply Traget ...
|
|
||||||
switch (priority)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
|
||||||
//
|
|
||||||
target =
|
|
||||||
isBullish
|
|
||||||
? mConditions.workingZone.quarter3
|
|
||||||
: mConditions.workingZone.quarter1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
|
||||||
//
|
|
||||||
target =
|
|
||||||
isBullish
|
|
||||||
? mConditions.workingZone.quarter3
|
|
||||||
: mConditions.workingZone.quarter1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_REGULAR:
|
|
||||||
//
|
|
||||||
target =
|
|
||||||
isBullish
|
|
||||||
? mConditions.workingZone.quarter2
|
|
||||||
: mConditions.workingZone.quarter2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_LOW:
|
|
||||||
//
|
|
||||||
target =
|
|
||||||
isBullish
|
|
||||||
? mConditions.workingZone.quarter1
|
|
||||||
: mConditions.workingZone.quarter3;
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
default:
|
|
||||||
target = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
mConditions.pivot = pivot;
|
mConditions.pivot = pivot;
|
||||||
mConditions.point = point;
|
mConditions.point = point;
|
||||||
@@ -956,9 +807,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
visionState.Clean();
|
visionState.Clean();
|
||||||
analyseState.Clean();
|
analyseState.Clean();
|
||||||
decisionZBar.Clean();
|
|
||||||
decisionCBar.Clean();
|
|
||||||
decisionPBar.Clean();
|
|
||||||
decisionState.Clean();
|
decisionState.Clean();
|
||||||
visionConditions.Clean();
|
visionConditions.Clean();
|
||||||
analyseConditions.Clean();
|
analyseConditions.Clean();
|
||||||
@@ -1148,18 +996,16 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
isBullish =
|
isBullish =
|
||||||
//
|
//
|
||||||
isBullish
|
isBullish &&
|
||||||
// &&
|
isPointBreaked
|
||||||
// isPointBreaked
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
isBearish =
|
isBearish =
|
||||||
//
|
//
|
||||||
isBearish
|
isBearish &&
|
||||||
// &&
|
isPointBreaked
|
||||||
// isPointBreaked
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user