Complete Support and Resistance POI ...

This commit is contained in:
2024-11-12 21:51:07 +03:30
parent 43ee49b32f
commit 797917e30a
5 changed files with 998 additions and 56 deletions
+87 -31
View File
@@ -319,7 +319,7 @@ class XCZone : public XCBasePOI
//
mUpper > 0 &&
mLower > 0 &&
mUpper > mLower
mUpper >= mLower
//
;
@@ -637,6 +637,12 @@ class XCBarZone : public XCZone
//
result = IsValidBarZone();
if (result)
{
//
From(bar.time);
To(TimeCurrent());
}
//
return result;
@@ -674,6 +680,46 @@ class XCBarZone : public XCZone
return result;
}
/**
* Set From Date ...
*
* @param value: DateTime ...
*/
void From(datetime value)
{
//
if (!IsValidBarZone())
{
return;
}
//
value = NormalizeTime(value);
//
mFrom = value;
}
/**
* Set To Date ...
*
* @param value: DateTime ...
*/
void To(datetime value)
{
//
if (!IsValidBarZone())
{
return;
}
//
value = NormalizeTime(value);
//
mTo = value;
}
//
// Overrides ...
@@ -688,38 +734,12 @@ class XCBarZone : public XCZone
datetime From() override
{
//
datetime result = NULL;
//
if (!IsValidBarZone())
{
return result;
}
//
result = mBar.time;
//
return result;
return mFrom;
}
datetime To() override
{
//
datetime result = NULL;
//
if (!IsValidBarZone())
{
return result;
}
//
result = TimeCurrent();
//
return result;
return mTo;
}
string GetTag() override
@@ -795,6 +815,8 @@ class XCBarZone : public XCZone
private:
//
// Props ...
datetime mFrom;
datetime mTo;
//
};
@@ -1450,11 +1472,13 @@ class XCSupportZone : public XCBarZone
* Initialize POI ...
*
* @param bar: XOHCL instance ...
* @param range: Integer, Detection Range ...
*
* @return ( bool )
*/
bool Init(
XOHCL &bar //
XOHCL &bar,
int range = 0 //
)
{
//
@@ -1481,6 +1505,21 @@ class XCSupportZone : public XCBarZone
//
result = IsValid();
if (result &&
range > 0)
{
//
datetime time = bar.time;
int periodSeconds = PeriodSeconds(bar.period);
//
datetime from = (datetime)((int)time - (range * periodSeconds));
datetime to = (datetime)((int)time + (range * periodSeconds));
//
From(from);
To(to);
}
//
return result;
@@ -1543,11 +1582,13 @@ class XCResistanceZone : public XCBarZone
* Initialize POI ...
*
* @param bar: XOHCL instance ...
* @param range: Integer, Detection Range ...
*
* @return ( bool )
*/
bool Init(
XOHCL &bar //
XOHCL &bar,
int range = 0 //
)
{
//
@@ -1574,6 +1615,21 @@ class XCResistanceZone : public XCBarZone
//
result = IsValid();
if (result &&
range > 0)
{
//
datetime time = bar.time;
int periodSeconds = PeriodSeconds(bar.period);
//
datetime from = (datetime)((int)time - (range * periodSeconds));
datetime to = (datetime)((int)time + (range * periodSeconds));
//
From(from);
To(to);
}
//
return result;