This commit is contained in:
2025-01-27 05:30:56 +03:30
parent 974a516bec
commit 24d152b41d
3 changed files with 462 additions and 101 deletions
+364 -4
View File
@@ -913,8 +913,8 @@ bool DetectPriceInsideBox(
}
//
bool hasBullishFVG = state.HasBullishFVGs();
bool hasBearishFVG = state.HasBearishFVGs();
bool hasBullishFVGs = state.HasBullishFVGs();
bool hasBearishFVGs = state.HasBearishFVGs();
bool hasDemandZones = state.HasDemandZones();
bool hasSupplyZones = state.HasSupplyZones();
bool hasSupportZones = state.HasSupportZones();
@@ -923,7 +923,7 @@ bool DetectPriceInsideBox(
//
bool hasBullishZones =
//
hasBullishFVG ||
hasBullishFVGs ||
hasDemandZones ||
hasSupportZones
//
@@ -932,7 +932,7 @@ bool DetectPriceInsideBox(
//
bool hasBearishZones =
//
hasBearishFVG ||
hasBearishFVGs ||
hasSupplyZones ||
hasResistanceZones
//
@@ -954,6 +954,7 @@ bool DetectPriceInsideBox(
hasPriceInsideOB)
{
//
// Use Price Inside OB as Box ...
box.to = priceInsideOB.To();
box.from = priceInsideOB.From();
box.upper = priceInsideOB.Upper();
@@ -964,6 +965,365 @@ bool DetectPriceInsideBox(
{
//
// Detect Validate Zones ...
int count = 0;
XBoxZone boxes[];
double upper = 0;
double lower = 0;
double price = 0;
datetime to = NULL;
datetime from = NULL;
ENUM_X_DIRECTION dir = X_DIRECTION_NONE;
if (IsBullish(boxDir))
{
//
double price = xConditions.valesBuffer[1];
ENUM_X_DIRECTION dir = X_DIRECTION_BULLISH;
//
// Bullish FVG ...
count = state.CountBullishFVGs();
for (int i = 0; i < count; i++)
{
//
XCFVG *iFVG = state.bullishFVGs[i];
//
to = iFVG.To();
from = iFVG.From();
upper = iFVG.Upper();
lower = iFVG.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
//
// Demand Zones ...
count = state.CountDemandZones();
for (int i = 0; i < count; i++)
{
//
XCDemandZone *iDemand = state.demandZones[i];
//
to = iDemand.To();
from = iDemand.From();
upper = iDemand.Upper();
lower = iDemand.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
//
// Support Zones ...
count = state.CountSupportZones();
for (int i = 0; i < count; i++)
{
//
XCSupportZone *iSupport = state.supportZones[i];
//
to = iSupport.To();
from = iSupport.From();
upper = iSupport.Upper();
lower = iSupport.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
}
else
{
//
double price = xConditions.peaksBuffer[1];
ENUM_X_DIRECTION dir = X_DIRECTION_BEARISH;
//
// Bearish FVG ...
count = state.CountBearishFVGs();
for (int i = 0; i < count; i++)
{
//
XCFVG *iFVG = state.bearishFVGs[i];
//
to = iFVG.To();
from = iFVG.From();
upper = iFVG.Upper();
lower = iFVG.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
//
// Supply Zones ...
count = state.CountSupplyZones();
for (int i = 0; i < count; i++)
{
//
XCSupplyZone *iSupply = state.supplyZones[i];
//
to = iSupply.To();
from = iSupply.From();
upper = iSupply.Upper();
lower = iSupply.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
//
// Demand Zones ...
count = state.CountResistanceZones();
for (int i = 0; i < count; i++)
{
//
XCResistanceZone *iResistance = state.resistanceZones[i];
//
to = iResistance.To();
from = iResistance.From();
upper = iResistance.Upper();
lower = iResistance.Lower();
//
bool isInside = IsPriceInsideZone(
price,
upper,
lower //
);
if (isInside)
{
//
XBoxZone iBox;
//
iBox.dir = dir;
iBox.symbol = symbol;
iBox.period = period;
//
iBox.to = to;
iBox.from = from;
iBox.upper = upper;
iBox.lower = lower;
//
if (iBox.IsValid())
{
//
AddRef(
iBox,
boxes //
);
}
}
}
}
//
int boxesCount = ArraySize(boxes);
bool hasBoxes = IsValidSize(boxes);
if (hasBoxes)
{
//
// Filter Boxes ...
for (int i = 0; i < boxesCount; i++)
{
//
XBoxZone iBox = boxes[i];
//
// Upper ...
if (box.upper == 0 || box.upper < iBox.upper)
{
box.upper = iBox.upper;
}
//
// Lower ...
if (box.lower == 0 || box.lower < iBox.lower)
{
box.lower = iBox.lower;
}
//
// To ...
if (!IsValid(box.to) || box.to < iBox.to)
{
box.to = iBox.to;
}
//
// From ...
if (!IsValid(box.from) || box.from > iBox.from)
{
box.from = iBox.from;
}
}
}
else
{
//
// Use Price Inside OB as Box ...
box.to = priceInsideOB.To();
box.from = priceInsideOB.From();
box.upper = priceInsideOB.Upper();
box.lower = priceInsideOB.Lower();
}
}
//