last ...
This commit is contained in:
@@ -183,6 +183,30 @@ class XCPOIDetector : public XCBaseAlert
|
||||
mSwingRange = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Pullback Range Validation ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int PullbackRange()
|
||||
{
|
||||
return mPullbackRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Pullback Range Validation ...
|
||||
*
|
||||
* @param value: int ...
|
||||
*/
|
||||
void PullbackRange(int value)
|
||||
{
|
||||
//
|
||||
value = NormalizeInt(value, 1);
|
||||
|
||||
//
|
||||
mPullbackRange = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Momentum Detecting Loopback ...
|
||||
*
|
||||
@@ -659,6 +683,9 @@ class XCPOIDetector : public XCBaseAlert
|
||||
SwingRange(7);
|
||||
MomentumLoopback(2);
|
||||
|
||||
//
|
||||
PullbackRange(3);
|
||||
|
||||
//
|
||||
MomentumLoopback(2);
|
||||
|
||||
@@ -775,6 +802,13 @@ class XCPOIDetector : public XCBaseAlert
|
||||
iEvent //
|
||||
);
|
||||
|
||||
//
|
||||
// Pullback ...
|
||||
DetetctPullback(
|
||||
iBar,
|
||||
iEvent //
|
||||
);
|
||||
|
||||
//
|
||||
// Consolidation Zone ...
|
||||
DetectConsolidationZone(
|
||||
@@ -955,6 +989,21 @@ class XCPOIDetector : public XCBaseAlert
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Pullback ...
|
||||
has = DetetctPullback(
|
||||
iBar,
|
||||
iEvent //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iEvent,
|
||||
events //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Consolidation Zone ...
|
||||
has = DetectConsolidationZone(
|
||||
@@ -1139,6 +1188,27 @@ class XCPOIDetector : public XCBaseAlert
|
||||
state.swingHighs //
|
||||
);
|
||||
|
||||
//
|
||||
// Pullbacks ...
|
||||
|
||||
//
|
||||
Copy(
|
||||
mPullbacks,
|
||||
state.pullbacks //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
mBullishPullbacks,
|
||||
state.bullishPullbacks //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
mBearishPullbacks,
|
||||
state.bearishPullbacks //
|
||||
);
|
||||
|
||||
//
|
||||
// Momentums ...
|
||||
|
||||
@@ -1802,6 +1872,167 @@ class XCPOIDetector : public XCBaseAlert
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Pullback ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param state: ENUM_XPOI_EVENTS member ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetetctPullback(
|
||||
XOHCL &bar,
|
||||
ENUM_XPOI_EVENTS &state //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
state = X_POI_EVENT_NONE;
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL sBar;
|
||||
if (bar.Index() == 0)
|
||||
{
|
||||
//
|
||||
result = sBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
bar.Index() + 1 //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
sBar.Clean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sBar = bar;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION iDir;
|
||||
result = mBarAnalyser.IsPullback(
|
||||
sBar,
|
||||
iDir,
|
||||
mPullbackRange,
|
||||
true // Force Body ...
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
sBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = IsBullish(iDir);
|
||||
bool isBearish = IsBearish(iDir);
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
sBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL fromBar;
|
||||
result = fromBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
sBar.Index() + mPullbackRange //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
fromBar.Clean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone box;
|
||||
|
||||
//
|
||||
box.dir = iDir;
|
||||
box.to = sBar.time;
|
||||
box.from = fromBar.time;
|
||||
box.symbol = fromBar.symbol;
|
||||
box.period = fromBar.period;
|
||||
box.type = ToString(iDir) + "_XPullBK" + box.symbol + "_" + ToString(box.period);
|
||||
|
||||
//
|
||||
box.upper =
|
||||
isBullish
|
||||
? sBar.high
|
||||
: fromBar.high;
|
||||
|
||||
//
|
||||
box.lower =
|
||||
isBullish
|
||||
? fromBar.low
|
||||
: sBar.low;
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
box,
|
||||
mPullbacks //
|
||||
);
|
||||
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
box,
|
||||
mBullishPullbacks //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
if (isBearish)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
box,
|
||||
mBearishPullbacks //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
state =
|
||||
isBullish
|
||||
? X_BULLISH_PULLBACK_DETECTED
|
||||
: X_BEARISH_PULLBACK_DETECTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
sBar.Clean();
|
||||
fromBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Consolidation Zones ...
|
||||
*
|
||||
@@ -3093,6 +3324,13 @@ class XCPOIDetector : public XCBaseAlert
|
||||
XCSwing *mSwingHighs[]; // Holds Founded Swing Highs ...
|
||||
int mSwingRange; // Swing Detection Range ...
|
||||
|
||||
//
|
||||
// Pullbacks ...
|
||||
XBoxZone mPullbacks[]; // Holds Founded Pullbacks ...
|
||||
XBoxZone mBullishPullbacks[]; // Holds Founded Bullish Pullbacks ...
|
||||
XBoxZone mBearishPullbacks[]; // Holds Founded Bearish Pullbacks ...
|
||||
int mPullbackRange; // Pullback Detection Range ...
|
||||
|
||||
//
|
||||
// Momentums ...
|
||||
XCMomentumBar *mMomentums[]; // Holds Founded Momentum Bars ...
|
||||
|
||||
@@ -3355,6 +3355,7 @@ class XCPOIDrawer : public XCBase
|
||||
bool ignoreSupportZones = false,
|
||||
bool ignoreBullishSharps = false,
|
||||
bool ignoreBullishSpikes = false,
|
||||
bool ignoreBullishPullbacks = false,
|
||||
bool ignoreBullishMomentums = false,
|
||||
bool ignoreBullishRejections = false,
|
||||
bool ignoreBullishOrderBlocks = false,
|
||||
@@ -3367,6 +3368,7 @@ class XCPOIDrawer : public XCBase
|
||||
bool ignoreResistanceZones = false,
|
||||
bool ignoreBearishSharps = false,
|
||||
bool ignoreBearishSpikes = false,
|
||||
bool ignoreBearishPullbacks = false,
|
||||
bool ignoreBearishMomentums = false,
|
||||
bool ignoreBearishRejections = false,
|
||||
bool ignoreBearishOrderBlocks = false,
|
||||
@@ -3856,6 +3858,67 @@ class XCPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Pullbacks ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (!ignoreBullishPullbacks)
|
||||
{
|
||||
//
|
||||
int count = state.CountBullishPullbacks();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bullishPullbacks[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (!ignoreBearishPullbacks)
|
||||
{
|
||||
//
|
||||
int count = state.CountBearishPullbacks();
|
||||
if (IsValidSize(count))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
bool isCreated = DrawBox(
|
||||
state.bearishPullbacks[i],
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Consolidation Zones ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user