This commit is contained in:
2025-06-20 20:29:31 +03:30
parent aa92211951
commit 03d6630d25
2 changed files with 240 additions and 6 deletions
+232 -6
View File
@@ -646,6 +646,7 @@ XCBarAnalyser *mBarAnalyser;
//
// Temparory ...
int mCount = 0;
bool mHas = false;
ENUM_X_DIRECTION mDir;
bool mHasSignal = false;
@@ -654,6 +655,24 @@ bool mIsBearish = false;
XDirectionShift mDirShift;
string mTriggerBarConditions;
//
// POI(s) ...
//
XBoxZone tmpBoxes[];
//
bool mDrawLiquidities = true;
bool mDetectLiquidities = true;
//
XBoxZone mBullishLiquidities[];
XBoxZone mBearishLiquidities[];
// //
// XBoxZone mBullishLiquidities[];
// XBoxZone mBearishLiquidities[];
//
// Counters ...
@@ -1052,6 +1071,23 @@ void OnDeinit(const int reason)
IndicatorRelease(rsiHandler);
IndicatorRelease(adxHandler);
IndicatorRelease(trendHandler);
//
mDirShift.Clean();
//
Clean(mBullishKIChanges);
Clean(mBearishKIChanges);
Clean(mBullishSBChanges);
Clean(mBearishSBChanges);
Clean(mBullishHKSChanges);
Clean(mBearishHKSChanges);
Clean(mBullishSarChanges);
Clean(mBearishSarChanges);
Clean(mBullishTrendChanges);
Clean(mBearishTrendChanges);
//
}
/**
@@ -3259,16 +3295,16 @@ void PrepareMarketConditions(
// Recieve Bar ...
XOHCL iBar;
XOHCL iPBar;
bool has = iBar.Init(
mHas = iBar.Init(
_Symbol,
_Period,
barIndex
//
);
has =
has &&
mHas =
mHas &&
iBar.GetPreviousBar(iPBar);
if (!has)
if (!mHas)
{
return;
}
@@ -3281,8 +3317,8 @@ void PrepareMarketConditions(
//
// Check Required Bars Passed ...
has = p3Index <= maxBarIndex;
if (!has)
mHas = p3Index <= maxBarIndex;
if (!mHas)
{
return;
}
@@ -4474,6 +4510,103 @@ void DetectPOIs(
const long &tickVolume[] //
)
{
//
// Check Some Requirements ...
int lastBarIndex = barIndex + 1;
int maxBarIndex = startCalculationForLastBars > 0
? startCalculationForLastBars
: ratesTotal;
bool isFirstBar =
startCalculationForLastBars > 0
? barIndex == startCalculationForLastBars
: barIndex == firstBarIndex;
//
// Recieve Bar ...
XOHCL iBar;
XOHCL iPBar;
mHas = iBar.Init(
_Symbol,
_Period,
barIndex
//
);
mHas =
mHas &&
iBar.GetPreviousBar(iPBar);
if (!mHas)
{
return;
}
//
// Liquidities ...
if (mDetectLiquidities)
{
//
if (isLiquidity)
{
//
XBoxZone iLiq;
//
iLiq.type = "XLIQ";
iLiq.symbol = _Symbol;
iLiq.period = _Period;
//
if (isBullishLiquidity)
{
//
iLiq.from = iBar.time;
iLiq.lower = iBar.low;
iLiq.to = iBar.NextAt();
iLiq.upper = iBar.GetDown();
iLiq.dir = X_DIRECTION_BULLISH;
//
if (iLiq.IsValid())
{
//
AddIfNotExists(
iLiq,
mBullishLiquidities //
);
}
}
//
if (isBearishLiquidity)
{
//
iLiq.from = iBar.time;
iLiq.upper = iBar.high;
iLiq.to = iBar.NextAt();
iLiq.lower = iBar.GetUp();
iLiq.dir = X_DIRECTION_BEARISH;
//
if (iLiq.IsValid())
{
//
AddIfNotExists(
iLiq,
mBearishLiquidities //
);
}
}
//
iLiq.Clean();
}
}
//
// Cleanup Resources ...
//
iBar.Clean();
iPBar.Clean();
}
/**
@@ -4499,6 +4632,39 @@ void ValidatePOIs(
const long &tickVolume[] //
)
{
//
int barsLength = 3;
//
// Liquidities ...
//
// Bullish ...
mHas = HasChild(mBullishLiquidities);
if (mHas)
{
//
ValidateBoxes(
mBullishLiquidities,
barIndex,
barsLength //
);
}
//
// Bearish ...
mHas = HasChild(mBearishLiquidities);
if (mHas)
{
//
ValidateBoxes(
mBearishLiquidities,
barIndex,
barsLength //
);
}
//
}
/**
@@ -4524,6 +4690,66 @@ void DrawPOIs(
const long &tickVolume[] //
)
{
//
// Liquidities ...
if (mDrawLiquidities)
{
//
// Bullish ...
mCount = ArraySize(mBullishLiquidities);
mHas = IsValidSize(mCount);
if (mHas)
{
//
for (int i = 0; i < mCount; i++)
{
//
XBoxZone iBox = mBullishLiquidities[i];
//
XCBoxObject *iBObj;
mHas = mDrawer.DrawBox(
iBox,
iBObj //
);
if (mHas)
{
mObjects.Add(iBObj);
}
//
iBox.Clean();
}
}
//
// Bearish ...
mCount = ArraySize(mBearishLiquidities);
mHas = IsValidSize(mCount);
if (mHas)
{
//
for (int i = 0; i < mCount; i++)
{
//
XBoxZone iBox = mBearishLiquidities[i];
//
XCBoxObject *iBObj;
mHas = mDrawer.DrawBox(
iBox,
iBObj //
);
if (mHas)
{
mObjects.Add(iBObj);
}
//
iBox.Clean();
}
}
}
}
/**
@@ -1212,6 +1212,11 @@ void ValidateBoxes(
//
// Select Indexed Box ...
XBoxZone iBox = tmp[0];
datetime to = GetBarTime(
iBox.symbol,
iBox.period,
barIndex //
);
//
// Remove Indexed Box ...
@@ -1230,6 +1235,9 @@ void ValidateBoxes(
);
if (has)
{
//
iBox.to = to;
//
AddRef(
iBox,