last ...
This commit is contained in:
@@ -22,146 +22,11 @@
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Libraries/x-saherelm.x-poi.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.xobfvg.lib.mq5"
|
||||
#include "../Libraries/x-saherelm.x-poi.state.lib.mq5"
|
||||
|
||||
//
|
||||
// Extensions ...
|
||||
|
||||
/**
|
||||
* Combine a Collection of States into dest ...
|
||||
*
|
||||
* @param dest: XPOIState instance ...
|
||||
* @param source: XPOIState Collection ...
|
||||
*/
|
||||
void CombineStates(
|
||||
XPOIState &dest,
|
||||
XPOIState &source[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
dest.Clean();
|
||||
|
||||
//
|
||||
int count = ArraySize(source);
|
||||
if (!IsValidSize(count))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XPOIState iState = source[i];
|
||||
|
||||
//
|
||||
if (dest.ticksZone == NULL)
|
||||
{
|
||||
dest.ticksZone = iState.ticksZone;
|
||||
}
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.swingHighs,
|
||||
dest.swingHighs,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.swingLows,
|
||||
dest.swingLows,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bullishMomentumBars,
|
||||
dest.bullishMomentumBars,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bearishMomentumBars,
|
||||
dest.bearishMomentumBars,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bullishRejectionBars,
|
||||
dest.bullishRejectionBars,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bearishRejectionBars,
|
||||
dest.bearishRejectionBars,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.supportZones,
|
||||
dest.supportZones,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.resistanceZones,
|
||||
dest.resistanceZones,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.supplyZones,
|
||||
dest.supplyZones,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.demandZones,
|
||||
dest.demandZones,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bullishOrderBlocks,
|
||||
dest.bullishOrderBlocks,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bearishOrderBlocks,
|
||||
dest.bearishOrderBlocks,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bullishFairValueGaps,
|
||||
dest.bullishFairValueGaps,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
iState.bearishFairValueGaps,
|
||||
dest.bearishFairValueGaps,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ToZone(
|
||||
T *&source[],
|
||||
@@ -265,7 +130,7 @@ bool ToBox(
|
||||
|
||||
template <typename T>
|
||||
int GetOldest(
|
||||
T *&sourec[] //
|
||||
T *&source[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -732,6 +597,47 @@ bool IsInside(
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool IsInsideOr(
|
||||
T *source,
|
||||
T *dest //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XBoxZone sourceBox;
|
||||
result = ToBox(
|
||||
sourceBox,
|
||||
source //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone destBox;
|
||||
result = ToBox(
|
||||
destBox,
|
||||
dest //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsBoxInsideOr(
|
||||
sourceBox,
|
||||
destBox //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
bool IsInsideDiff(
|
||||
T *source,
|
||||
@@ -775,6 +681,48 @@ bool IsInsideDiff(
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T, typename F>
|
||||
bool IsInsideOrDiff(
|
||||
T *source,
|
||||
F *dest,
|
||||
bool forceSideOut = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
XBoxZone sourceBox;
|
||||
result = ToBox(
|
||||
sourceBox,
|
||||
source //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone destBox;
|
||||
result = ToBox(
|
||||
destBox,
|
||||
dest //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = IsBoxInsideOr(
|
||||
sourceBox,
|
||||
destBox //
|
||||
);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool FindIndex(
|
||||
int &index,
|
||||
@@ -1117,6 +1065,50 @@ bool IsBoxInside(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect source BoX is Inside Dest Box or Have a Side Out on it ...
|
||||
*
|
||||
* @param source: XBoxZone instance, source box which checks by dest ...
|
||||
* @param dest: XBoxZone instance, dest Box which compares source with it ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsBoxInsideOr(
|
||||
XBoxZone &source,
|
||||
XBoxZone &dest //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
dest.IsValid() &&
|
||||
!source.IsSame(dest);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isLowerInside =
|
||||
source.lower > dest.lower &&
|
||||
source.lower < dest.upper &&
|
||||
(source.upper < dest.upper ||
|
||||
source.upper > dest.upper);
|
||||
bool isUpperInside =
|
||||
source.upper < dest.upper &&
|
||||
source.upper > dest.lower &&
|
||||
(source.lower > dest.lower ||
|
||||
source.lower < dest.lower);
|
||||
result =
|
||||
isLowerInside ||
|
||||
isUpperInside;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Value is Inside Specified Box ...
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user