This commit is contained in:
2024-11-21 17:48:22 +03:30
parent 70a373802d
commit 09fd3627c6
6 changed files with 1755 additions and 841 deletions
+93
View File
@@ -2382,6 +2382,10 @@ class XCTickZone : public CObject
int ticks;
double percent;
//
ulong volume;
double volumePercent;
//
// Compare Two Zone With Each Other ...
virtual int Compare(
@@ -2535,6 +2539,25 @@ class XCTicksZone : public XCTwoBarZone
toM //
);
//
// Ticks Volumes ...
int ticksVolumeCount = CopyTickVolume(
symbol,
PERIOD_M1,
from,
to,
mTickVolumes //
);
if (IsValidSize(ticksVolumeCount))
{
//
mVolumes = 0;
for (int i = 0; i < ticksVolumeCount; i++)
{
mVolumes += mTickVolumes[i];
}
}
//
// Retrieve Highs ...
SpecificClean(mHighs);
@@ -2664,6 +2687,74 @@ class XCTicksZone : public XCTwoBarZone
//
result = IsValid();
//
// Try to Find Out PERIOD_1M times in each zone ...
datetime to1M = (datetime)((int)endBar.time + PeriodSeconds(period) - 60);
int to1MIndex = iBarShift(
symbol,
PERIOD_M1,
to1M //
);
int from1MIndex = iBarShift(
symbol,
PERIOD_M1,
from //
);
for (int i = from1MIndex; i > to1MIndex; i--)
{
//
XOHCL iBar;
bool isInited = iBar.Init(
symbol,
PERIOD_M1,
i //
);
if (!isInited)
{
continue;
}
ulong iVolume = iTickVolume(
symbol,
PERIOD_M1,
i //
);
//
// Loop through Zones ...
for (int j = 0; j < Levels(); j++)
{
//
XCTickZone *jZone = mZones.At(j);
if (!jZone.IsValid())
{
continue;
}
//
// Check iBar is Inside jZone ...
bool isIBarInside =
iBar.GetUp() < jZone.high &&
iBar.GetDown() > jZone.low;
// iBar.low < jZone.high ||
// iBar.high > jZone.low;
if (isIBarInside)
{
jZone.volume += iVolume;
}
}
}
//
// Calculate Volume Percent ...
for (int i = 0; i < Levels(); i++)
{
//
XCTickZone *iZone = mZones.At(i);
//
iZone.volumePercent = (double)(iZone.volume * 100 / mVolumes);
}
//
return result;
}
@@ -2787,6 +2878,8 @@ class XCTicksZone : public XCTwoBarZone
MqlTick mTicks[];
double mHighs[];
double mLows[];
ulong mVolumes;
ulong mTickVolumes[];
double mRangeHigh;
datetime mRangeHighTime;
double mRangeLow;