This commit is contained in:
2024-11-02 05:52:16 +03:30
parent cc57a5eca8
commit 4362b1aeaf
9 changed files with 1893 additions and 16 deletions
+10 -9
View File
@@ -538,39 +538,40 @@ struct XOHCL
time = iTime(
mSymbol,
mPeriod,
barIndex
//
barIndex //
);
//
open = iOpen(
mSymbol,
mPeriod,
barIndex
//
barIndex //
);
open = NormalizePrice(open, mSymbol);
//
close = iClose(
mSymbol,
mPeriod,
barIndex
//
barIndex //
);
close = NormalizePrice(close, mSymbol);
//
high = iHigh(
mSymbol,
mPeriod,
barIndex);
barIndex //
);
high = NormalizePrice(high, mSymbol);
//
low = iLow(
mSymbol,
mPeriod,
barIndex
//
barIndex //
);
low = NormalizePrice(low, mSymbol);
//
bool result = IsValid();
+361 -2
View File
@@ -436,6 +436,45 @@ struct XZone
return result;
}
//
double GetRange()
{
//
double result = 0;
//
if (!IsValid())
{
return result;
}
//
result = upper - lower;
//
return result;
}
//
double GetMiddle()
{
//
double result = 0;
//
double range = GetRange();
if (range <= 0)
{
return result;
}
//
result = lower + (range / 2);
//
return result;
}
//
string GetTag()
{
@@ -1730,11 +1769,12 @@ bool IsInside(
double upper =
edge == X_ZONE_UPPER_EDGE
? source.high
: source.GetDown();
: source.GetUp();
double lower =
edge == X_ZONE_UPPER_EDGE
? source.GetUp()
? source.GetDown()
: source.low;
result = iSource.Init(
upper,
lower,
@@ -1759,9 +1799,328 @@ bool IsInside(
return result;
}
/**
* Check a Zone is Between to other Zones ...
*
* @param source: XZone instance ...
* @param upper: XZone instance ...
* @param lower: XZone instance ...
*
* @return ( bool )
*/
bool IsBetween(
XZone &source,
XZone &upper,
XZone &lower //
)
{
//
bool result = false;
//
result = source.IsValid();
if (!result)
{
return result;
}
//
bool isUpperValid = upper.IsValid();
bool isLowerValid = lower.IsValid();
//
result = isUpperValid ||
isLowerValid;
if (!result)
{
return result;
}
//
if (isUpperValid)
{
//
result = source.upper < upper.lower;
if (!result)
{
return result;
}
}
//
if (isLowerValid)
{
//
result = source.lower > lower.upper;
if (!result)
{
return result;
}
}
//
return result;
}
bool IsBetween(
XOHCL &source,
XZone &upper,
XZone &lower //
)
{
//
bool result = false;
//
result = source.IsValid();
if (!result)
{
return result;
}
//
bool isUpperValid = upper.IsValid();
bool isLowerValid = lower.IsValid();
//
result = isUpperValid ||
isLowerValid;
if (!result)
{
return result;
}
//
if (isUpperValid)
{
//
result = source.high < upper.lower;
if (!result)
{
return result;
}
}
//
if (isLowerValid)
{
//
result = source.low > lower.upper;
if (!result)
{
return result;
}
}
//
return result;
}
//
// State Extensions ...
/**
* Normalize and Combine States ...
*
* @param dest: XPOIState instance ...ّ
* @param states: XPOIState instance ...ّ
*/
void CombineStates(
XPOIState &dest,
XPOIState &states[] //
)
{
//
dest.Clean();
//
int count = ArraySize(states);
if (!IsValidSize(count))
{
return;
}
//
for (int i = 0; i < count; i++)
{
//
XPOIState iState = states[i];
//
dest.symbol = iState.symbol;
dest.period =
!IsValid(dest.period) ||
PeriodSeconds(dest.period) < PeriodSeconds(iState.period)
? iState.period
: dest.period;
dest.reportedAt =
!IsValid(dest.reportedAt) ||
dest.reportedAt > iState.reportedAt
? iState.reportedAt
: dest.reportedAt;
//
// Demand ...
int iCount = ArraySize(iState.demandZones);
if (IsValidSize(iCount))
{
//
Copy(
iState.demandZones,
dest.demandZones,
false //
);
}
//
// Supply ...
iCount = ArraySize(iState.supplyZones);
if (IsValidSize(iCount))
{
//
Copy(
iState.supplyZones,
dest.supplyZones,
false //
);
}
//
// Order Blocks ...
//
iCount = ArraySize(iState.bullishOrderBlocks);
if (IsValidSize(iCount))
{
//
Copy(
iState.bullishOrderBlocks,
dest.bullishOrderBlocks,
false //
);
}
//
iCount = ArraySize(iState.bearishOrderBlocks);
if (IsValidSize(iCount))
{
//
Copy(
iState.bearishOrderBlocks,
dest.bearishOrderBlocks,
false //
);
}
//
// Fair Value Gaps ...
//
iCount = ArraySize(iState.bullishFVGs);
if (IsValidSize(iCount))
{
//
Copy(
iState.bullishFVGs,
dest.bullishFVGs,
false //
);
}
//
iCount = ArraySize(iState.bearishFVGs);
if (IsValidSize(iCount))
{
//
Copy(
iState.bearishFVGs,
dest.bearishFVGs,
false //
);
}
//
// Supports ...
iCount = ArraySize(iState.supportZones);
if (IsValidSize(iCount))
{
//
Copy(
iState.supportZones,
dest.supportZones,
false //
);
}
//
// Resistances ...
iCount = ArraySize(iState.resistanceZones);
if (IsValidSize(iCount))
{
//
Copy(
iState.resistanceZones,
dest.resistanceZones,
false //
);
}
//
// Swings ...
//
// Swing Highs ...
iCount = ArraySize(iState.swingHighs);
if (IsValidSize(iCount))
{
//
Copy(
iState.swingHighs,
dest.swingHighs,
false //
);
}
//
// Swing Lows ...
iCount = ArraySize(iState.swingLows);
if (IsValidSize(iCount))
{
//
Copy(
iState.swingLows,
dest.swingLows,
false //
);
}
//
// Momentum Bars ...
iCount = ArraySize(iState.momentumBars);
if (IsValidSize(iCount))
{
//
Copy(
iState.momentumBars,
dest.momentumBars,
false //
);
}
//
// Rejection Bars ...
iCount = ArraySize(iState.rejectionBars);
if (IsValidSize(iCount))
{
//
Copy(
iState.rejectionBars,
dest.rejectionBars,
false //
);
}
}
}
/**
* Check State has Bullish Trend or not ...
*