1056 lines
20 KiB
Plaintext
1056 lines
20 KiB
Plaintext
|
|
/**
|
|
* Sort Order Blocks / Fair Value Gaps based on Place and Remove unused ...
|
|
*/
|
|
template <typename T>
|
|
void OrderedSortZones(
|
|
T *youngest,
|
|
T *&items[] //
|
|
)
|
|
{
|
|
//
|
|
int count = ArraySize(items);
|
|
if (youngest == NULL ||
|
|
!youngest.IsValid() ||
|
|
!IsValidSize(count))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ENUM_X_DIRECTION dir = youngest.GetDirection();
|
|
bool isBullish = IsBullish(dir);
|
|
|
|
//
|
|
T *tmp[];
|
|
T *lastOB = youngest;
|
|
while (IsValidSize(count))
|
|
{
|
|
//
|
|
// Detect Youngest of Collection ...
|
|
int idx = GetYoungest(items);
|
|
T *iChild = items[idx];
|
|
ArrayRemove(
|
|
items,
|
|
idx,
|
|
1 //
|
|
);
|
|
count = ArraySize(items);
|
|
|
|
//
|
|
// Check Direction Must be Same ...
|
|
ENUM_X_DIRECTION iDir = iChild.GetDirection();
|
|
bool isSameDir = dir == iDir;
|
|
if (!isSameDir)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Creation time Sequence ...
|
|
bool isFromPassed = lastOB.From() > iChild.From();
|
|
if (!isFromPassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Order Block Place ...
|
|
bool isPlacePassed =
|
|
isBullish
|
|
? IsBelow(
|
|
iChild,
|
|
lastOB,
|
|
true // Ignore Inside ...
|
|
)
|
|
: IsAbove(
|
|
iOB,
|
|
lastOB,
|
|
true // Ignore Inside ...
|
|
);
|
|
if (!isPlacePassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Update Last OB ...
|
|
lastOB = iChild;
|
|
Add(
|
|
iChild,
|
|
tmp //
|
|
);
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
// Update Ordered Sorted Order Blocks ...
|
|
count = ArraySize(tmp);
|
|
if (IsValidSize(count))
|
|
{
|
|
//
|
|
Copy(
|
|
tmp,
|
|
orderBlocks //
|
|
);
|
|
}
|
|
}
|
|
template <typename T>
|
|
void OrderedSortZones(
|
|
T *&items[] //
|
|
)
|
|
{
|
|
//
|
|
int count = ArraySize(items);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Detect Youngest ...
|
|
int youngestIDX = GetYoungest(
|
|
items //
|
|
);
|
|
bool hasYoungest = IsValidSize(youngestIDX);
|
|
if (!hasYoungest)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
T *youngest = items[youngestIDX];
|
|
ArrayRemove(
|
|
items,
|
|
youngestIDX,
|
|
1 //
|
|
);
|
|
count = ArraySize(items);
|
|
if (!IsValidSize(count))
|
|
{
|
|
//
|
|
Add(
|
|
youngest,
|
|
items //
|
|
);
|
|
|
|
//
|
|
return;
|
|
}
|
|
|
|
//
|
|
if (youngest == NULL ||
|
|
!youngest.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ENUM_X_DIRECTION dir = youngest.GetDirection();
|
|
bool isBullish = IsBullish(dir);
|
|
|
|
//
|
|
T *tmp[];
|
|
T *lastOB = youngest;
|
|
while (IsValidSize(count))
|
|
{
|
|
//
|
|
// Detect Youngest of Collection ...
|
|
int idx = GetYoungest(items);
|
|
T *iChild = items[idx];
|
|
ArrayRemove(
|
|
items,
|
|
idx,
|
|
1 //
|
|
);
|
|
count = ArraySize(items);
|
|
|
|
//
|
|
// Check Direction Must be Same ...
|
|
ENUM_X_DIRECTION iDir = iChild.GetDirection();
|
|
bool isSameDir = dir == iDir;
|
|
if (!isSameDir)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Creation time Sequence ...
|
|
bool isFromPassed = lastOB.From() > iChild.From();
|
|
if (!isFromPassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Order Block Place ...
|
|
bool isPlacePassed =
|
|
isBullish
|
|
? IsBelow(
|
|
iChild,
|
|
lastOB,
|
|
true // Ignore Inside ...
|
|
)
|
|
: IsAbove(
|
|
iChild,
|
|
lastOB,
|
|
true // Ignore Inside ...
|
|
);
|
|
if (!isPlacePassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Update Last OB ...
|
|
lastOB = iChild;
|
|
Add(
|
|
iChild,
|
|
tmp //
|
|
);
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
// Update Ordered Sorted Order Blocks ...
|
|
count = ArraySize(tmp);
|
|
if (IsValidSize(count))
|
|
{
|
|
//
|
|
Copy(
|
|
tmp,
|
|
items //
|
|
);
|
|
}
|
|
}
|
|
|
|
void OrderedSortBoxes(
|
|
XBoxZone &items[] //
|
|
)
|
|
{
|
|
//
|
|
int count = ArraySize(items);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
// Detect Youngest ...
|
|
int youngestIDX = GetYoungest(
|
|
items //
|
|
);
|
|
bool hasYoungest = IsValidSize(youngestIDX);
|
|
if (!hasYoungest)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
XBoxZone youngest = items[youngestIDX];
|
|
ArrayRemove(
|
|
items,
|
|
youngestIDX,
|
|
1 //
|
|
);
|
|
count = ArraySize(items);
|
|
if (!IsValidSize(count))
|
|
{
|
|
//
|
|
AddRef(
|
|
youngest,
|
|
items //
|
|
);
|
|
|
|
//
|
|
return;
|
|
}
|
|
|
|
//
|
|
if (!youngest.IsValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
ENUM_X_DIRECTION dir = youngest.dir;
|
|
bool isBullish = IsBullish(dir);
|
|
|
|
//
|
|
XBoxZone tmp[];
|
|
XBoxZone last = youngest;
|
|
while (IsValidSize(count))
|
|
{
|
|
//
|
|
// Detect Youngest of Collection ...
|
|
int idx = GetYoungest(items);
|
|
XBoxZone iChild = items[idx];
|
|
ArrayRemove(
|
|
items,
|
|
idx,
|
|
1 //
|
|
);
|
|
count = ArraySize(items);
|
|
|
|
//
|
|
// Check Direction Must be Same ...
|
|
ENUM_X_DIRECTION iDir = iChild.dir;
|
|
bool isSameDir = dir == iDir;
|
|
if (!isSameDir)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Creation time Sequence ...
|
|
bool isFromPassed = last.from > iChild.from;
|
|
if (!isFromPassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Check Order Block Place ...
|
|
bool isPlacePassed =
|
|
isBullish
|
|
? IsBoxBelow(
|
|
iChild,
|
|
last,
|
|
true // Ignore Inside ...
|
|
)
|
|
: IsBoxAbove(
|
|
iChild,
|
|
last,
|
|
true // Ignore Inside ...
|
|
);
|
|
if (!isPlacePassed)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
// Update Last OB ...
|
|
last = iChild;
|
|
AddRef(
|
|
iChild,
|
|
tmp //
|
|
);
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
// Update Ordered Sorted Order Blocks ...
|
|
count = ArraySize(tmp);
|
|
if (IsValidSize(count))
|
|
{
|
|
//
|
|
Copy(
|
|
tmp,
|
|
items //
|
|
);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Extract Order Flows Swing Points ...
|
|
*
|
|
* @param type: ENUM_X_SWING_TYPE member ...
|
|
* @param swings: double Collection ...
|
|
*
|
|
* @return ( int )
|
|
*/
|
|
int ExtractSwingPoints(
|
|
ENUM_X_SWING_TYPE type,
|
|
XCOrderBlock *&orderBlocks[],
|
|
XSwingPoint &swings[] //
|
|
)
|
|
{
|
|
//
|
|
int result = 0;
|
|
|
|
//
|
|
Clean(swings);
|
|
|
|
//
|
|
int count = ArraySize(orderBlocks);
|
|
|
|
//
|
|
if (type == X_NO_SWING ||
|
|
!IsValidSize(count))
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool lookingForSwingLows = type == X_SWING_LOW;
|
|
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCOrderBlock *iOB = orderBlocks[i];
|
|
|
|
//
|
|
string iSymbol = iOB.GetSymbol();
|
|
ENUM_TIMEFRAMES iPeriod = iOB.GetPeriod();
|
|
|
|
//
|
|
int fromIndex = iBarShift(
|
|
iSymbol,
|
|
iPeriod,
|
|
iOB.From() //
|
|
);
|
|
|
|
//
|
|
fromIndex++;
|
|
|
|
//
|
|
double iValue = 0;
|
|
datetime iVTime = NULL;
|
|
if (lookingForSwingLows)
|
|
{
|
|
//
|
|
int idx = iLowest(
|
|
iSymbol,
|
|
iPeriod,
|
|
MODE_LOW,
|
|
fromIndex //
|
|
);
|
|
|
|
//
|
|
if (IsValidIndex(idx))
|
|
{
|
|
//
|
|
iValue = iLow(
|
|
iSymbol,
|
|
iPeriod,
|
|
idx //
|
|
);
|
|
|
|
//
|
|
iVTime = iTime(
|
|
iSymbol,
|
|
iPeriod,
|
|
idx //
|
|
);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//
|
|
int idx = iHighest(
|
|
iSymbol,
|
|
iPeriod,
|
|
MODE_HIGH,
|
|
fromIndex //
|
|
);
|
|
|
|
//
|
|
if (IsValidIndex(idx))
|
|
{
|
|
//
|
|
iValue = iHigh(
|
|
iSymbol,
|
|
iPeriod,
|
|
idx //
|
|
);
|
|
|
|
//
|
|
iVTime = iTime(
|
|
iSymbol,
|
|
iPeriod,
|
|
idx //
|
|
);
|
|
}
|
|
}
|
|
|
|
//
|
|
if (iValue > 0)
|
|
{
|
|
//
|
|
XSwingPoint iSwingP;
|
|
|
|
//
|
|
iSwingP.type = type;
|
|
iSwingP.time = iVTime;
|
|
iSwingP.swing = iValue;
|
|
iSwingP.symbol = iSymbol;
|
|
iSwingP.period = iPeriod;
|
|
|
|
//
|
|
if (iSwingP.IsValid())
|
|
{
|
|
//
|
|
AddRef(
|
|
iSwingP,
|
|
swings //
|
|
);
|
|
}
|
|
|
|
//
|
|
iSwingP.Clean();
|
|
}
|
|
}
|
|
|
|
//
|
|
result = ArraySize(swings);
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
|
|
//
|
|
bool IsRejectBox(
|
|
ENUM_X_DIRECTION &forDir,
|
|
XOHCL &bar,
|
|
XBoxZone &box,
|
|
XPOIState &state,
|
|
XOHCL &swingBar,
|
|
XOHCL &rejectBar,
|
|
XOHCL &breakerBar,
|
|
XOHCL &momentumBar,
|
|
bool forceSwingRejection = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
swingBar.Clean();
|
|
rejectBar.Clean();
|
|
breakerBar.Clean();
|
|
momentumBar.Clean();
|
|
|
|
//
|
|
result = bar.IsValid() &&
|
|
box.IsValid() &&
|
|
state.IsValid() &&
|
|
state.HasChild() &&
|
|
HasDirection(forDir);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
bool isBullish = IsBullish(forDir);
|
|
|
|
//
|
|
double appliedPrice =
|
|
isBullish
|
|
? box.upper
|
|
: box.lower;
|
|
|
|
//
|
|
// Fetch Required Bars ...
|
|
|
|
//
|
|
XOHCL cBar;
|
|
result = bar.GetPreviousBar(cBar);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL pBar;
|
|
result = cBar.GetPreviousBar(pBar);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
XOHCL ppBar;
|
|
result = pBar.GetPreviousBar(ppBar);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
// Check Directional Swing Type ...
|
|
ENUM_X_SWING_TYPE swingType =
|
|
isBullish
|
|
? X_SWING_LOW
|
|
: X_SWING_HIGH;
|
|
|
|
//
|
|
bool isSwingLow =
|
|
//
|
|
pBar.low < ppBar.low &&
|
|
pBar.low < cBar.low &&
|
|
bar.open > pBar.low &&
|
|
//
|
|
appliedPrice > pBar.low &&
|
|
appliedPrice < pBar.GetDown()
|
|
//
|
|
;
|
|
|
|
//
|
|
bool isSwingHigh =
|
|
//
|
|
pBar.high > ppBar.high &&
|
|
pBar.high > cBar.high &&
|
|
bar.open < pBar.high &&
|
|
//
|
|
appliedPrice < pBar.high &&
|
|
appliedPrice > pBar.GetUp()
|
|
//
|
|
;
|
|
|
|
//
|
|
// Force Rejected By Swing ...
|
|
if (forceSwingRejection)
|
|
{
|
|
//
|
|
result = swingType == X_SWING_HIGH
|
|
? isSwingHigh
|
|
: swingType == X_SWING_LOW
|
|
? isSwingLow
|
|
: false;
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
}
|
|
|
|
//
|
|
bool hasValidSwing =
|
|
isBullish
|
|
? isSwingLow
|
|
: isSwingHigh;
|
|
if (hasValidSwing)
|
|
{
|
|
swingBar = pBar;
|
|
}
|
|
|
|
//
|
|
bool isCBarBreaked = IsBarBreak(
|
|
appliedPrice,
|
|
forDir,
|
|
cBar //
|
|
);
|
|
if (isCBarBreaked)
|
|
{
|
|
breakerBar = cBar;
|
|
}
|
|
bool isPBarBreaked = IsBarBreak(
|
|
appliedPrice,
|
|
forDir,
|
|
pBar //
|
|
);
|
|
if (isPBarBreaked)
|
|
{
|
|
breakerBar = pBar;
|
|
}
|
|
bool isPPBarBreaked = IsBarBreak(
|
|
appliedPrice,
|
|
forDir,
|
|
ppBar //
|
|
);
|
|
if (isPPBarBreaked)
|
|
{
|
|
breakerBar = ppBar;
|
|
}
|
|
bool isBoxBreaked = isCBarBreaked ||
|
|
isPBarBreaked ||
|
|
isPPBarBreaked;
|
|
|
|
//
|
|
bool isCBarRejected = IsBarReject(
|
|
appliedPrice,
|
|
forDir,
|
|
cBar //
|
|
);
|
|
if (isCBarRejected)
|
|
{
|
|
rejectBar = cBar;
|
|
}
|
|
bool isPBarRejected = IsBarReject(
|
|
appliedPrice,
|
|
forDir,
|
|
pBar //
|
|
);
|
|
if (isPBarRejected)
|
|
{
|
|
rejectBar = pBar;
|
|
}
|
|
bool isPPBarRejected = IsBarReject(
|
|
appliedPrice,
|
|
forDir,
|
|
ppBar //
|
|
);
|
|
if (isPPBarRejected)
|
|
{
|
|
rejectBar = ppBar;
|
|
}
|
|
bool isBoxRejected = isCBarRejected ||
|
|
isPBarRejected ||
|
|
isPPBarRejected;
|
|
|
|
//
|
|
int count = 0;
|
|
|
|
//
|
|
bool hasRejectionBar = false;
|
|
if (isBullish)
|
|
{
|
|
//
|
|
count = state.CountBullishRejectionBars();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCRejectionBar *iZone = state.bullishRejectionBars[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iZone.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasRejectionBar =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasRejectionBar)
|
|
{
|
|
//
|
|
if (!rejectBar.IsValid())
|
|
{
|
|
rejectBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//
|
|
count = state.CountBearishRejectionBars();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCRejectionBar *iZone = state.bearishRejectionBars[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iZone.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasRejectionBar =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasRejectionBar)
|
|
{
|
|
//
|
|
if (!rejectBar.IsValid())
|
|
{
|
|
rejectBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
bool hasMomentumBar = false;
|
|
if (isBullish)
|
|
{
|
|
//
|
|
count = state.CountBullishMomentumBars();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCMomentumBar *iZone = state.bullishMomentumBars[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iZone.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasMomentumBar =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasMomentumBar)
|
|
{
|
|
//
|
|
if (!momentumBar.IsValid())
|
|
{
|
|
momentumBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//
|
|
count = state.CountBearishMomentumBars();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCMomentumBar *iZone = state.bearishMomentumBars[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iZone.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasMomentumBar =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasMomentumBar)
|
|
{
|
|
//
|
|
if (!momentumBar.IsValid())
|
|
{
|
|
momentumBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
bool hasSwing = false;
|
|
if (isBullish)
|
|
{
|
|
//
|
|
count = state.CountSwingLows();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCSwing *iSwing = state.swingLows[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iSwing.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasSwing =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasSwing)
|
|
{
|
|
//
|
|
if (!swingBar.IsValid())
|
|
{
|
|
swingBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//
|
|
count = state.CountSwingHighs();
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
//
|
|
XCSwing *iSwing = state.swingHighs[i];
|
|
|
|
//
|
|
XOHCL iBar;
|
|
bool isFilled = iSwing.FillBar(iBar);
|
|
if (!isFilled)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//
|
|
int iBarIndex = iBar.Index();
|
|
|
|
//
|
|
hasSwing =
|
|
//
|
|
(iBarIndex == cBar.Index() ||
|
|
iBarIndex == pBar.Index())
|
|
//
|
|
;
|
|
if (hasSwing)
|
|
{
|
|
//
|
|
if (!swingBar.IsValid())
|
|
{
|
|
swingBar = iBar;
|
|
}
|
|
|
|
//
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//
|
|
bool hasRequiredValidations =
|
|
//
|
|
(hasRejectionBar ||
|
|
hasMomentumBar)
|
|
//
|
|
||
|
|
//
|
|
(hasRejectionBar ||
|
|
hasSwing)
|
|
//
|
|
||
|
|
//
|
|
(hasMomentumBar ||
|
|
hasSwing)
|
|
//
|
|
;
|
|
|
|
//
|
|
result =
|
|
//
|
|
(isBoxBreaked &&
|
|
(hasRequiredValidations ||
|
|
hasValidSwing))
|
|
//
|
|
||
|
|
//
|
|
(isBoxRejected &&
|
|
(hasRequiredValidations ||
|
|
hasValidSwing))
|
|
//
|
|
;
|
|
|
|
//
|
|
return result;
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
void UpdateTo(
|
|
T *&source[],
|
|
datetime time = NULL //
|
|
)
|
|
{
|
|
//
|
|
if (!IsValid(time))
|
|
{
|
|
time = TimeCurrent();
|
|
}
|
|
|
|
//
|
|
int count = ArraySize(source);
|
|
if (!IsValidSize(count))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
source[i].To(time);
|
|
}
|
|
}
|
|
|
|
|
|
template <typename T>
|
|
bool IsReject(
|
|
ENUM_X_DIRECTION forDir,
|
|
XOHCL &bar,
|
|
T *source,
|
|
XPOIState &state,
|
|
XOHCL &swingBar,
|
|
XOHCL &rejectBar,
|
|
XOHCL &breakerBar,
|
|
XOHCL &momentumBar,
|
|
bool forceSwingRejection = true //
|
|
)
|
|
{
|
|
//
|
|
bool result = false;
|
|
|
|
//
|
|
XBoxZone sourceBox;
|
|
result = ToBox(
|
|
sourceBox,
|
|
source //
|
|
);
|
|
if (!result)
|
|
{
|
|
return result;
|
|
}
|
|
|
|
//
|
|
result = IsRejectBox(
|
|
forDir,
|
|
bar,
|
|
sourceBox,
|
|
state,
|
|
swingBar,
|
|
rejectBar,
|
|
breakerBar,
|
|
momentumBar,
|
|
forceSwingRejection //
|
|
);
|
|
|
|
//
|
|
return result;
|
|
}
|