last works on pattern detector ...

This commit is contained in:
2025-09-17 08:58:58 +03:30
parent 21fe832447
commit c1da10ba3a
4 changed files with 795 additions and 245 deletions
+90 -1
View File
@@ -889,6 +889,95 @@ class XCPOIDrawer : public XCBase
return result;
}
/**
* Draw Trend Line based on Swings Points ...
*
* @param swings: XOHCL, Specified Swings ...
* @param dir: ENUM_X_DIRECTION, Specified Trend Direction ...
* @param rayRight: Ray to Right ...
* @param rayLeft: Ray to Left ...
*
* @return ( bool )
*/
bool DrawSwingTrend(
XOHCL &swings[],
ENUM_X_DIRECTION dir,
CChartObjectTrend *&object,
bool rayRight = false,
bool rayLeft = false //
)
{
//
bool result = false;
//
int count = ArraySize(swings);
result = HasChild(swings) &&
count >= 2 &&
HasDirection(dir);
if (!result)
{
return result;
}
//
bool isBullish = IsSpecifiedBullish(dir);
//
double price1 =
isBullish
? swings[0].low
: swings[0].high;
datetime time1 = swings[0].time;
//
double price2 =
isBullish
? swings[count - 1].low
: swings[count - 1].high;
datetime time2 = swings[count - 1].time;
//
ulong chartId = ChartIdentification();
int subWindow = SubWindowIdentification();
string name = ToXString(dir) + "_Trend_" + ToXString(price1) + "_" + ToXString(price2);
//
object = new CChartObjectTrend();
result = object.Create(
chartId,
name,
subWindow,
time1,
price1,
time2,
price2 //
);
if (result)
{
//
ApplyStyle(
object,
dir //
);
//
if (rayRight)
{
object.RayRight(true);
}
//
if (rayLeft)
{
object.RayLeft(true);
}
}
//
return result;
}
/**
* Apply Specified Style to Object ...
*/
@@ -932,7 +1021,7 @@ class XCPOIDrawer : public XCBase
/**
* Apply Style to Specified Chart Object ...
*
*
* @param dir: Argument 2
*/
void ApplyStyle(