This commit is contained in:
2025-09-16 10:55:50 +03:30
parent 5dd58eec74
commit 83ef415ca2
5 changed files with 1530 additions and 4 deletions
+165
View File
@@ -1339,6 +1339,171 @@ struct XOHCL
return result;
}
//
// Swing Detection ...
//
int FindSwing(
ENUM_X_SWING_TYPE type,
int shoulders = 3 //
)
{
//
int result = -1;
//
// Validate ...
bool isValid = IsValid() &&
IsXValid(type);
if (!isValid)
{
return result;
}
//
// Find Next Swing ...
result = FindXSwing(
type,
symbol,
period,
Index(),
shoulders //
);
//
return result;
}
//
int FindNextSwing(
ENUM_X_SWING_TYPE type,
int shoulders = 3 //
)
{
//
int result = -1;
//
// Validate ...
bool isValid = IsValid() &&
IsXValid(type);
if (!isValid)
{
return result;
}
//
// Find Next Swing ...
result = FindXSwing(
type,
symbol,
period,
Index() + 1,
shoulders //
);
//
return result;
}
//
bool FindSwingBar(
ENUM_X_SWING_TYPE type,
XOHCL &swingBar,
int shoulders = 3 //
)
{
//
bool result = false;
//
// Prepare ...
swingBar.Clean();
//
// Validate ...
result = IsValid() &&
IsXValid(type);
if (!result)
{
return result;
}
//
// Find Next Swing ...
int idx = FindXSwing(
type,
symbol,
period,
Index(),
shoulders //
);
result = IsValidIndex(idx);
if (!result)
{
return result;
}
//
result = swingBar.Init(
symbol,
period,
idx //
);
//
return result;
}
//
bool FindNextSwingBar(
ENUM_X_SWING_TYPE type,
XOHCL &swingBar,
int shoulders = 3 //
)
{
//
bool result = false;
//
// Prepare ...
swingBar.Clean();
//
// Validate ...
result = IsValid() &&
IsXValid(type);
if (!result)
{
return result;
}
//
// Find Next Swing ...
int idx = FindXSwing(
type,
symbol,
period,
Index() + 1,
shoulders //
);
result = IsValidIndex(idx);
if (!result)
{
return result;
}
//
result = swingBar.Init(
symbol,
period,
idx //
);
//
return result;
}
//
// Other ...
string GetTag(string prefix = "")