Complete XPOi MomentumBar ...

This commit is contained in:
2024-10-19 17:25:28 +03:30
parent 41130e1872
commit 474dabbeb6
4 changed files with 3964 additions and 9 deletions
+157 -2
View File
@@ -1130,6 +1130,44 @@ struct XOHCL
return result;
}
//
bool GetNextBar(XOHCL &bar)
{
//
bool result = false;
//
result = IsValid();
if (!result)
{
return result;
}
//
int idx = Index();
result = idx > 0;
if (!result)
{
return result;
}
//
result = bar.Init(
this.symbol,
this.period,
idx - 1 //
);
//
if (!result)
{
bar.Clean();
}
//
return result;
}
//
bool GetPreviousBar(XOHCL &bar)
{
@@ -1196,7 +1234,7 @@ struct XOHCL
//
result =
IsStrong() && IsBullish();
IsStrong(percent) && IsBullish();
//
return result;
@@ -1212,7 +1250,7 @@ struct XOHCL
//
result =
IsStrong() && IsBearish();
IsStrong(percent) && IsBearish();
//
return result;
@@ -2822,6 +2860,57 @@ struct XOHCL
return result;
}
//
// Find Simple 3 Candle Based Swing High ...
bool IsSimpleSwingHigh(double thresholdInPoint = 1)
{
//
bool result = false;
//
int index = Index();
result = index > 0;
if (!result)
{
return result;
}
//
XOHCL nextBar;
result = GetNextBar(nextBar);
if (!result)
{
return result;
}
//
XOHCL prevBar;
result = GetPreviousBar(prevBar);
if (!result)
{
return result;
}
//
double point = GetPoints(symbol);
double requiredOffset = point * thresholdInPoint;
//
result =
high > nextBar.high &&
high > prevBar.high &&
(thresholdInPoint <= 0
? true
: MathAbs(
MathMax(
nextBar.high,
prevBar.high) -
high) >= requiredOffset);
//
return result;
}
//
// Find Last Swing High ...
bool FindLastSwingHigh(XOHCL &swing)
@@ -2947,6 +3036,57 @@ struct XOHCL
return result;
}
//
// Find Simple 3 Candle Based Swing Low ...
bool IsSimpleSwingLow(double thresholdInPoint = 1)
{
//
bool result = false;
//
int index = Index();
result = index > 0;
if (!result)
{
return result;
}
//
XOHCL nextBar;
result = GetNextBar(nextBar);
if (!result)
{
return result;
}
//
XOHCL prevBar;
result = GetPreviousBar(prevBar);
if (!result)
{
return result;
}
//
double point = GetPoints(symbol);
double requiredOffset = point * thresholdInPoint;
//
result =
low < nextBar.low &&
low < prevBar.low &&
(thresholdInPoint <= 0
? true
: MathAbs(
MathMax(
nextBar.low,
prevBar.low) -
low) >= requiredOffset);
//
return result;
}
//
// Find Last Swing Low ...
bool FindLastSwingLow(XOHCL &swing)
@@ -4147,6 +4287,21 @@ struct XOHCL
//
// Other ...
string GetTag(string prefix)
{
//
string result = NULL;
//
result =
(IsValid(prefix)
? prefix + "_"
: "") +
"XOHCL_" + symbol + "_" + ToString(period) + "_" + ToFormatString(time);
//
return result;
}
//
// Convert to String Representation ...