complete consolidation Zones ...
This commit is contained in:
@@ -211,7 +211,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool FillPrice(
|
int FillPrice(
|
||||||
double &prices[],
|
double &prices[],
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
int loopback = 14,
|
int loopback = 14,
|
||||||
@@ -219,7 +219,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
bool result = false;
|
int result = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(prices);
|
Clean(prices);
|
||||||
@@ -228,9 +228,9 @@ class XCBarAnalyser : public XCBase
|
|||||||
loopback = NormalizeInt(loopback, 1);
|
loopback = NormalizeInt(loopback, 1);
|
||||||
|
|
||||||
//
|
//
|
||||||
result = IsValid(type) &&
|
bool has = IsValid(type) &&
|
||||||
bar.IsValid();
|
bar.IsValid();
|
||||||
if (!result)
|
if (!has)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -245,7 +245,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
int start = -1;
|
int start = -1;
|
||||||
int end = -1;
|
int end = -1;
|
||||||
int count = -1;
|
int count = -1;
|
||||||
result = CalculateLoopbackData(
|
has = CalculateLoopbackData(
|
||||||
index,
|
index,
|
||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
@@ -253,13 +253,13 @@ class XCBarAnalyser : public XCBase
|
|||||||
bar,
|
bar,
|
||||||
loopback //
|
loopback //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!has)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
for (int i = index; i < count; i++)
|
for (int i = start; i < end; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XOHCL iBar;
|
XOHCL iBar;
|
||||||
@@ -294,9 +294,11 @@ class XCBarAnalyser : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(prices) == count;
|
result = ArraySize(prices);
|
||||||
if (!result)
|
has = result == count;
|
||||||
|
if (!has)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
Clean(prices);
|
Clean(prices);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1994,19 +1996,44 @@ class XCBarAnalyser : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Bar Must Be Swing ...
|
XOHCL pBar;
|
||||||
result = IsSwing(
|
result = bar.GetPreviousBar(pBar);
|
||||||
bar,
|
|
||||||
dir //
|
|
||||||
);
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullish = IsBullish(dir);
|
bool isBullish =
|
||||||
bool isBearish = IsBearish(dir);
|
//
|
||||||
|
bar.low < pBar.low &&
|
||||||
|
bar.GetShadows() > bar.GetBody() &&
|
||||||
|
bar.GetLowShadow() > bar.GetBody() &&
|
||||||
|
bar.GetLowShadow() > bar.GetHighShadow()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
//
|
||||||
|
bar.high > pBar.high &&
|
||||||
|
bar.GetShadows() > bar.GetBody() &&
|
||||||
|
bar.GetHighShadow() > bar.GetBody() &&
|
||||||
|
bar.GetHighShadow() > bar.GetLowShadow()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Force Type ...
|
// Check Force Type ...
|
||||||
@@ -2021,6 +2048,16 @@ class XCBarAnalyser : public XCBase
|
|||||||
isBearish =
|
isBearish =
|
||||||
isBearish &&
|
isBearish &&
|
||||||
bar.IsBearish();
|
bar.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2032,7 +2069,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
HasFiboPressure(
|
HasFiboPressure(
|
||||||
bar,
|
bar,
|
||||||
X_DIRECTION_BULLISH,
|
X_DIRECTION_BULLISH,
|
||||||
X_FIBO_LEVEL_270 //
|
X_FIBO_LEVEL_236 //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2040,7 +2077,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
HasFiboPressure(
|
HasFiboPressure(
|
||||||
bar,
|
bar,
|
||||||
X_DIRECTION_BEARISH,
|
X_DIRECTION_BEARISH,
|
||||||
X_FIBO_LEVEL_270 //
|
X_FIBO_LEVEL_236 //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2057,11 +2094,18 @@ class XCBarAnalyser : public XCBase
|
|||||||
//
|
//
|
||||||
result = isBullish ||
|
result = isBullish ||
|
||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (result)
|
||||||
{
|
{
|
||||||
dir = X_DIRECTION_NONE;
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -2072,15 +2116,13 @@ class XCBarAnalyser : public XCBase
|
|||||||
* @param bar: XOHCL instance reference, Specified Bar to Check ...
|
* @param bar: XOHCL instance reference, Specified Bar to Check ...
|
||||||
* @param dir: ENUM_X_DIRECTION member, Specified Doji Direction ...
|
* @param dir: ENUM_X_DIRECTION member, Specified Doji Direction ...
|
||||||
* @param loopback: int, Specified Loopback ...
|
* @param loopback: int, Specified Loopback ...
|
||||||
* @param rangeExtendMultiplier: double, a Multiplier for Checking Price Range ...
|
|
||||||
*
|
*
|
||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool IsMomentum(
|
bool IsMomentum(
|
||||||
XOHCL &bar,
|
XOHCL &bar,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
int loopback = 2,
|
int loopback = 2 //
|
||||||
double rangeExtendMultiplier = 1.5 //
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -2089,7 +2131,6 @@ class XCBarAnalyser : public XCBase
|
|||||||
//
|
//
|
||||||
dir = X_DIRECTION_NONE;
|
dir = X_DIRECTION_NONE;
|
||||||
loopback = NormalizeInt(loopback, 1);
|
loopback = NormalizeInt(loopback, 1);
|
||||||
rangeExtendMultiplier = NormalizeDouble(rangeExtendMultiplier, 1);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = bar.IsValid();
|
result = bar.IsValid();
|
||||||
|
|||||||
@@ -207,30 +207,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
mMomentumLoopback = value;
|
mMomentumLoopback = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Momentum Detecting Range Extend Multiplier ...
|
|
||||||
*
|
|
||||||
* @return ( double )
|
|
||||||
*/
|
|
||||||
double MomentumRangeExtendMultiplier()
|
|
||||||
{
|
|
||||||
return mMomentumRangeExtendMultiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set Momentum Detecting Range Extend Multiplier ...
|
|
||||||
*
|
|
||||||
* @param value: double ...
|
|
||||||
*/
|
|
||||||
void MomentumRangeExtendMultiplier(double value)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
value = NormalizeDouble(value, 1.5);
|
|
||||||
|
|
||||||
//
|
|
||||||
mMomentumRangeExtendMultiplier = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Rejection Detecting Force Bar Type State ...
|
* Get Rejection Detecting Force Bar Type State ...
|
||||||
*
|
*
|
||||||
@@ -685,7 +661,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
MomentumLoopback(2);
|
MomentumLoopback(2);
|
||||||
MomentumRangeExtendMultiplier(1.5);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
RejectionForceBarType(true);
|
RejectionForceBarType(true);
|
||||||
@@ -795,17 +770,17 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Rejection ...
|
// Rejection ...
|
||||||
// DetectRejection(
|
DetectRejection(
|
||||||
// iBar,
|
iBar,
|
||||||
// iEvent //
|
iEvent //
|
||||||
// );
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Consolidation Zone ...
|
// Consolidation Zone ...
|
||||||
// DetectConsolidationZone(
|
DetectConsolidationZone(
|
||||||
// iBar,
|
iBar,
|
||||||
// iEvent //
|
iEvent //
|
||||||
// );
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Spike ...
|
// Spike ...
|
||||||
@@ -967,10 +942,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Rejection ...
|
// Rejection ...
|
||||||
// has = DetectRejection(
|
has = DetectRejection(
|
||||||
// iBar,
|
iBar,
|
||||||
// iEvent //
|
iEvent //
|
||||||
// );
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -982,10 +957,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Consolidation Zone ...
|
// Consolidation Zone ...
|
||||||
// has = DetectConsolidationZone(
|
has = DetectConsolidationZone(
|
||||||
// iBar,
|
iBar,
|
||||||
// iEvent //
|
iEvent //
|
||||||
// );
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1202,7 +1177,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
Copy(
|
Copy(
|
||||||
mBullishRejections,
|
mBearishRejections,
|
||||||
state.bearishRejections //
|
state.bearishRejections //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1597,8 +1572,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
result = mBarAnalyser.IsMomentum(
|
result = mBarAnalyser.IsMomentum(
|
||||||
sBar,
|
sBar,
|
||||||
iDir,
|
iDir,
|
||||||
mMomentumLoopback,
|
mMomentumLoopback //
|
||||||
mMomentumRangeExtendMultiplier //
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1714,10 +1688,32 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
return 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;
|
ENUM_X_DIRECTION iDir;
|
||||||
result = mBarAnalyser.IsRejected(
|
result = mBarAnalyser.IsRejected(
|
||||||
bar,
|
sBar,
|
||||||
iDir,
|
iDir,
|
||||||
mRejectionForceBarType,
|
mRejectionForceBarType,
|
||||||
mRejectionForceFiboPressure //
|
mRejectionForceFiboPressure //
|
||||||
@@ -1728,6 +1724,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
HasDirection(iDir);
|
HasDirection(iDir);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
sBar.Clean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1746,10 +1744,12 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
XCRejectionBar *rejection;
|
XCRejectionBar *rejection;
|
||||||
rejection = new XCRejectionBar();
|
rejection = new XCRejectionBar();
|
||||||
result = rejection.Init(
|
result = rejection.Init(
|
||||||
bar //
|
sBar //
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
sBar.Clean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1761,6 +1761,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
result = !IsValidIndex(idx);
|
result = !IsValidIndex(idx);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
sBar.Clean();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1819,10 +1821,32 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
state = X_POI_EVENT_NONE;
|
state = X_POI_EVENT_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XConsolidationZone cZone;
|
XConsolidationZone cZone;
|
||||||
result = mBarAnalyser.HasConsolidationZone(
|
result = mBarAnalyser.HasConsolidationZone(
|
||||||
bar,
|
sBar,
|
||||||
cZone,
|
cZone,
|
||||||
mConsolidationZoneMinLoopback,
|
mConsolidationZoneMinLoopback,
|
||||||
mConsolidationZoneRangeInPoint,
|
mConsolidationZoneRangeInPoint,
|
||||||
@@ -1832,6 +1856,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
sBar.Clean();
|
||||||
cZone.Clean();
|
cZone.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1854,6 +1879,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
sBar.Clean();
|
||||||
cZone.Clean();
|
cZone.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -3069,11 +3095,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Momentums ...
|
// Momentums ...
|
||||||
XCMomentumBar *mMomentums[]; // Holds Founded Momentum Bars ...
|
XCMomentumBar *mMomentums[]; // Holds Founded Momentum Bars ...
|
||||||
XCMomentumBar *mBullishMomentums[]; // Holds Founded Bullish Momentum Bars ...
|
XCMomentumBar *mBullishMomentums[]; // Holds Founded Bullish Momentum Bars ...
|
||||||
XCMomentumBar *mBearishMomentums[]; // Holds Founded Bearish Momentum Bars ...
|
XCMomentumBar *mBearishMomentums[]; // Holds Founded Bearish Momentum Bars ...
|
||||||
int mMomentumLoopback; // Momentum Detecting Loopback ...
|
int mMomentumLoopback; // Momentum Detecting Loopback ...
|
||||||
double mMomentumRangeExtendMultiplier; // Momentum Detecting Range Extend Multiplier ...
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rejections ...
|
// Rejections ...
|
||||||
|
|||||||
@@ -343,33 +343,33 @@ void DetectPOIState()
|
|||||||
//
|
//
|
||||||
// Bullish ...
|
// Bullish ...
|
||||||
showBullishPOIs && true, // SwingLows
|
showBullishPOIs && true, // SwingLows
|
||||||
showBullishPOIs && true, // DemandZones
|
showBullishPOIs && true, // DemandZones
|
||||||
showBullishPOIs && true, // SupportZones
|
showBullishPOIs && true, // SupportZones
|
||||||
showBullishPOIs && true, // BullishSharps
|
showBullishPOIs && true, // BullishSharps
|
||||||
showBullishPOIs && true, // BullishSpikes
|
showBullishPOIs && true, // BullishSpikes
|
||||||
showBullishPOIs && false, // BullishMomentums
|
showBullishPOIs && true, // BullishMomentums
|
||||||
showBullishPOIs && true, // BullishRejections
|
showBullishPOIs && true, // BullishRejections
|
||||||
showBullishPOIs && true, // BullishOrderBlocks
|
showBullishPOIs && true, // BullishOrderBlocks
|
||||||
showBullishPOIs && true, // BullishFairValueGaps
|
showBullishPOIs && true, // BullishFairValueGaps
|
||||||
showBullishPOIs && true, // BullishConsolidationZones
|
showBullishPOIs && true, // BullishConsolidationZones
|
||||||
//
|
//
|
||||||
// Bearish ...
|
// Bearish ...
|
||||||
showBearishPOIs && true, // SwingHighs
|
showBearishPOIs && true, // SwingHighs
|
||||||
showBearishPOIs && true, // SupplyZones
|
showBearishPOIs && true, // SupplyZones
|
||||||
showBearishPOIs && true, // BearishSharps
|
showBearishPOIs && true, // BearishSharps
|
||||||
showBearishPOIs && true, // BearishSpikes
|
showBearishPOIs && true, // BearishSpikes
|
||||||
showBearishPOIs && true, // ResistanceZones
|
showBearishPOIs && true, // ResistanceZones
|
||||||
showBearishPOIs && false, // BearishMomentums
|
showBearishPOIs && true, // BearishMomentums
|
||||||
showBearishPOIs && true, // BearishRejections
|
showBearishPOIs && true, // BearishRejections
|
||||||
showBearishPOIs && true, // BearishOrderBlocks
|
showBearishPOIs && true, // BearishOrderBlocks
|
||||||
showBearishPOIs && true, // BearishFairValueGaps
|
showBearishPOIs && true, // BearishFairValueGaps
|
||||||
showBearishPOIs && true // BearishConsolidationZones
|
showBearishPOIs && true // BearishConsolidationZones
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (poiEventNotifier.hasNewMomentum)
|
if (poiEventNotifier.hasNewConsolidationZone)
|
||||||
{
|
{
|
||||||
Print("Momentum ...");
|
Print("Consolidation ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user