last ...
This commit is contained in:
@@ -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 = "")
|
||||
|
||||
Reference in New Issue
Block a user