last works on validating POI's ...
This commit is contained in:
@@ -1361,6 +1361,9 @@ bool IsBoxValid(
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return true;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = box.IsValid();
|
result = box.IsValid();
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|||||||
@@ -3016,7 +3016,7 @@ void DoProcess(
|
|||||||
//
|
//
|
||||||
bool isTriggerBar =
|
bool isTriggerBar =
|
||||||
//
|
//
|
||||||
triggerBarPushers > 1 &&
|
triggerBarPushers >= 1 &&
|
||||||
(isBullishTriggerBar ||
|
(isBullishTriggerBar ||
|
||||||
isBearishTriggerBar)
|
isBearishTriggerBar)
|
||||||
//
|
//
|
||||||
@@ -3029,6 +3029,9 @@ void DoProcess(
|
|||||||
//
|
//
|
||||||
// Reading Required Info ...
|
// Reading Required Info ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// HK Signal Bar ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double iHKSOpen = hkSBarOpenBuffer[barIndex];
|
double iHKSOpen = hkSBarOpenBuffer[barIndex];
|
||||||
double iHKSClose = hkSBarCloseBuffer[barIndex];
|
double iHKSClose = hkSBarCloseBuffer[barIndex];
|
||||||
@@ -3039,13 +3042,24 @@ void DoProcess(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isHKSBullish = hkSBarOpenBuffer[barIndex] < hkSBarCloseBuffer[barIndex];
|
bool isHKSBullish = hkSBarOpenBuffer[barIndex] < hkSBarCloseBuffer[barIndex];
|
||||||
|
bool isPHKSBullish = hkSBarOpenBuffer[barIndex + 1] < hkSBarCloseBuffer[barIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
bool isHKSBearish = hkSBarOpenBuffer[barIndex] > hkSBarCloseBuffer[barIndex];
|
bool isHKSBearish = hkSBarOpenBuffer[barIndex] > hkSBarCloseBuffer[barIndex];
|
||||||
|
bool isPHKSBearish = hkSBarOpenBuffer[barIndex + 1] > hkSBarCloseBuffer[barIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
bool isHKSSwitchedToBullish =
|
bool isHKSSwitchedToBullish =
|
||||||
hkSBarOpenBuffer[barIndex] < hkSBarCloseBuffer[barIndex] &&
|
isHKSBullish &&
|
||||||
hkSBarOpenBuffer[barIndex] >= hkSBarCloseBuffer[barIndex];
|
!isPHKSBullish;
|
||||||
|
|
||||||
|
//
|
||||||
bool isHKSSwitchedToBearish =
|
bool isHKSSwitchedToBearish =
|
||||||
hkSBarOpenBuffer[barIndex] > hkSBarCloseBuffer[barIndex] &&
|
isHKSBearish &&
|
||||||
hkSBarOpenBuffer[barIndex] <= hkSBarCloseBuffer[barIndex];
|
!isPHKSBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// TREND ...
|
||||||
|
|
||||||
//
|
//
|
||||||
double iTrend = trendBuffer[barIndex];
|
double iTrend = trendBuffer[barIndex];
|
||||||
@@ -3058,6 +3072,94 @@ void DoProcess(
|
|||||||
trendStateBuffer[barIndex] < 0 &&
|
trendStateBuffer[barIndex] < 0 &&
|
||||||
trendStateBuffer[barIndex + 1] >= 0;
|
trendStateBuffer[barIndex + 1] >= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// RSI ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIOverOB = rsiBuffer[barIndex] > rsiOBLevel;
|
||||||
|
bool isPRSIOverOB = rsiBuffer[barIndex + 1] > rsiOBLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIUnderOB = rsiBuffer[barIndex] < rsiOBLevel;
|
||||||
|
bool isPRSIUnderOB = rsiBuffer[barIndex + 1] < rsiOBLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedOverOB =
|
||||||
|
isRSIOverOB &&
|
||||||
|
!isPRSIOverOB;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedUnderOB =
|
||||||
|
isRSIUnderOB &&
|
||||||
|
!isPRSIUnderOB;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIOverOS = rsiBuffer[barIndex] > rsiOSLevel;
|
||||||
|
bool isPRSIOverOS = rsiBuffer[barIndex + 1] > rsiOSLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSIUnderOS = rsiBuffer[barIndex] < rsiOSLevel;
|
||||||
|
bool isPRSIUnderOS = rsiBuffer[barIndex + 1] < rsiOSLevel;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedOverOS =
|
||||||
|
isRSIOverOS &&
|
||||||
|
!isPRSIOverOS;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isRSICrossedUnderOS =
|
||||||
|
isRSIUnderOS &&
|
||||||
|
!isPRSIUnderOS;
|
||||||
|
|
||||||
|
//
|
||||||
|
// ADX ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXOverThreshold = adxBuffer[barIndex] > adxThreshold;
|
||||||
|
bool isPADXOverThreshold = adxBuffer[barIndex + 1] > adxThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXUnderThreshold = adxBuffer[barIndex] < adxThreshold;
|
||||||
|
bool isPADXUnderThreshold = adxBuffer[barIndex + 1] < adxThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXCrossedOverThreshold =
|
||||||
|
isADXOverThreshold &&
|
||||||
|
!isPADXOverThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXCrossedUnderThreshold =
|
||||||
|
isADXUnderThreshold &&
|
||||||
|
!isPADXUnderThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXBullish = adxpBuffer[barIndex] > adxnBuffer[barIndex];
|
||||||
|
bool isPADXBullish = adxpBuffer[barIndex + 1] > adxnBuffer[barIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXBearish = adxpBuffer[barIndex] < adxnBuffer[barIndex];
|
||||||
|
bool isPADXBearish = adxpBuffer[barIndex + 1] < adxnBuffer[barIndex + 1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXSwitchedToBullish =
|
||||||
|
isADXBullish &&
|
||||||
|
!isPADXBullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXSwitchedToBearish =
|
||||||
|
isADXBearish &&
|
||||||
|
!isPADXBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXFullySwitchedToBullish =
|
||||||
|
isADXSwitchedToBullish &&
|
||||||
|
isADXCrossedOverThreshold;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isADXFullySwitchedToBearish =
|
||||||
|
isADXSwitchedToBearish &&
|
||||||
|
isADXCrossedUnderThreshold;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isTriggerBarOverHKS =
|
bool isTriggerBarOverHKS =
|
||||||
iBar.low > iHKSMax;
|
iBar.low > iHKSMax;
|
||||||
@@ -3076,8 +3178,12 @@ void DoProcess(
|
|||||||
//
|
//
|
||||||
(
|
(
|
||||||
//
|
//
|
||||||
isHKSBullish &&
|
// isHKSBullish &&
|
||||||
isTrendBullish
|
// isTrendBullish
|
||||||
|
//
|
||||||
|
// isRSICrossedOverOS
|
||||||
|
//
|
||||||
|
isHKSSwitchedToBullish
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
//
|
//
|
||||||
@@ -3091,14 +3197,19 @@ void DoProcess(
|
|||||||
//
|
//
|
||||||
(
|
(
|
||||||
//
|
//
|
||||||
isHKSBearish &&
|
// isHKSBearish &&
|
||||||
isTrendBearish
|
// isTrendBearish
|
||||||
|
//
|
||||||
|
// isRSICrossedUnderOB
|
||||||
|
//
|
||||||
|
isHKSSwitchedToBearish
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Summarizing Result ...
|
||||||
isTriggerBar =
|
isTriggerBar =
|
||||||
//
|
//
|
||||||
isBullishTriggerBar ||
|
isBullishTriggerBar ||
|
||||||
@@ -3410,8 +3521,8 @@ void ValidatePOIs(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
int count = 0;
|
int count = 0;
|
||||||
XBoxZone tmp[];
|
|
||||||
bool has = false;
|
bool has = false;
|
||||||
|
int barsLength = 3;
|
||||||
datetime to = GetBarTime(
|
datetime to = GetBarTime(
|
||||||
_Symbol,
|
_Symbol,
|
||||||
_Period,
|
_Period,
|
||||||
@@ -3422,90 +3533,31 @@ void ValidatePOIs(
|
|||||||
// Liquidities ...
|
// Liquidities ...
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Bullish Liquidities ...
|
||||||
count = ArraySize(mBullishLiquidities);
|
count = ArraySize(mBullishLiquidities);
|
||||||
has = IsValidSize(count);
|
has = IsValidSize(count);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean(tmp);
|
ValidateBoxes(
|
||||||
for (int i = 0; i < count; i++)
|
mBullishLiquidities,
|
||||||
{
|
barIndex,
|
||||||
//
|
barsLength //
|
||||||
has = IsBoxValid(
|
);
|
||||||
mBullishLiquidities[i],
|
|
||||||
barIndex //
|
|
||||||
);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
mBullishLiquidities[i],
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
has = HasChild(tmp);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
RemoveBoxes(
|
|
||||||
tmp,
|
|
||||||
mBullishLiquidities //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
SortBoxes(mBullishLiquidities);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(tmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Bearish Liquidities ...
|
||||||
count = ArraySize(mBearishLiquidities);
|
count = ArraySize(mBearishLiquidities);
|
||||||
has = IsValidSize(count);
|
has = IsValidSize(count);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean(tmp);
|
ValidateBoxes(
|
||||||
for (int i = 0; i < count; i++)
|
mBearishLiquidities,
|
||||||
{
|
barIndex,
|
||||||
//
|
barsLength //
|
||||||
mBearishLiquidities[i].to = to;
|
);
|
||||||
|
|
||||||
//
|
|
||||||
has = IsBoxValid(
|
|
||||||
mBearishLiquidities[i],
|
|
||||||
barIndex //
|
|
||||||
);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
mBearishLiquidities[i],
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
has = HasChild(tmp);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
RemoveBoxes(
|
|
||||||
tmp,
|
|
||||||
mBearishLiquidities //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
SortBoxes(mBearishLiquidities);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(tmp);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -524,6 +524,7 @@ bool IsBoxValid(
|
|||||||
for (int i = barIndex; i <= toIDX; i++)
|
for (int i = barIndex; i <= toIDX; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
// Initialize Indexed Bar ...
|
||||||
result = iBar.Init(
|
result = iBar.Init(
|
||||||
box.symbol,
|
box.symbol,
|
||||||
box.period,
|
box.period,
|
||||||
@@ -531,11 +532,16 @@ bool IsBoxValid(
|
|||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Checking Price ...
|
||||||
result =
|
result =
|
||||||
|
//
|
||||||
|
// Checking Bar Validation ...
|
||||||
result &&
|
result &&
|
||||||
|
//
|
||||||
|
// Checking Price Breaked or not ...
|
||||||
(isBullish
|
(isBullish
|
||||||
? iBar.close < appliedPrice
|
? iBar.close < box.lower
|
||||||
: iBar.close > appliedPrice);
|
: iBar.close > box.upper);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
edgeBreakes++;
|
edgeBreakes++;
|
||||||
@@ -556,12 +562,15 @@ bool IsBoxValid(
|
|||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// return true;
|
// return true;
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
edgeBreakes >= barsLength;
|
edgeBreakes < barsLength;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -907,4 +916,88 @@ bool IsBoxPlaceValidForBar(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ValidateBoxes(
|
||||||
|
XBoxZone &boxes[],
|
||||||
|
int barIndex = 0,
|
||||||
|
int barsLength = 3,
|
||||||
|
bool forceSorting = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Normalize Args ...
|
||||||
|
barIndex = NormalizeInt(barIndex, 0);
|
||||||
|
barsLength = NormalizeInt(barsLength, 3);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
has = HasChild(boxes);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Copy Boxes to tmp ...
|
||||||
|
XBoxZone tmp[];
|
||||||
|
Copy(
|
||||||
|
boxes,
|
||||||
|
tmp //
|
||||||
|
);
|
||||||
|
Clean(boxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Looping Through Exists Boxes ...
|
||||||
|
while (HasChild(tmp))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Select Indexed Box ...
|
||||||
|
XBoxZone iBox = tmp[0];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Indexed Box ...
|
||||||
|
ArrayRemove(
|
||||||
|
tmp,
|
||||||
|
0,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Box Validating ...
|
||||||
|
has = IsBoxValid(
|
||||||
|
iBox,
|
||||||
|
barIndex,
|
||||||
|
barsLength //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
boxes //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Sorting ...
|
||||||
|
if (forceSorting)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Has Result or not ...
|
||||||
|
has = HasChild(boxes);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Sorting ...
|
||||||
|
SortBoxes(boxes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Reference in New Issue
Block a user