refactor classes constructor and deconstructors ...
This commit is contained in:
@@ -274,6 +274,108 @@ class XCX121XKIHelperParser : XCBase
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
int CountKIFastTouches(
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
// Normalize ...
|
||||
loopback = NormalizeInt(loopback, 1);
|
||||
barIndex = NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
double affectedValue = 0;
|
||||
double iConfirnValue = 0;
|
||||
bool isBullish = !HasDirection(forDir) || IsXBullish(forDir);
|
||||
bool isBearish = !HasDirection(forDir) || IsXBearish(forDir);
|
||||
ENUM_X_PRICE bullishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bullishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
ENUM_X_PRICE bearishTouchUpperPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
ENUM_X_PRICE bearishTouchLowerPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, period, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
affectedValue = helper.GetKIFast(i);
|
||||
|
||||
//
|
||||
// Bullish Touches ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bullishTouchLowerPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bullishTouchUpperPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue <= affectedValue &&
|
||||
iConfirnValue >= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Touches ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iValue = iBar.GetPrice(bearishTouchUpperPriceType);
|
||||
iConfirnValue = iBar.GetPrice(bearishTouchLowerPriceType);
|
||||
has =
|
||||
NotEmptyZero(iValue) &&
|
||||
NotEmptyZero(affectedValue) &&
|
||||
NotEmptyZero(iConfirnValue) &&
|
||||
iValue >= affectedValue &&
|
||||
iConfirnValue <= affectedValue;
|
||||
if (has)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region KI Slow ...
|
||||
|
||||
@@ -989,6 +989,8 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone swingLow;
|
||||
XBoxZone swingHigh;
|
||||
ENUM_X_DIRECTION patternsDir[];
|
||||
ENUM_X_BAR_PATTERN patterns[];
|
||||
poiDetector.FillStrategy1Patterns(
|
||||
@@ -997,34 +999,7 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
);
|
||||
|
||||
//
|
||||
isBullish = poiDetector.HasRecentPatternRejected(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
barIndex,
|
||||
3, // Loopback ..
|
||||
iBar.period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (!isBullish)
|
||||
{
|
||||
//
|
||||
isBearish = poiDetector.HasRecentPatternRejected(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
barIndex,
|
||||
3, // Loopback ..
|
||||
iBar.period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
}
|
||||
|
||||
// #region Swings/OrderFlow ...
|
||||
//
|
||||
// Swings ...
|
||||
XBoxZone swingLow;
|
||||
XBoxZone swingHigh;
|
||||
// Reading Swings ...
|
||||
poiDetector.DetectRecentSwings(
|
||||
swingHigh,
|
||||
swingLow,
|
||||
@@ -1032,16 +1007,64 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
);
|
||||
|
||||
//
|
||||
// Order Flow ...
|
||||
// Reading Order Flow ...
|
||||
|
||||
//
|
||||
// Bullish Order Flow ...
|
||||
XBoxZone bullishOrderFlow[];
|
||||
int bullishOrderFlowRejectdIDX = -1;
|
||||
poiDetector.HasOrderFlow(bullishOrderFlow, barIndex, 4, X_DIRECTION_BULLISH, 15);
|
||||
|
||||
//
|
||||
// Bearish Order Flow ...
|
||||
XBoxZone bearishOrderFlow[];
|
||||
int bearishOrderFlowRejectdIDX = -1;
|
||||
poiDetector.HasOrderFlow(bearishOrderFlow, barIndex, 4, X_DIRECTION_BEARISH, 15);
|
||||
// #endregion
|
||||
|
||||
//
|
||||
// Base Conditions ...
|
||||
|
||||
//
|
||||
isBullish =
|
||||
IsTFBullishPattern(barIndex, PERIOD_M1) &&
|
||||
IsTFBullishPattern(barIndex, PERIOD_M5) &&
|
||||
IsTFBullishPattern(barIndex, iBar.period) &&
|
||||
HasRejected(
|
||||
bullishOrderFlowRejectdIDX,
|
||||
iBar,
|
||||
bullishOrderFlow //
|
||||
) &&
|
||||
poiDetector.HasRecentPatternRejected(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
barIndex,
|
||||
3, // Loopback ..
|
||||
iBar.period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
if (!isBullish)
|
||||
{
|
||||
//
|
||||
isBearish =
|
||||
IsTFBearishPattern(barIndex, PERIOD_M1) &&
|
||||
IsTFBearishPattern(barIndex, PERIOD_M5) &&
|
||||
IsTFBearishPattern(barIndex, iBar.period) &&
|
||||
HasRejected(
|
||||
bearishOrderFlowRejectdIDX,
|
||||
iBar,
|
||||
bearishOrderFlow //
|
||||
) &&
|
||||
poiDetector.HasRecentPatternRejected(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
barIndex,
|
||||
3, // Loopback ..
|
||||
iBar.period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Conditions ...
|
||||
|
||||
@@ -1267,7 +1267,7 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region Zone Detectors ...
|
||||
|
||||
Reference in New Issue
Block a user