This commit is contained in:
2025-02-22 01:13:26 +03:30
parent 627e9c4706
commit c371004b3b
10 changed files with 2701 additions and 4 deletions
+6 -1
View File
@@ -401,7 +401,7 @@ class XCBarAnalyser : public XCBase
return result;
}
//
//
double points = GetPoints(bar.symbol);
int index = bar.Index();
@@ -1458,6 +1458,11 @@ class XCBarAnalyser : public XCBase
//
// Check Body ...
double rangePercent = GetBarRangePercent(bar);
result = rangePercent > 0;
if (!result)
{
return result;
}
//
double body = bar.GetBody();
+159 -2
View File
@@ -233,8 +233,9 @@ class XCBarArrowObject : public XCBaseObject
//
result =
//
bar.IsValid()
//
bar.IsValid() &&
IsValid(name)
//
;
if (!result)
@@ -2872,6 +2873,162 @@ class XCTrendObject : public XCBaseObject
public:
//
/**
* Creator ...
*
* @param chart_id: Long, Specified Chart ID ...
* @param window: Integer, Specified Chart Window ID ...
* @param rr: XRR instance Reference ...
* @param prefix: String ...
*
* @return ( bool )
*/
bool Create(
long chart_id,
int window,
XPoint &swings[],
bool useMinAsStart = true,
string prefix = NULL //
)
{
//
bool result = false;
//
int count = ArraySize(swings);
result =
count >= 2 &&
IsValidSize(count);
if (!result)
{
return result;
}
//
double min = 0;
datetime minAt = NULL;
//
double max = 0;
datetime maxAt = NULL;
//
// Etract Min/Max ...
for (int i = 0; i < count; i++)
{
//
XPoint iPoint = swings[i];
//
if (!iPoint.IsValid())
{
//
iPoint.Clean();
continue;
}
//
bool canSetMin =
min == 0
? true
: min > iPoint.value;
if (canSetMin)
{
//
minAt = iPoint.at;
min = iPoint.value;
}
//
bool canSetMax =
max == 0
? true
: max < iPoint.value;
if (canSetMax)
{
//
maxAt = iPoint.at;
max = iPoint.value;
}
//
iPoint.Clean();
}
//
double first =
useMinAsStart
? min
: max;
datetime firstTime =
useMinAsStart
? minAt
: maxAt;
//
double second =
useMinAsStart
? max
: min;
datetime secondTime =
useMinAsStart
? maxAt
: minAt;
//
// Validate Points ...
result =
//
first > 0 &&
second > 0 &&
(useMinAsStart
? first <= second
: first >= second) &&
IsSpecifiedValid(firstTime) &&
IsSpecifiedValid(secondTime)
//
;
if (!result)
{
return result;
}
//
ENUM_X_DIRECTION dir =
useMinAsStart
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
string name = "XTRND" + ToString(dir) + "_" + ToString(first) + "_" + ToString(second);
if (IsValid(prefix))
{
name = prefix + "_" + name;
}
string nameMD5 = ToMD5(name);
//
result = mTrend.Create(
chart_id,
name,
window,
firstTime,
first,
secondTime,
second //
);
if (!result)
{
return result;
}
//
ObjName(name);
//
return result;
}
/**
* Creator ...
*
+140 -1
View File
@@ -23,6 +23,7 @@
// Imports ...
#include "../Classes/x-saherelm.base.class.mq5"
#include "../Classes/x-saherelm.x-cobject.class.mq5"
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
//
// Definitions ...
@@ -2872,6 +2873,66 @@ class XCPOIDrawer : public XCBase
return result;
}
/**
* Create Trend Line Object ...
*
* @param swings: XSwingPoint instance Collection ...
* @param useMinAsStart: Specified Min Value as Start ...
*
* @return ( bool )
*/
bool CreateTrend(
XPoint &swings[],
XCTrendObject *&object,
bool useMinAsStart = true //
)
{
//
bool result = false;
//
object = NULL;
//
result = ArraySize(swings) >= 2 &&
IsValidSize(ArraySize(swings));
if (!result)
{
return result;
}
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
object = new XCTrendObject();
result = object.Create(
chartID,
window,
swings,
useMinAsStart,
prefix //
);
//
if (!result)
{
return result;
}
//
color clrTrend = useMinAsStart
? SwingLowColor()
: SwingHighColor();
object.TrendColor(clrTrend);
object.TrendRayRight(true);
//
return result;
}
/**
* Create Consolidation Zone Object ...
*
@@ -2929,7 +2990,7 @@ class XCPOIDrawer : public XCBase
/**
* Create Bar Object ...
*
* @param bar: XOHCL instance Reference ..
* @param bar: XOHCL instance Reference ...
* @param object: XCOHCLObject pointer Reference ..
* @param to: Datetime ...
*
@@ -3030,6 +3091,84 @@ class XCPOIDrawer : public XCBase
return result;
}
/**
* Create Bar Arrow Object ...
*
* @param bar: XOHCL instance Reference ...
* @param priceType: ENUM_X_PRICE member ...
* @param arrow: int, Arrow Code ...
* @param clr: color, Arro Color ...
* @param width: int, Arrow Width ...
* @param anchor: ENUM_ARROW_ANCHOR, anchor of Arrow ...
* @param name: string, name of Arrow ...
*
* @return ( bool )
*/
bool CreateBarArrow(
XOHCL &bar,
XCBarArrowObject *&object,
ENUM_X_PRICE priceType,
int arrow = 159,
color clr = clrYellow,
int width = 3,
ENUM_ARROW_ANCHOR anchor = ANCHOR_BOTTOM,
string name = NULL //
)
{
//
bool result = false;
//
object = NULL;
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
string barTag = bar.GetTag(name);
//
string prefix = Prefix();
long chartID = ChartIdentification();
int window = SubWindowIdentification();
//
color mBullishColor = BarBullishColor();
color mBearishColor = BarBearishColor();
//
prefix =
(IsValid(prefix)
? prefix + "_"
: prefix) +
barTag;
//
object = new XCBarArrowObject();
result = object
.CreateByBar(
chartID,
prefix,
window,
arrow,
bar,
priceType //
);
if (result)
{
//
object.ArrowColor(clr);
object.ArrowWidth(width);
}
//
return result;
}
/**
* Create Specific Box on Chart ...
*