This commit is contained in:
2024-07-21 17:37:34 +03:30
parent 608d387a92
commit a996143dd3
11 changed files with 3160 additions and 378 deletions
+215 -1
View File
@@ -1663,6 +1663,111 @@ struct XOHCL
return result;
}
//
// Touches ...
//
bool IsBullishTouched(double price)
{
//
bool result = false;
//
result =
//
IsValid()
//
&&
//
price > 0
//
;
if (!result)
{
return result;
}
//
XOHCL pBar;
result = GetPreviousBar(pBar);
if (!result)
{
return result;
}
//
result =
//
(pBar.low <= price ||
pBar.GetDown() <= price)
//
&&
//
(pBar.high > price ||
pBar.GetUp() > price)
//
&&
//
open > price &&
low > price
//
;
//
return result;
}
//
bool IsBearishTouched(double price)
{
//
bool result = false;
//
result =
//
IsValid()
//
&&
//
price > 0
//
;
if (!result)
{
return result;
}
//
XOHCL pBar;
result = GetPreviousBar(pBar);
if (!result)
{
return result;
}
//
result =
//
(pBar.high >= price ||
pBar.GetUp() >= price)
//
&&
//
(pBar.low < price ||
pBar.GetDown() < price)
//
&&
//
open < price &&
high < price
//
;
//
return result;
}
//
// Candlestic Patterns ...
@@ -2405,6 +2510,60 @@ struct XOHCL
return result;
}
//
// Find Last Swing High ...
bool FindLastSwingHigh(XOHCL &swing)
{
//
bool result = false;
//
swing.Clean();
//
result = IsValid();
if (!result)
{
return result;
}
//
int totalBars = iBars(
symbol,
period //
);
int maxAllowed = MathMin(100, (totalBars / 100));
//
int idx = Index();
for (int i = idx; i <= idx + maxAllowed; i++)
{
//
swing.Clean();
result = swing.Init(
symbol,
period,
i //
);
if (!result)
{
//
swing.Clean();
break;
}
//
result = swing.IsSwingHigh();
if (result)
{
break;
}
}
//
return result;
}
//
// Check Swing Low ...
bool IsSwingLow()
@@ -2476,6 +2635,60 @@ struct XOHCL
return result;
}
//
// Find Last Swing Low ...
bool FindLastSwingLow(XOHCL &swing)
{
//
bool result = false;
//
swing.Clean();
//
result = IsValid();
if (!result)
{
return result;
}
//
int totalBars = iBars(
symbol,
period //
);
int maxAllowed = MathMin(100, (totalBars / 100));
//
int idx = Index();
for (int i = idx; i <= idx + maxAllowed; i++)
{
//
swing.Clean();
result = swing.Init(
symbol,
period,
i //
);
if (!result)
{
//
swing.Clean();
break;
}
//
result = swing.IsSwingLow();
if (result)
{
break;
}
}
//
return result;
}
//
// Check Bullish FVG ...
bool HasBullishFVG(
@@ -3479,7 +3692,8 @@ struct XOHCL
period,
cIDX //
);
if (!result) {
if (!result)
{
break;
}
+196
View File
@@ -46,6 +46,202 @@ string XTLSBearishOrderBlockToken = "XBearishOrderBlock";
//
// Helper Tools ...
//
bool HasBullishPattern(
XOHCL &bar,
int loopback = 0,
int verifications = 1,
bool checkHammer = true,
bool checkMorningStar = true,
bool checkBullishMarubozu = true,
bool checkBullishEngulfing = true //
)
{
//
bool result = false;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
if (verifications <= 0)
{
verifications = 1;
}
//
int founded = 0;
//
int idx = bar.Index();
for (int i = idx; i <= idx + loopback; i++)
{
//
XOHCL iBar;
result = iBar.Init(
bar.symbol,
bar.period,
i //
);
if (!result)
{
break;
}
//
bool isHammer =
!checkHammer
? false
: iBar.IsHammer();
if (isHammer)
{
founded++;
}
//
bool isMorningStar =
!checkMorningStar
? false
: iBar.IsMorningStar();
if (isMorningStar)
{
founded++;
}
//
bool isBullishMarubozu =
!checkBullishMarubozu
? false
: iBar.IsBullishMarubozu();
if (isBullishMarubozu)
{
founded++;
}
//
bool isBullishEngulfing =
!checkBullishEngulfing
? false
: iBar.IsBullishEngulfing();
if (isBullishEngulfing)
{
founded++;
}
//
}
//
result =
result &&
founded >= verifications;
//
return result;
}
//
bool HasBearishPattern(
XOHCL &bar,
int loopback = 0,
int verifications = 1,
bool checkShootingStar = true,
bool checkEveningStar = true,
bool checkBearishMarubozu = true,
bool checkBearishEngulfing = true //
)
{
//
bool result = false;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
if (verifications <= 0)
{
verifications = 1;
}
//
int founded = 0;
//
int idx = bar.Index();
for (int i = idx - 1; i <= idx + loopback; i++)
{
//
XOHCL iBar;
result = iBar.Init(
bar.symbol,
bar.period,
i //
);
if (!result)
{
break;
}
//
bool isShootingStar =
!checkShootingStar
? false
: iBar.IsShootingStar();
if (isShootingStar)
{
founded++;
}
//
bool isEveningStar =
!checkEveningStar
? false
: iBar.IsEveningStar();
if (isEveningStar)
{
founded++;
}
//
bool isBearishMarubozu =
!checkBearishMarubozu
? false
: iBar.IsBearishMarubozu();
if (isBearishMarubozu)
{
founded++;
}
//
bool isBearishEngulfing =
!checkBearishEngulfing
? false
: iBar.IsBearishEngulfing();
if (isBearishEngulfing)
{
founded++;
}
//
}
//
result =
result &&
founded >= verifications;
//
return result;
}
//
bool IsSupportBreaked(
XOHCL &bar, // Support Bar