last ...
This commit is contained in:
@@ -6075,6 +6075,14 @@ struct XOBFVG
|
||||
XCFVG *fvg;
|
||||
XCOrderBlock *ob;
|
||||
|
||||
//
|
||||
XCSupplyZone *supplyZones[];
|
||||
XCDemandZone *demandZones[];
|
||||
|
||||
//
|
||||
XCSupportZone *supportZones[];
|
||||
XCResistanceZone *resistanceZones[];
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XOBFVG()
|
||||
@@ -6114,12 +6122,64 @@ struct XOBFVG
|
||||
fvg.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSupplyZones()
|
||||
{
|
||||
return HasChild(supplyZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CountSupplyZones()
|
||||
{
|
||||
return ArraySize(supplyZones);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasDemandZones()
|
||||
{
|
||||
return HasChild(demandZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CountDemandZones()
|
||||
{
|
||||
return ArraySize(demandZones);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasSupportZones()
|
||||
{
|
||||
return HasChild(supportZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CountSupportZones()
|
||||
{
|
||||
return ArraySize(supportZones);
|
||||
}
|
||||
|
||||
//
|
||||
bool HasResistanceZones()
|
||||
{
|
||||
return HasChild(resistanceZones);
|
||||
}
|
||||
|
||||
//
|
||||
int CountResistanceZones()
|
||||
{
|
||||
return ArraySize(resistanceZones);
|
||||
}
|
||||
|
||||
//
|
||||
void UpdateTo(datetime value = NULL)
|
||||
{
|
||||
//
|
||||
value = NormalizeTime(value);
|
||||
|
||||
//
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
if (HasOB())
|
||||
{
|
||||
@@ -6131,6 +6191,58 @@ struct XOBFVG
|
||||
{
|
||||
fvg.To(value);
|
||||
}
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
has = HasSupplyZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountSupplyZones();
|
||||
for (int i = 0; count; i++)
|
||||
{
|
||||
supplyZones[i].To(value);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
has = HasDemandZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountDemandZones();
|
||||
for (int i = 0; count; i++)
|
||||
{
|
||||
demandZones[i].To(value);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Support Zones ...
|
||||
has = HasSupportZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountSupportZones();
|
||||
for (int i = 0; count; i++)
|
||||
{
|
||||
supportZones[i].To(value);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance Zones ...
|
||||
has = HasResistanceZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = CountResistanceZones();
|
||||
for (int i = 0; count; i++)
|
||||
{
|
||||
resistanceZones[i].To(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -8232,29 +8344,30 @@ int GetLowest(
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
int FilterZones(
|
||||
T *source,
|
||||
F *&dest[],
|
||||
bool filterDirection = true,
|
||||
bool filterFrom = true,
|
||||
bool filterPrice = true,
|
||||
bool forceStarteds = true,
|
||||
bool forceActivated = false,
|
||||
bool applySort = false,
|
||||
bool ignoreInside = true //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = -1;
|
||||
|
||||
//
|
||||
result = ArraySize(dest);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract XOBFVG Collection of Market ...
|
||||
*
|
||||
* @param htfState: Higher Time Frame POI State (Used For Detecting Order Blocks) ...
|
||||
* @param mtfState: Medium Time Frame POI State (Used For Detecting Fair Value Gaps) ...
|
||||
* @param stfState: Short Time Frame POI State (Used For Detecting Other POI(s)) ...
|
||||
* @param dest: Result Collection ...
|
||||
* @param forDir: Market Direction for Detecting POI(s) ...
|
||||
* @param forPeriod: Time Frame which Used for Zones actions (NULL for Default) ...
|
||||
* @param startState: Zones Start State ...
|
||||
* @param forceStartedBodyOut: Zones Started Bar's Body State ...
|
||||
* @param activeState: Zones Activation State ...
|
||||
* @param forceActivatedBodyIn: Zones Activated Bar's Body State ...
|
||||
* @param breakState: Zones Breaked State ...
|
||||
* @param forceBreakedBodyOut: Zone Breaker Bar's Body State ...
|
||||
* @param workState: Zones Worked State ...
|
||||
* @param forceWorkedBodyOut: Zones Worked Bar's Body State ...
|
||||
* @param applySort: Specify Applying Sorting on Collections ...
|
||||
* @param applyFromFilter: Filter Sorted Zones based on Occured Date ...
|
||||
* @param applyPlaceFilter: Filter Sorted Zones based on Occured Place ...
|
||||
* @param ignoreInside: Ignore Inside Sides of POI(s) Zones in Related to Order Block ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int ExtractOBFVGZones(
|
||||
XPOIState &htfState,
|
||||
XPOIState &mtfState,
|
||||
@@ -8284,8 +8397,7 @@ int ExtractOBFVGZones(
|
||||
bool applyFromFilter = true,
|
||||
bool applyPlaceFilter = true,
|
||||
//
|
||||
bool ignoreInside = true,
|
||||
bool forceFVGsInsideStart = true
|
||||
bool ignoreInside = true
|
||||
//
|
||||
)
|
||||
{
|
||||
@@ -8758,7 +8870,7 @@ int ExtractOBFVGZones(
|
||||
|
||||
//
|
||||
// Detecting FVG ...
|
||||
idx = -1;
|
||||
XCFVG *tmpWorkingFVGs[];
|
||||
for (int j = 0; j < ArraySize(tmpFVGs); j++)
|
||||
{
|
||||
//
|
||||
@@ -8791,11 +8903,19 @@ int ExtractOBFVGZones(
|
||||
ignoreInside //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInside = IsInsideDiff(
|
||||
jFVG,
|
||||
iOBFVG.ob,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
bool isPlacePassed =
|
||||
isBullish
|
||||
? isAbove
|
||||
: isBelow;
|
||||
isInside ||
|
||||
(isBullish
|
||||
? isAbove
|
||||
: isBelow);
|
||||
if (!isPlacePassed)
|
||||
{
|
||||
//
|
||||
@@ -8804,10 +8924,51 @@ int ExtractOBFVGZones(
|
||||
}
|
||||
|
||||
//
|
||||
idx = j;
|
||||
iOBFVG.fvg = jFVG;
|
||||
Add(
|
||||
jFVG,
|
||||
tmpWorkingFVGs //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
int fvgsCount = ArraySize(tmpWorkingFVGs);
|
||||
has = IsValidSize(fvgsCount);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
idx =
|
||||
isBullish
|
||||
? GetLowest(tmpWorkingFVGs)
|
||||
: GetHighest(tmpWorkingFVGs);
|
||||
|
||||
//
|
||||
if (IsValidIndex(idx))
|
||||
{
|
||||
//
|
||||
XCFVG *selectedFVG = tmpWorkingFVGs[idx];
|
||||
|
||||
//
|
||||
iOBFVG.fvg = selectedFVG;
|
||||
|
||||
//
|
||||
bool isExists = FindIndex(
|
||||
idx,
|
||||
selectedFVG,
|
||||
tmpFVGs //
|
||||
);
|
||||
if (isExists)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
tmpFVGs,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Clean(tmpWorkingFVGs);
|
||||
|
||||
//
|
||||
bool isFVGPassed = iOBFVG.HasFVG();
|
||||
if (!isFVGPassed)
|
||||
@@ -8817,21 +8978,6 @@ int ExtractOBFVGZones(
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Selected FVG from List ...
|
||||
if (IsValidIndex(idx))
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
tmpFVGs,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Detect Other POI(s) ...
|
||||
|
||||
//
|
||||
// Validate Model ...
|
||||
bool isValid = iOBFVG.IsValid();
|
||||
@@ -8859,6 +9005,201 @@ int ExtractOBFVGZones(
|
||||
Clean(tmpOBFVGs);
|
||||
}
|
||||
|
||||
//
|
||||
// Detecting Other POI(s) ...
|
||||
has = HasChild(dest);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = ArraySize(dest);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
// Supply Zones ...
|
||||
has = stfState.HasSupplyZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int j = 0; j < stfState.CountSupplyZones(); j++)
|
||||
{
|
||||
//
|
||||
bool isInsideOB = IsInsideDiff(
|
||||
stfState.supplyZones[j],
|
||||
dest[i].ob,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.supplyZones[j],
|
||||
dest[i].ob,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInsideFVG = IsInsideDiff(
|
||||
stfState.supplyZones[j],
|
||||
dest[i].fvg,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.supplyZones[j],
|
||||
dest[i].fvg,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInside = isInsideOB ||
|
||||
isInsideFVG;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
stfState.supplyZones[j],
|
||||
dest[i].supplyZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
has = stfState.HasDemandZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int j = 0; j < stfState.CountDemandZones(); j++)
|
||||
{
|
||||
//
|
||||
bool isInsideOB = IsInsideDiff(
|
||||
stfState.demandZones[j],
|
||||
dest[i].ob,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.demandZones[j],
|
||||
dest[i].ob,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInsideFVG = IsInsideDiff(
|
||||
stfState.demandZones[j],
|
||||
dest[i].fvg,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.demandZones[j],
|
||||
dest[i].fvg,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInside = isInsideOB ||
|
||||
isInsideFVG;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
stfState.demandZones[j],
|
||||
dest[i].demandZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Support Zones ...
|
||||
has = stfState.HasSupportZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int j = 0; j < stfState.CountSupportZones(); j++)
|
||||
{
|
||||
//
|
||||
bool isInsideOB = IsInsideDiff(
|
||||
stfState.supportZones[j],
|
||||
dest[i].ob,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.supportZones[j],
|
||||
dest[i].ob,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInsideFVG = IsInsideDiff(
|
||||
stfState.supportZones[j],
|
||||
dest[i].fvg,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.supportZones[j],
|
||||
dest[i].fvg,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInside = isInsideOB ||
|
||||
isInsideFVG;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
stfState.supportZones[j],
|
||||
dest[i].supportZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance Zones ...
|
||||
has = stfState.HasResistanceZones();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int j = 0; j < stfState.CountResistanceZones(); j++)
|
||||
{
|
||||
//
|
||||
bool isInsideOB = IsInsideDiff(
|
||||
stfState.resistanceZones[j],
|
||||
dest[i].ob,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.resistanceZones[j],
|
||||
dest[i].ob,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInsideFVG = IsInsideDiff(
|
||||
stfState.resistanceZones[j],
|
||||
dest[i].fvg,
|
||||
false //
|
||||
) ||
|
||||
IsInsideDiff(
|
||||
stfState.resistanceZones[j],
|
||||
dest[i].fvg,
|
||||
true //
|
||||
);
|
||||
|
||||
//
|
||||
bool isInside = isInsideOB ||
|
||||
isInsideFVG;
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
stfState.resistanceZones[j],
|
||||
dest[i].resistanceZones //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(tmpOBs);
|
||||
Clean(tmpFVGs);
|
||||
|
||||
@@ -241,15 +241,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
|
||||
// //
|
||||
// int bearishFlowCount = mConditions.DetectOrderFlow(
|
||||
// X_DIRECTION_BEARISH,
|
||||
// consolidationState,
|
||||
// analyseState,
|
||||
// zIndex,
|
||||
// period,
|
||||
// visionCycleHelper.mPOIDrawer //
|
||||
// );
|
||||
//
|
||||
int bearishFlowCount = mConditions.DetectOrderFlow(
|
||||
X_DIRECTION_BEARISH,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
zIndex,
|
||||
period,
|
||||
visionCycleHelper.mPOIDrawer //
|
||||
);
|
||||
|
||||
//
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user