last ...
This commit is contained in:
@@ -446,7 +446,8 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
* Initialize Instance ...
|
* Initialize Instance ...
|
||||||
*/
|
*/
|
||||||
void Init(
|
void Init(
|
||||||
int barIndex = 0 //
|
int barIndex = 0,
|
||||||
|
bool ignoreMaxAllowed = true //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -490,152 +491,87 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Swings ...
|
// Swings ...
|
||||||
bool lookupSwings = ArraySize(mSwingLows) < mMaxRequiredPOIs ||
|
|
||||||
ArraySize(mSwingHighs) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupSwings)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectSwing(
|
DetectSwing(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Momentum Bar ...
|
|
||||||
bool lookupMomentums = ArraySize(mBullishMomentumBars) < mMaxRequiredPOIs ||
|
|
||||||
ArraySize(mBearishMomentumBars) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupMomentums)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectMomentumBar(
|
|
||||||
iBar,
|
|
||||||
iEvent,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Rejection Bar ...
|
// Rejection Bar ...
|
||||||
bool lookupRejections = ArraySize(mBullishRejectionBars) < mMaxRequiredPOIs ||
|
|
||||||
ArraySize(mBearishRejectionBars) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupRejections)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectRejectionBar(
|
DetectRejectionBar(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
//
|
||||||
|
// Momentum Bar ...
|
||||||
|
DetectMomentumBar(
|
||||||
|
iBar,
|
||||||
|
iEvent,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Support ...
|
// Support ...
|
||||||
bool lookupSupports = ArraySize(mSupportZones) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupSupports)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectSupportZone(
|
DetectSupportZone(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Demand ...
|
// Demand ...
|
||||||
bool lookupDemands = ArraySize(mDemandZones) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupDemands)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectDemandZone(
|
DetectDemandZone(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Resistance ...
|
// Resistance ...
|
||||||
bool lookupResistance = ArraySize(mResistanceZones) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupResistance)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectResistanceZone(
|
DetectResistanceZone(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Supply ...
|
// Supply ...
|
||||||
bool lookupSupplies = ArraySize(mSupplyZones) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupSupplies)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectSupplyZone(
|
DetectSupplyZone(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// OrderBlock ...
|
// OrderBlock ...
|
||||||
bool lookupOrderBlocks = ArraySize(mBullishOrderBlocks) < mMaxRequiredPOIs ||
|
|
||||||
ArraySize(mBearishOrderBlocks) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupOrderBlocks)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectOrderBlock(
|
DetectOrderBlock(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// FairValueGap ...
|
// FairValueGap ...
|
||||||
bool lookupFairValeGaps = ArraySize(mBullishFairValueGaps) < mMaxRequiredPOIs ||
|
|
||||||
ArraySize(mBearishFairValueGaps) < mMaxRequiredPOIs;
|
|
||||||
if (has &&
|
|
||||||
lookupFairValeGaps)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
DetectFairValueGap(
|
DetectFairValueGap(
|
||||||
iBar,
|
iBar,
|
||||||
iEvent,
|
iEvent,
|
||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue =
|
canContinue =
|
||||||
has &&
|
has &&
|
||||||
(lookupSwings ||
|
index >= 0;
|
||||||
lookupMomentums ||
|
|
||||||
lookupRejections ||
|
|
||||||
lookupSupports ||
|
|
||||||
lookupDemands ||
|
|
||||||
lookupResistance ||
|
|
||||||
lookupSupplies ||
|
|
||||||
lookupOrderBlocks ||
|
|
||||||
lookupFairValeGaps);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ReverseCollections();
|
||||||
|
|
||||||
//
|
//
|
||||||
mLock = false;
|
mLock = false;
|
||||||
}
|
}
|
||||||
@@ -1267,7 +1203,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
Clean(mRejectionBars);
|
Clean(mRejectionBars);
|
||||||
Clean(mBullishRejectionBars);
|
Clean(mBullishRejectionBars);
|
||||||
Clean(mBearishRejectionBars);
|
Clean(mBearishRejectionBars);
|
||||||
Clean(mSupplyZones);
|
Clean(mSupportZones);
|
||||||
Clean(mDemandZones);
|
Clean(mDemandZones);
|
||||||
Clean(mSupplyZones);
|
Clean(mSupplyZones);
|
||||||
Clean(mResistanceZones);
|
Clean(mResistanceZones);
|
||||||
@@ -1279,6 +1215,31 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
Clean(mBearishOrderBlocks);
|
Clean(mBearishOrderBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ReverseCollections() {
|
||||||
|
//
|
||||||
|
ArrayReverse(mEventListeners);
|
||||||
|
ArrayReverse(mSwings);
|
||||||
|
ArrayReverse(mSwingLows);
|
||||||
|
ArrayReverse(mSwingHighs);
|
||||||
|
ArrayReverse(mMomentumBars);
|
||||||
|
ArrayReverse(mBullishMomentumBars);
|
||||||
|
ArrayReverse(mBearishMomentumBars);
|
||||||
|
ArrayReverse(mRejectionBars);
|
||||||
|
ArrayReverse(mBullishRejectionBars);
|
||||||
|
ArrayReverse(mBearishRejectionBars);
|
||||||
|
ArrayReverse(mSupportZones);
|
||||||
|
ArrayReverse(mDemandZones);
|
||||||
|
ArrayReverse(mSupplyZones);
|
||||||
|
ArrayReverse(mResistanceZones);
|
||||||
|
ArrayReverse(mFairValueGaps);
|
||||||
|
ArrayReverse(mBullishFairValueGaps);
|
||||||
|
ArrayReverse(mBearishFairValueGaps);
|
||||||
|
ArrayReverse(mOrderBlocks);
|
||||||
|
ArrayReverse(mBullishOrderBlocks);
|
||||||
|
ArrayReverse(mBearishOrderBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void CleanupUnusedCollections(
|
void CleanupUnusedCollections(
|
||||||
int maxAllowed = 0 //
|
int maxAllowed = 0 //
|
||||||
@@ -1355,7 +1316,7 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
CleanupArray(
|
CleanupArray(
|
||||||
mSupplyZones,
|
mSupportZones,
|
||||||
maxAllowed //
|
maxAllowed //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2043,6 +2004,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2058,7 +2022,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
supportBar.Clean();
|
supportBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
ZeroMemory(supportZone);
|
ZeroMemory(supportZone);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2094,7 +2057,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
supportBar.Clean();
|
supportBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2188,6 +2150,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2203,7 +2168,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
resistanceBar.Clean();
|
resistanceBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
ZeroMemory(resistanceZone);
|
ZeroMemory(resistanceZone);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2239,7 +2203,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
resistanceBar.Clean();
|
resistanceBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2336,6 +2299,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2351,7 +2317,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
supplyBar.Clean();
|
supplyBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
ZeroMemory(supplyZone);
|
ZeroMemory(supplyZone);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2387,7 +2352,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
supplyBar.Clean();
|
supplyBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2484,6 +2448,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2499,7 +2466,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
demandBar.Clean();
|
demandBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
ZeroMemory(demandZone);
|
ZeroMemory(demandZone);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2535,7 +2501,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
demandBar.Clean();
|
demandBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2633,6 +2598,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2645,7 +2613,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
obBar.Clean();
|
obBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
ZeroMemory(ob);
|
ZeroMemory(ob);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2741,7 +2708,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
|
|
||||||
//
|
//
|
||||||
obBar.Clean();
|
obBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2845,6 +2811,9 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
activationBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2859,7 +2828,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
ZeroMemory(fvg);
|
ZeroMemory(fvg);
|
||||||
fvgEndBar.Clean();
|
fvgEndBar.Clean();
|
||||||
fvgStartBar.Clean();
|
fvgStartBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -2955,7 +2923,6 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
//
|
//
|
||||||
fvgEndBar.Clean();
|
fvgEndBar.Clean();
|
||||||
fvgStartBar.Clean();
|
fvgStartBar.Clean();
|
||||||
activationBar.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -95,3 +95,121 @@
|
|||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Swings ...
|
||||||
|
// bool lookupSwings = ArraySize(mSwingLows) < mMaxRequiredPOIs ||
|
||||||
|
// ArraySize(mSwingHighs) < mMaxRequiredPOIs;
|
||||||
|
// lookupSwings =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupSwings;
|
||||||
|
// if (has &&
|
||||||
|
// lookupSwings)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Momentum Bar ...
|
||||||
|
// bool lookupMomentums = ArraySize(mBullishMomentumBars) < mMaxRequiredPOIs ||
|
||||||
|
// ArraySize(mBearishMomentumBars) < mMaxRequiredPOIs;
|
||||||
|
// lookupMomentums =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupMomentums;
|
||||||
|
// if (has &&
|
||||||
|
// lookupMomentums)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Rejection Bar ...
|
||||||
|
// bool lookupRejections = ArraySize(mBullishRejectionBars) < mMaxRequiredPOIs ||
|
||||||
|
// ArraySize(mBearishRejectionBars) < mMaxRequiredPOIs;
|
||||||
|
// lookupRejections =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupRejections;
|
||||||
|
// if (has &&
|
||||||
|
// lookupRejections)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Support ...
|
||||||
|
// bool lookupSupports = ArraySize(mSupportZones) < mMaxRequiredPOIs;
|
||||||
|
// lookupSupports =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupSupports;
|
||||||
|
// if (has &&
|
||||||
|
// lookupSupports)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Demand ...
|
||||||
|
// bool lookupDemands = ArraySize(mDemandZones) < mMaxRequiredPOIs;
|
||||||
|
// lookupDemands =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupDemands;
|
||||||
|
// if (has &&
|
||||||
|
// lookupDemands)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Resistance ...
|
||||||
|
// bool lookupResistance = ArraySize(mResistanceZones) < mMaxRequiredPOIs;
|
||||||
|
// lookupResistance =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupResistance;
|
||||||
|
// if (has &&
|
||||||
|
// lookupResistance)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Supply ...
|
||||||
|
// bool lookupSupplies = ArraySize(mSupplyZones) < mMaxRequiredPOIs;
|
||||||
|
// lookupSupplies =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupSupplies;
|
||||||
|
// if (has &&
|
||||||
|
// lookupSupplies)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // OrderBlock ...
|
||||||
|
// bool lookupOrderBlocks = ArraySize(mBullishOrderBlocks) < mMaxRequiredPOIs ||
|
||||||
|
// ArraySize(mBearishOrderBlocks) < mMaxRequiredPOIs;
|
||||||
|
// lookupOrderBlocks =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupOrderBlocks;
|
||||||
|
// if (has &&
|
||||||
|
// lookupOrderBlocks)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // FairValueGap ...
|
||||||
|
// bool lookupFairValeGaps = ArraySize(mBullishFairValueGaps) < mMaxRequiredPOIs ||
|
||||||
|
// ArraySize(mBearishFairValueGaps) < mMaxRequiredPOIs;
|
||||||
|
// lookupFairValeGaps =
|
||||||
|
// ignoreMaxAllowed
|
||||||
|
// ? true
|
||||||
|
// : lookupFairValeGaps;
|
||||||
|
// if (has &&
|
||||||
|
// (lookupFairValeGaps))
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -300,6 +300,21 @@ struct XOBFVG
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IsSameAs(XOBFVG &item)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
IsSame(ob, item.ob) &&
|
||||||
|
IsSame(fvg, item.fvg);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void UpdateTo(datetime value = NULL)
|
void UpdateTo(datetime value = NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -306,9 +306,9 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
if (requiredPOIs < 10)
|
if (requiredPOIs < 0)
|
||||||
{
|
{
|
||||||
requiredPOIs = 10;
|
requiredPOIs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -322,6 +322,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
hasWorkingZone = workingZone.Init(
|
hasWorkingZone = workingZone.Init(
|
||||||
symbol,
|
symbol,
|
||||||
period,
|
period,
|
||||||
|
zIndex,
|
||||||
visionState,
|
visionState,
|
||||||
consolidationState,
|
consolidationState,
|
||||||
analyseState //
|
analyseState //
|
||||||
@@ -331,14 +332,35 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
if (hasWorkingZone)
|
if (hasWorkingZone)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
visionCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
|
||||||
|
analyseCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
|
||||||
|
decisionCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
|
||||||
|
consolidationCycleHelper.mPOIDetector.MaxRequiredPOIs(50);
|
||||||
|
|
||||||
|
//
|
||||||
|
visionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||||
|
analyseCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||||
|
decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||||
|
consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||||
|
|
||||||
//
|
//
|
||||||
workingZone.Update(
|
workingZone.Update(
|
||||||
|
zIndex,
|
||||||
visionState,
|
visionState,
|
||||||
consolidationState,
|
consolidationState,
|
||||||
analyseState //
|
analyseState //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasInsideZones = hasWorkingZone &&
|
||||||
|
workingZone.HasInsideZones();
|
||||||
|
if (hasInsideZones)
|
||||||
|
{
|
||||||
|
Print("Has Inside Zones");
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
UpdateTo(cTime);
|
UpdateTo(cTime);
|
||||||
|
|
||||||
@@ -348,7 +370,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
workingZone.Draw(
|
workingZone.Draw(
|
||||||
drawer,
|
drawer,
|
||||||
true // Force Clean ...
|
true, // Force Clean ...
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
XCResistanceZone *resistanceZones[];
|
XCResistanceZone *resistanceZones[];
|
||||||
|
|
||||||
//
|
//
|
||||||
|
XOBFVG insideZones[];
|
||||||
XOBFVG waitingZones[];
|
XOBFVG waitingZones[];
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -106,6 +107,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
Clean(demandZones);
|
Clean(demandZones);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Clean(insideZones);
|
||||||
Clean(waitingZones);
|
Clean(waitingZones);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -147,6 +149,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool Init(
|
bool Init(
|
||||||
string _symbol,
|
string _symbol,
|
||||||
ENUM_TIMEFRAMES _period,
|
ENUM_TIMEFRAMES _period,
|
||||||
|
int barIndex,
|
||||||
XPOIState &htfState,
|
XPOIState &htfState,
|
||||||
XPOIState &mtfState,
|
XPOIState &mtfState,
|
||||||
XPOIState &stfState //
|
XPOIState &stfState //
|
||||||
@@ -155,6 +158,12 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
@@ -184,6 +193,23 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
has = zBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
result = has;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
zBar.Clean();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
double ll5 = zBar.FindLowest(5, MODE_LOW);
|
||||||
|
double hh5 = zBar.FindHighest(5, MODE_HIGH);
|
||||||
|
zBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Supply Zone ...
|
// Supply Zone ...
|
||||||
has = HasSupplyZone();
|
has = HasSupplyZone();
|
||||||
@@ -194,7 +220,13 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
has = IsValidIndex(idx);
|
has = IsValidIndex(idx);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
supplyZone = htfState.supplyZones[idx];
|
supplyZone = htfState.supplyZones[idx];
|
||||||
|
has = hh5 < supplyZone.Lower();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
supplyZone = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +240,13 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
has = IsValidIndex(idx);
|
has = IsValidIndex(idx);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
demandZone = htfState.demandZones[idx];
|
demandZone = htfState.demandZones[idx];
|
||||||
|
has = ll5 > demandZone.Upper();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
demandZone = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,15 +369,23 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
|
|
||||||
//
|
//
|
||||||
void Update(
|
void Update(
|
||||||
|
int barIndex,
|
||||||
XPOIState &htfState,
|
XPOIState &htfState,
|
||||||
XPOIState &mtfState,
|
XPOIState &mtfState,
|
||||||
XPOIState &stfState //
|
XPOIState &stfState //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
int idx = -1;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (barIndex < 0)
|
||||||
|
{
|
||||||
|
barIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
//
|
//
|
||||||
@@ -354,75 +400,200 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
stfState.HasChild()
|
stfState.HasChild()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
XOHCL zBar;
|
||||||
//
|
has = zBar.Init(
|
||||||
// Supply Zones ...
|
symbol,
|
||||||
count = mtfState.FilterSupplyZones(
|
|
||||||
supplyZones,
|
|
||||||
NULL,
|
|
||||||
XZONE_STATE_PASSED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_IGNORED,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Demand Zones ...
|
|
||||||
count = mtfState.FilterDemandZones(
|
|
||||||
demandZones,
|
|
||||||
NULL,
|
|
||||||
XZONE_STATE_PASSED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_IGNORED,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Support Zones ...
|
|
||||||
count = stfState.FilterSupportZones(
|
|
||||||
supportZones,
|
|
||||||
period,
|
period,
|
||||||
XZONE_STATE_PASSED,
|
barIndex //
|
||||||
false,
|
);
|
||||||
XZONE_STATE_FAILED,
|
if (!has)
|
||||||
false,
|
{
|
||||||
XZONE_STATE_FAILED,
|
//
|
||||||
false,
|
zBar.Clean();
|
||||||
XZONE_STATE_IGNORED,
|
return;
|
||||||
false //
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
has = zBar.GetPreviousBar(cBar);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Supply Zones ...
|
||||||
|
// count = mtfState.FilterSupplyZones(
|
||||||
|
// supplyZones,
|
||||||
|
// NULL,
|
||||||
|
// XZONE_STATE_PASSED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_IGNORED,
|
||||||
|
// false //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Demand Zones ...
|
||||||
|
// count = mtfState.FilterDemandZones(
|
||||||
|
// demandZones,
|
||||||
|
// NULL,
|
||||||
|
// XZONE_STATE_PASSED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_IGNORED,
|
||||||
|
// false //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Support Zones ...
|
||||||
|
// count = stfState.FilterSupportZones(
|
||||||
|
// supportZones,
|
||||||
|
// period,
|
||||||
|
// XZONE_STATE_PASSED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_IGNORED,
|
||||||
|
// false //
|
||||||
|
// );
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Resistance Zones ...
|
||||||
|
// count = stfState.FilterResistanceZones(
|
||||||
|
// resistanceZones,
|
||||||
|
// period,
|
||||||
|
// XZONE_STATE_PASSED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_FAILED,
|
||||||
|
// false,
|
||||||
|
// XZONE_STATE_IGNORED,
|
||||||
|
// false //
|
||||||
|
// );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect price Inside Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
has = HasWaitingZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int mustRemove[];
|
||||||
|
count = CountWaitingZones();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOBFVG iOBFVG = waitingZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isInside =
|
||||||
|
//
|
||||||
|
zBar.high < iOBFVG.ob.Upper() &&
|
||||||
|
zBar.low > iOBFVG.ob.Lower() &&
|
||||||
|
//
|
||||||
|
cBar.high < iOBFVG.ob.Upper() &&
|
||||||
|
cBar.low > iOBFVG.ob.Lower()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (isInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
i,
|
||||||
|
mustRemove //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Resistance Zones ...
|
AddRef(
|
||||||
count = stfState.FilterResistanceZones(
|
iOBFVG,
|
||||||
resistanceZones,
|
insideZones //
|
||||||
period,
|
|
||||||
XZONE_STATE_PASSED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_FAILED,
|
|
||||||
false,
|
|
||||||
XZONE_STATE_IGNORED,
|
|
||||||
false //
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
ExtractOBFVGs(
|
has = HasChild(mustRemove);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
count = ArraySize(mustRemove);
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayRemove(
|
||||||
waitingZones,
|
waitingZones,
|
||||||
|
mustRemove[i],
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOBFVG tmpWaitingZones[];
|
||||||
|
count = ExtractOBFVGs(
|
||||||
|
tmpWaitingZones,
|
||||||
mtfState,
|
mtfState,
|
||||||
stfState //
|
stfState //
|
||||||
);
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOBFVG iOBFVG = tmpWaitingZones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
idx = FindIndex(
|
||||||
|
iOBFVG,
|
||||||
|
waitingZones //
|
||||||
|
);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iOBFVG.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iOBFVG,
|
||||||
|
waitingZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iOBFVG.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -499,6 +670,18 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
return ArraySize(waitingZones);
|
return ArraySize(waitingZones);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasInsideZones()
|
||||||
|
{
|
||||||
|
return HasChild(insideZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CountInsideZones()
|
||||||
|
{
|
||||||
|
return ArraySize(insideZones);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -92,9 +92,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
void MaxAllowedRequiredPOIs(int value)
|
void MaxAllowedRequiredPOIs(int value)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
if (value < 10)
|
if (value < 0)
|
||||||
{
|
{
|
||||||
value = 10;
|
value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -708,7 +708,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
if (mMaxAllowedRequiredPOIs <= 0)
|
if (mMaxAllowedRequiredPOIs <= 0)
|
||||||
{
|
{
|
||||||
mMaxAllowedRequiredPOIs = 200;
|
mMaxAllowedRequiredPOIs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user