last ...
This commit is contained in:
@@ -988,6 +988,29 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
return result;
|
||||
}
|
||||
|
||||
// #region Swings/OrderFlow ...
|
||||
//
|
||||
// Swings ...
|
||||
XBoxZone swingLow;
|
||||
XBoxZone swingHigh;
|
||||
bool hasSwings = poiDetector.DetectRecentSwings(
|
||||
swingHigh,
|
||||
swingLow,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// Order Flow ...
|
||||
|
||||
//
|
||||
XBoxZone bullishOrderFlow[];
|
||||
result = poiDetector.HasOrderFlow(bullishOrderFlow, barIndex, 4, X_DIRECTION_BULLISH, 15);
|
||||
|
||||
//
|
||||
XBoxZone bearishOrderFlow[];
|
||||
result = poiDetector.HasOrderFlow(bearishOrderFlow, barIndex, 4, X_DIRECTION_BEARISH, 15);
|
||||
// #endregion
|
||||
|
||||
// #region Reading Conditions and Scoring ...
|
||||
//
|
||||
// ATR ...
|
||||
@@ -1150,24 +1173,96 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
// DebugBreak();
|
||||
}
|
||||
// Select Operational Zone ...
|
||||
ENUM_X_DIRECTION patternsDir[];
|
||||
ENUM_X_BAR_PATTERN patterns[];
|
||||
|
||||
//
|
||||
// Select Operational Zone ...
|
||||
GetAllBarPatters(patterns, patternsDir);
|
||||
|
||||
//
|
||||
// XAUUSD ...
|
||||
|
||||
// //
|
||||
// // FVG ...
|
||||
// Add(X_BAR_PATTERN_FVG, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
// //
|
||||
// // Piercing ...
|
||||
// Add(X_BAR_PATTERN_PIERCING, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
//
|
||||
// EURUSD ...
|
||||
|
||||
//
|
||||
// Add(X_BAR_PATTERN_STAR, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
// //
|
||||
// Add(X_BAR_PATTERN_SUPPORT, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
// //
|
||||
// Add(X_BAR_PATTERN_RESISTANCE, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
//
|
||||
// Add(X_BAR_PATTERN_SIGNALKEY, patterns);
|
||||
// Add(X_DIRECTION_NONE, patternsDir);
|
||||
|
||||
//
|
||||
int nearestOrderFlowIDX = -1;
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Looking Bar Patterns to Detect Zone ...
|
||||
poiDetector.HasRecentPatternTouched(zone, iBar.close, barIndex, 5, 5, iBar.period, X_DIRECTION_BULLISH);
|
||||
isBullish =
|
||||
isBullish &&
|
||||
HasChild(bullishOrderFlow) &&
|
||||
poiDetector.HasNearZone(
|
||||
nearestOrderFlowIDX,
|
||||
iBar.close,
|
||||
5,
|
||||
bullishOrderFlow //
|
||||
) &&
|
||||
poiDetector.HasRecentPatternTouched(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
iBar.close,
|
||||
barIndex,
|
||||
5,
|
||||
5,
|
||||
iBar.period,
|
||||
X_DIRECTION_BULLISH //
|
||||
);
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
// Looking Bar Patterns to Detect Zone ...
|
||||
poiDetector.HasRecentPatternTouched(zone, iBar.close, barIndex, 5, 5, iBar.period, X_DIRECTION_BEARISH);
|
||||
isBearish =
|
||||
isBearish &&
|
||||
HasChild(bearishOrderFlow) &&
|
||||
poiDetector.HasNearZone(
|
||||
nearestOrderFlowIDX,
|
||||
iBar.close,
|
||||
5,
|
||||
bearishOrderFlow //
|
||||
) &&
|
||||
poiDetector.HasRecentPatternTouched(
|
||||
zone,
|
||||
patterns,
|
||||
patternsDir,
|
||||
iBar.close,
|
||||
barIndex,
|
||||
5,
|
||||
5,
|
||||
iBar.period,
|
||||
X_DIRECTION_BEARISH //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1293,13 +1388,45 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
}
|
||||
|
||||
//
|
||||
config.Clean();
|
||||
if (swingLow.IsValid())
|
||||
{
|
||||
//
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(swingLow, config);
|
||||
}
|
||||
|
||||
//
|
||||
if (swingHigh.IsValid())
|
||||
{
|
||||
//
|
||||
drawn++;
|
||||
poiDrawer.DrawZone(swingHigh, config);
|
||||
}
|
||||
|
||||
//
|
||||
if (HasChild(bullishOrderFlow))
|
||||
{
|
||||
//
|
||||
drawn += ArraySize(bullishOrderFlow);
|
||||
poiDrawer.DrawZones(bullishOrderFlow, config);
|
||||
}
|
||||
|
||||
//
|
||||
if (HasChild(bearishOrderFlow))
|
||||
{
|
||||
//
|
||||
drawn += ArraySize(bearishOrderFlow);
|
||||
poiDrawer.DrawZones(bearishOrderFlow, config);
|
||||
}
|
||||
|
||||
//
|
||||
if (drawn > 0)
|
||||
{
|
||||
// DebugBreak();
|
||||
}
|
||||
|
||||
//
|
||||
config.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1311,20 +1438,12 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
: X_DIRECTION_NONE;
|
||||
result = result &&
|
||||
HasDirection(dir);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Prepare Zone ...
|
||||
double entry = GetEntry(iBar.symbol, dir);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
// Prepare Zone ...
|
||||
double entry = GetEntry(iBar.symbol, dir);
|
||||
|
||||
//
|
||||
double upper = isBullish
|
||||
? entry
|
||||
@@ -1348,12 +1467,15 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
);
|
||||
}
|
||||
|
||||
// #region Preparing Target ...
|
||||
// #endregion
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
iBar.Clean();
|
||||
swingLow.Clean();
|
||||
XClean(patterns);
|
||||
swingHigh.Clean();
|
||||
XClean(patternsDir);
|
||||
XClean(bullishOrderFlow);
|
||||
XClean(bearishOrderFlow);
|
||||
|
||||
//
|
||||
result =
|
||||
@@ -1371,7 +1493,8 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool Strategy2HasSignal(
|
||||
bool
|
||||
Strategy2HasSignal(
|
||||
XOHCL &bar,
|
||||
XBoxZone &zone,
|
||||
XTarget &targets[],
|
||||
|
||||
@@ -1863,6 +1863,64 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
XClean(tmpResistances);
|
||||
}
|
||||
|
||||
bool HasStructure(
|
||||
int barIndex = 0,
|
||||
string forSymbol = NULL,
|
||||
ENUM_TIMEFRAMES forMinorPeriod = NULL,
|
||||
ENUM_TIMEFRAMES forMajorPeriod = NULL,
|
||||
int loopback = 50,
|
||||
int minorValidation = 7,
|
||||
int majorValidation = 14,
|
||||
int minimumRetests = 2,
|
||||
double retestThreshold = 10,
|
||||
int retestLoopback = 100 //
|
||||
)
|
||||
{
|
||||
//
|
||||
XBoxZone supports[];
|
||||
XBoxZone resistances[];
|
||||
XBoxZone minorSupport;
|
||||
XBoxZone majorSupport;
|
||||
XBoxZone minorResistance;
|
||||
XBoxZone majorResistance;
|
||||
|
||||
//
|
||||
GetCurrentStructure(
|
||||
supports,
|
||||
resistances,
|
||||
minorSupport,
|
||||
majorSupport,
|
||||
minorResistance,
|
||||
majorResistance,
|
||||
barIndex,
|
||||
forSymbol,
|
||||
forMinorPeriod,
|
||||
forMajorPeriod,
|
||||
loopback,
|
||||
minorValidation,
|
||||
majorValidation,
|
||||
minimumRetests,
|
||||
retestThreshold,
|
||||
retestLoopback //
|
||||
);
|
||||
|
||||
//
|
||||
bool result =
|
||||
majorSupport.IsValid() &&
|
||||
majorResistance.IsValid();
|
||||
|
||||
//
|
||||
XClean(supports);
|
||||
XClean(resistances);
|
||||
minorSupport.Clean();
|
||||
majorSupport.Clean();
|
||||
minorResistance.Clean();
|
||||
majorResistance.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
void RefineStructure(
|
||||
XBoxZone &supports[],
|
||||
XBoxZone &resistances[],
|
||||
@@ -2164,6 +2222,427 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
zone.from = zone.breakAt;
|
||||
}
|
||||
}
|
||||
|
||||
bool DetectRecentSwings(
|
||||
XBoxZone &swingHigh,
|
||||
XBoxZone &swingLow,
|
||||
int barIndex = 0,
|
||||
int swingsValidationLength = 50,
|
||||
int loopback = 500,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||
bool forceRefineZones = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
swingLow.Clean();
|
||||
swingHigh.Clean();
|
||||
|
||||
//
|
||||
loopback = NormalizeInt(loopback, 5);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
swingsValidationLength = NormalizeInt(swingsValidationLength, 5);
|
||||
if (!IsXValid(forPeriod))
|
||||
{
|
||||
forPeriod = period;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
int iIDX = -1;
|
||||
double low = 0;
|
||||
double high = 0;
|
||||
int lowIDX = -1;
|
||||
int highIDX = -1;
|
||||
bool has = false;
|
||||
double iValue = 0;
|
||||
datetime lowAt = NULL;
|
||||
datetime highAt = NULL;
|
||||
for (int i = barIndex; i < barIndex + loopback; i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, forPeriod, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
iIDX = iBar.FindLowestIndex(swingsValidationLength, MODE_LOW);
|
||||
has = IsValidIndex(iIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iValue = iLow(iBar.symbol, iBar.period, iIDX);
|
||||
|
||||
//
|
||||
// Check Can Set Low ...
|
||||
has = (!NotEmptyZero(low) ||
|
||||
(NotEmptyZero(low) && iValue < low)) &&
|
||||
IsValidSwing(
|
||||
iValue,
|
||||
iIDX,
|
||||
barIndex,
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
X_SWING_LOW //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
low = iValue;
|
||||
lowIDX = iIDX;
|
||||
lowAt = iBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iIDX = iBar.FindHighestIndex(swingsValidationLength, MODE_HIGH);
|
||||
has = IsValidIndex(iIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iValue = iHigh(iBar.symbol, iBar.period, iIDX);
|
||||
|
||||
//
|
||||
// Check Can Set High ...
|
||||
has = (!NotEmptyZero(high) ||
|
||||
(NotEmptyZero(high) && iValue > high)) &&
|
||||
IsValidSwing(
|
||||
iValue,
|
||||
iIDX,
|
||||
barIndex,
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
X_SWING_HIGH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
high = iValue;
|
||||
highIDX = iIDX;
|
||||
highAt = iBar.time;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Recent Low Swing ...
|
||||
has =
|
||||
IsXValid(lowAt) &&
|
||||
NotEmptyZero(low) &&
|
||||
IsValidIndex(lowIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, forPeriod, lowIDX);
|
||||
has = has &&
|
||||
swingLow.Init(
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
iBar.GetDown(),
|
||||
low,
|
||||
GetBarTime(iBar.symbol, iBar.period, lowIDX + swingsValidationLength - 1),
|
||||
GetBarTime(iBar.symbol, iBar.period, barIndex),
|
||||
X_DIRECTION_BULLISH,
|
||||
ToXString(X_BAR_PATTERN_LOW),
|
||||
lowAt //
|
||||
);
|
||||
if (has && forceRefineZones)
|
||||
{
|
||||
RefineZone(swingLow, 500, 5, X_PRICE_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Recent High Swing ...
|
||||
has =
|
||||
IsXValid(highAt) &&
|
||||
NotEmptyZero(high) &&
|
||||
IsValidIndex(highIDX);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(symbol, forPeriod, highIDX);
|
||||
has = has &&
|
||||
swingHigh.Init(
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
high,
|
||||
iBar.GetUp(),
|
||||
GetBarTime(iBar.symbol, iBar.period, lowIDX + swingsValidationLength - 1),
|
||||
GetBarTime(iBar.symbol, iBar.period, barIndex),
|
||||
X_DIRECTION_BEARISH,
|
||||
ToXString(X_BAR_PATTERN_HIGH),
|
||||
highAt //
|
||||
);
|
||||
if (has && forceRefineZones)
|
||||
{
|
||||
RefineZone(swingHigh, 500, 5, X_PRICE_CLOSE);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
bool result = swingLow.IsValid() &&
|
||||
swingHigh.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool HasOrderFlow(
|
||||
XBoxZone &flow[],
|
||||
int barIndex = 0,
|
||||
int flowValidationLength = 5,
|
||||
ENUM_X_DIRECTION flowDir = X_DIRECTION_NONE,
|
||||
int loopback = 50,
|
||||
string forSymbol = NULL,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||
ENUM_X_BOUNDARY_PRICE priceType = X_BOUNDARY_PRICE_HIGH_LOW //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XClean(flow);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result =
|
||||
IsXValid(priceType);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Normalizing Data ...
|
||||
if (!IsXValid(forSymbol))
|
||||
{
|
||||
forSymbol = symbol;
|
||||
}
|
||||
if (!IsXValid(forPeriod))
|
||||
{
|
||||
forPeriod = period;
|
||||
}
|
||||
loopback = NormalizeInt(loopback, 5);
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
flowValidationLength = NormalizeInt(flowValidationLength, 2);
|
||||
|
||||
//
|
||||
// Handle Works ...
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
int iIndex = -1;
|
||||
bool has = false;
|
||||
XBoxZone tmpZone;
|
||||
double iPrice = 0;
|
||||
ENUM_X_PRICE iPriceType;
|
||||
bool isBullish = !HasDirection(flowDir) || IsXBullish(flowDir);
|
||||
bool isBearish = !HasDirection(flowDir) || IsXBearish(flowDir);
|
||||
|
||||
//
|
||||
// Looping Reversal ...
|
||||
int start = barIndex + loopback;
|
||||
int end = barIndex;
|
||||
for (int i = start; i > end; i--)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(forSymbol, forPeriod, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check iBar is Low Swing ...
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
iPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_LOW
|
||||
: X_PRICE_DOWN;
|
||||
iPrice = iBar.GetPrice(iPriceType);
|
||||
has = iPrice == iBar.FindLowest(iIndex, flowValidationLength, iPriceType);
|
||||
has = has &&
|
||||
IsValidSwing(
|
||||
iPrice,
|
||||
iBar.Index(),
|
||||
barIndex,
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
X_SWING_LOW //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Flow Detected ...
|
||||
tmpZone.Clean();
|
||||
iPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_DOWN
|
||||
: X_PRICE_UP;
|
||||
has = tmpZone.Init(
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
iBar.GetPrice(iPriceType),
|
||||
iPrice,
|
||||
iBar.time,
|
||||
GetBarTime(iBar.symbol, iBar.period, barIndex),
|
||||
X_DIRECTION_BULLISH,
|
||||
ToXString(X_BAR_PATTERN_LOW) //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
tmpZone,
|
||||
flow //
|
||||
);
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check iBar is High Swing ...
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
iPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_HIGH
|
||||
: X_PRICE_UP;
|
||||
iPrice = iBar.GetPrice(iPriceType);
|
||||
has = iPrice == iBar.FindHighest(iIndex, flowValidationLength, iPriceType);
|
||||
has = has &&
|
||||
IsValidSwing(
|
||||
iPrice,
|
||||
iBar.Index(),
|
||||
barIndex,
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
X_SWING_HIGH //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Flow Detected ...
|
||||
tmpZone.Clean();
|
||||
iPriceType = priceType == X_BOUNDARY_PRICE_HIGH_LOW
|
||||
? X_PRICE_UP
|
||||
: X_PRICE_DOWN;
|
||||
has = tmpZone.Init(
|
||||
iBar.symbol,
|
||||
iBar.period,
|
||||
iPrice,
|
||||
iBar.GetPrice(iPriceType),
|
||||
iBar.time,
|
||||
GetBarTime(iBar.symbol, iBar.period, barIndex),
|
||||
X_DIRECTION_BEARISH,
|
||||
ToXString(X_BAR_PATTERN_HIGH) //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
AddIfNotExists(
|
||||
tmpZone,
|
||||
flow //
|
||||
);
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
tmpZone.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = HasChild(flow);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
bool IsValidSwing(
|
||||
double price,
|
||||
int swingIDX,
|
||||
int barIndex = 0,
|
||||
string forSymbol = NULL,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||
ENUM_X_SWING_TYPE swingType = X_SWING_NONE //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
NotEmptyZero(price) &&
|
||||
IsXValid(swingType) &&
|
||||
IsValidIndex(swingIDX) &&
|
||||
swingIDX >= barIndex;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
if (!IsXValid(forSymbol))
|
||||
{
|
||||
forSymbol = symbol;
|
||||
}
|
||||
if (!IsXValid(forPeriod))
|
||||
{
|
||||
forPeriod = period;
|
||||
}
|
||||
barIndex = kiParser.NormalizeBarIndex(barIndex);
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
for (int i = barIndex; i <= (swingIDX - barIndex); i++)
|
||||
{
|
||||
//
|
||||
has = iBar.Init(forSymbol, forPeriod, i);
|
||||
if (!has)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Price Break ...
|
||||
has =
|
||||
(swingType == X_SWING_LOW &&
|
||||
iBar.low < price) ||
|
||||
(swingType == X_SWING_HIGH &&
|
||||
iBar.high > price);
|
||||
if (has)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = !has && !iBar.IsValid();
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
// #endregion
|
||||
|
||||
// #region VolatilitySwitchedHigh ...
|
||||
@@ -2196,12 +2675,29 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
// #endregion
|
||||
|
||||
// #region Bar Patterns ...
|
||||
/*
|
||||
* Check Recently Pattern Zone is Touched or not ...
|
||||
*
|
||||
* @param zone: XBoxZone, Touched Zone ...
|
||||
* @param patterns: ENUM_X_BAR_PATTERN, Allowed to Check Patterns ...
|
||||
* @param patternsDir: ENUM_X_DIRECTION, Allowed Directions ...
|
||||
* @param price: double, a Price to Check Toch or Reject ...
|
||||
* @param barIndex: int, Bar Index to Start Checking ...
|
||||
* @param loopback: int, Loopback for Pattern Formations ...
|
||||
* @param threshold: double, threshold for Pattern touch ...
|
||||
* @param forPeriod: ENUM_TIMEFRAMES, Time Frame to Check Patterns ...
|
||||
* @param forDir: ENUM_X_DIRECTION, Directions for Pattern's Formation Check ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasRecentPatternTouched(
|
||||
XBoxZone &zone,
|
||||
ENUM_X_BAR_PATTERN &patterns[],
|
||||
ENUM_X_DIRECTION &patternsDir[],
|
||||
double price,
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
int threshold = 5,
|
||||
double threshold = 5,
|
||||
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE //
|
||||
)
|
||||
@@ -2214,7 +2710,11 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = NotEmptyZero(price);
|
||||
result =
|
||||
HasChild(patterns) &&
|
||||
NotEmptyZero(price) &&
|
||||
HasChild(patternsDir) &&
|
||||
ArraySize(patterns) == ArraySize(patternsDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
@@ -2244,7 +2744,21 @@ class XCX121XKIPOIDetector : public XCMarketPatternDetector
|
||||
//
|
||||
// Preparing Pattern Analysis Config ...
|
||||
iConfig.Default();
|
||||
iConfig.FullPattern();
|
||||
|
||||
//
|
||||
Copy(
|
||||
patterns,
|
||||
iConfig.allowedPatterns //
|
||||
);
|
||||
Copy(
|
||||
patternsDir,
|
||||
iConfig.allowedDirs //
|
||||
);
|
||||
|
||||
//
|
||||
// XAUUSD ...
|
||||
iConfig.AddPattern(X_BAR_PATTERN_FVG);
|
||||
iConfig.AddPattern(X_BAR_PATTERN_PIERCING);
|
||||
|
||||
//
|
||||
// Looping Back ...
|
||||
|
||||
Reference in New Issue
Block a user