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