implement trend pivots ...
This commit is contained in:
@@ -622,6 +622,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
virtual void Default()
|
||||
{
|
||||
//
|
||||
// COMMON ...
|
||||
|
||||
//
|
||||
maxAllowedPivots = 50;
|
||||
pivotVerifications = 5;
|
||||
@@ -630,30 +633,41 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
|
||||
//
|
||||
// PV ...
|
||||
|
||||
//
|
||||
detectPeakPivots = false;
|
||||
detectValePivots = false;
|
||||
|
||||
//
|
||||
applySwingsOnPVPivots = false;
|
||||
selectRejectedPVPivots = false;
|
||||
selectEngulfedPVPivots = false;
|
||||
applySupportAndResistanceOnPVPivots = false;
|
||||
|
||||
//
|
||||
// PEAK ...
|
||||
detectPeakPivots = false;
|
||||
|
||||
//
|
||||
// VALES ...
|
||||
detectValePivots = false;
|
||||
|
||||
//
|
||||
// FVG ...
|
||||
|
||||
//
|
||||
detectFVGBullishPivots = false;
|
||||
detectFVGBearishPivots = false;
|
||||
|
||||
//
|
||||
maxAllowedFVGLife = 0;
|
||||
detectFVGTypeOne = false;
|
||||
detectFVGTypeTwo = false;
|
||||
applyPVToFVGBoundary = false;
|
||||
detectFVGBullishPivots = false;
|
||||
detectFVGBearishPivots = false;
|
||||
selectRejectedFVGPivots = false;
|
||||
selectEngulfedFVGPivots = false;
|
||||
applyLastBarToFVGBoundary = false;
|
||||
selectOnlyFVGWhichHasIndirectionalLastBar = false;
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
detectTrendBullishPivots = false;
|
||||
detectTrendBearishPivots = false;
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@@ -689,6 +703,8 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
newValePivotDetected = false;
|
||||
newFVGBullishPivotDetected = false;
|
||||
newFVGBearishPivotDetected = false;
|
||||
newTrendBullishPivotDetected = false;
|
||||
newTrendBearishPivotDetected = false;
|
||||
|
||||
//
|
||||
int index = barIndex;
|
||||
@@ -783,7 +799,7 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
// FVG ...
|
||||
|
||||
//
|
||||
// FVG Bullish ...
|
||||
// Bullish ...
|
||||
if (detectFVGBullishPivots)
|
||||
{
|
||||
//
|
||||
@@ -799,7 +815,7 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// FVG Bearish ...
|
||||
// Bearish ...
|
||||
if (detectFVGBearishPivots)
|
||||
{
|
||||
//
|
||||
@@ -814,6 +830,41 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
if (detectTrendBullishPivots)
|
||||
{
|
||||
//
|
||||
newTrendBullishPivotDetected = DetectTrendPivot(
|
||||
barIndex,
|
||||
X_DIRECTION_BULLISH,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar,
|
||||
conditions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (detectTrendBearishPivots)
|
||||
{
|
||||
//
|
||||
newTrendBearishPivotDetected = DetectTrendPivot(
|
||||
barIndex,
|
||||
X_DIRECTION_BEARISH,
|
||||
zBar,
|
||||
cBar,
|
||||
pBar,
|
||||
p2Bar,
|
||||
conditions //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Others ...
|
||||
|
||||
@@ -843,14 +894,21 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
|
||||
//
|
||||
// PV ...
|
||||
ValidatePeakVales(
|
||||
ValidatePeakValePivots(
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// FVG ...
|
||||
ValidateFVGs(
|
||||
ValidateFVGPivots(
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
ValidateTrendPivots(
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
@@ -908,6 +966,13 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
pivots,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
trendBullishPivots,
|
||||
pivots,
|
||||
false //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -927,6 +992,13 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
pivots,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
Copy(
|
||||
trendBearishPivots,
|
||||
pivots,
|
||||
false //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -964,7 +1036,7 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
bool applySupportAndResistanceOnPVPivots; // Apply Support and Resistance on PV Pivots ...
|
||||
|
||||
//
|
||||
void ValidatePeakVales(
|
||||
void ValidatePeakValePivots(
|
||||
XBoxZone &unavailables[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
@@ -1681,6 +1753,8 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
bool detectFVGTypeOne; // Detect FVG Type One ( Validating Using MAnalyser ) ...
|
||||
bool detectFVGTypeTwo; // Detect FVG Type Two ( Validating Using PV ) ...
|
||||
bool applyPVToFVGBoundary; // Apply PV to FVG Boundary ...
|
||||
bool selectRejectedFVGPivots; // Select Rejected FVG Pivots ...
|
||||
bool selectEngulfedFVGPivots; // Select Engulfed FVG Pivots ...
|
||||
bool applyLastBarToFVGBoundary; // Apply Last Bar to FVG Boundary ...
|
||||
bool selectOnlyFVGWhichHasIndirectionalLastBar; // Select Only FVGs which has Indirectionsl Last Bar, uses to Order Block ...
|
||||
|
||||
@@ -1793,6 +1867,44 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
double pMAC = conditions.macBuffer[pIDX];
|
||||
double p2MAC = conditions.macBuffer[p2IDX];
|
||||
|
||||
//
|
||||
// Detecting Bar Conditions ...
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION p2BarDir;
|
||||
|
||||
//
|
||||
// Rejected ...
|
||||
bool isP2BarRejected = helper
|
||||
.barAnalyser
|
||||
.IsRejected(
|
||||
p2Bar,
|
||||
p2BarDir,
|
||||
false, // Force Type ...
|
||||
true // Force Fibo Pressure ...
|
||||
);
|
||||
bool isP2BarBullishRejected =
|
||||
isP2BarRejected &&
|
||||
IsBullish(p2BarDir);
|
||||
bool isP2BarBearishRejected =
|
||||
isP2BarRejected &&
|
||||
IsBearish(p2BarDir);
|
||||
|
||||
//
|
||||
// Engulfed ...
|
||||
bool isP2BarEngulfed = helper
|
||||
.barAnalyser
|
||||
.IsEngulfed(
|
||||
p2Bar,
|
||||
p2BarDir //
|
||||
);
|
||||
bool isP2BarBullishEngulfed =
|
||||
isP2BarEngulfed &&
|
||||
IsBullish(p2BarDir);
|
||||
bool isP2BarBearishEngulfed =
|
||||
isP2BarEngulfed &&
|
||||
IsBearish(p2BarDir);
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
@@ -1924,6 +2036,45 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
p3Bar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Validate FVG based on Selection Type ...
|
||||
if (hasEndCondition && (selectRejectedFVGPivots ||
|
||||
selectEngulfedFVGPivots))
|
||||
{
|
||||
//
|
||||
// Checking Bar Passed ...
|
||||
|
||||
//
|
||||
bool canSelectUsingBar =
|
||||
selectRejectedFVGPivots ||
|
||||
selectEngulfedFVGPivots;
|
||||
|
||||
//
|
||||
bool isPivotRejected =
|
||||
selectRejectedFVGPivots &&
|
||||
(forBullish
|
||||
? isP2BarBullishRejected
|
||||
: isP2BarBearishRejected);
|
||||
|
||||
//
|
||||
bool isPivotEngulfed =
|
||||
selectEngulfedFVGPivots &&
|
||||
(forBullish
|
||||
? isP2BarBullishEngulfed
|
||||
: isP2BarBearishEngulfed);
|
||||
|
||||
bool isBarPassed =
|
||||
!canSelectUsingBar
|
||||
? true
|
||||
: (isPivotRejected ||
|
||||
isPivotEngulfed);
|
||||
|
||||
//
|
||||
hasEndCondition =
|
||||
isBarPassed &&
|
||||
hasEndCondition;
|
||||
}
|
||||
|
||||
//
|
||||
// ReInstance Pivot ...
|
||||
if (hasStartCondition)
|
||||
@@ -2052,7 +2203,7 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
void ValidateFVGs(
|
||||
void ValidateFVGPivots(
|
||||
XBoxZone &unavailables[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
@@ -2127,6 +2278,388 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
return ArraySize(fvgBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
bool DetectTrendPivot(
|
||||
int barIndex,
|
||||
ENUM_X_DIRECTION forDir,
|
||||
XOHCL &zBar,
|
||||
XOHCL &cBar,
|
||||
XOHCL &pBar,
|
||||
XOHCL &p2Bar,
|
||||
XCAEAConditions &conditions //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Checking Direction ...
|
||||
result = HasDirection(forDir);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool forBullish = IsBullish(forDir);
|
||||
bool forBearish = IsBearish(forDir);
|
||||
|
||||
//
|
||||
// Check Allowed ...
|
||||
result =
|
||||
forBullish
|
||||
? detectTrendBullishPivots
|
||||
: detectTrendBearishPivots;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
result =
|
||||
//
|
||||
barIndex >= 0 &&
|
||||
zBar.IsValid() &&
|
||||
cBar.IsValid() &&
|
||||
pBar.IsValid() &&
|
||||
p2Bar.IsValid()
|
||||
//
|
||||
;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Define Requirements ...
|
||||
|
||||
//
|
||||
int zIDX = 0;
|
||||
int cIDX = zIDX + 1;
|
||||
int pIDX = cIDX + 1;
|
||||
int p2IDX = pIDX + 1;
|
||||
|
||||
//
|
||||
datetime cTime = zBar.time;
|
||||
string symbol = zBar.symbol;
|
||||
ENUM_TIMEFRAMES period = zBar.period;
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
// Reading Conditional Values ...
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
double zTrend = conditions.trendBuffer[zIDX];
|
||||
double cTrend = conditions.trendBuffer[cIDX];
|
||||
double pTrend = conditions.trendBuffer[pIDX];
|
||||
double p2Trend = conditions.trendBuffer[p2IDX];
|
||||
|
||||
//
|
||||
// TREND State ...
|
||||
double zTrendState = conditions.trendStateBuffer[zIDX];
|
||||
double cTrendState = conditions.trendStateBuffer[cIDX];
|
||||
double pTrendState = conditions.trendStateBuffer[pIDX];
|
||||
double p2TrendState = conditions.trendStateBuffer[p2IDX];
|
||||
|
||||
//
|
||||
// Prepare Conditinal Conditions ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
bool isTrendBullish =
|
||||
cTrendState > 0;
|
||||
bool isTrendBullishPrev =
|
||||
pTrendState > 0;
|
||||
|
||||
//
|
||||
bool isTrendSwitchedToBullish = isTrendBullish &&
|
||||
!isTrendBullishPrev;
|
||||
bool isTrendFinishedFromBullish = !isTrendBullish &&
|
||||
isTrendBullishPrev;
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
|
||||
//
|
||||
bool isTrendBearish =
|
||||
cTrendState < 0;
|
||||
bool isTrendBearishPrev =
|
||||
pTrendState < 0;
|
||||
|
||||
//
|
||||
bool isTrendSwitchedToBearish = isTrendBearish &&
|
||||
!isTrendBearishPrev;
|
||||
bool isTrendFinishedFromBearish = !isTrendBearish &&
|
||||
isTrendBearishPrev;
|
||||
|
||||
//
|
||||
// Summarizing Conditions ...
|
||||
|
||||
//
|
||||
result = false;
|
||||
|
||||
//
|
||||
bool hasStartCondition =
|
||||
forBullish
|
||||
? isTrendFinishedFromBullish
|
||||
: isTrendFinishedFromBearish;
|
||||
bool hasContinuationCondition =
|
||||
forBullish
|
||||
? isTrendBullish
|
||||
: isTrendBearish;
|
||||
bool hasEndCondition =
|
||||
forBullish
|
||||
? isTrendSwitchedToBullish
|
||||
: isTrendSwitchedToBearish;
|
||||
|
||||
//
|
||||
// ReInstance Pivot ...
|
||||
if (hasStartCondition)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
if (forBullish)
|
||||
{
|
||||
//
|
||||
trendBullishPivot.Clean();
|
||||
|
||||
//
|
||||
trendBullishPivot.symbol = symbol;
|
||||
trendBullishPivot.period = period;
|
||||
trendBullishPivot.type = XCA_TREND_BULL;
|
||||
|
||||
//
|
||||
trendBullishPivot.to = pBar.time;
|
||||
trendBullishPivot.from = pBar.time;
|
||||
trendBullishPivot.value = pTrend;
|
||||
trendBullishPivot.reserve = pTrend;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (forBearish)
|
||||
{
|
||||
//
|
||||
trendBearishPivot.Clean();
|
||||
|
||||
//
|
||||
trendBearishPivot.symbol = symbol;
|
||||
trendBearishPivot.period = period;
|
||||
trendBearishPivot.type = XCA_TREND_BEAR;
|
||||
|
||||
//
|
||||
trendBearishPivot.to = pBar.time;
|
||||
trendBearishPivot.from = pBar.time;
|
||||
trendBearishPivot.value = pTrend;
|
||||
trendBearishPivot.reserve = pTrend;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate and Fill Pivot Requirements ...
|
||||
if (hasContinuationCondition)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
if (forBullish)
|
||||
{
|
||||
//
|
||||
trendBullishPivot.from = pBar.time;
|
||||
|
||||
//
|
||||
Add(
|
||||
pTrend,
|
||||
trendBullishPivot.values //
|
||||
);
|
||||
Add(
|
||||
pTrend,
|
||||
trendBullishPivot.values //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (forBearish)
|
||||
{
|
||||
//
|
||||
trendBearishPivot.from = pBar.time;
|
||||
|
||||
//
|
||||
Add(
|
||||
pTrend,
|
||||
trendBearishPivot.values //
|
||||
);
|
||||
Add(
|
||||
pTrend,
|
||||
trendBearishPivot.values //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// End up Pivot and Store it ...
|
||||
if (hasEndCondition)
|
||||
{
|
||||
//
|
||||
// Bullish ...
|
||||
if (forBullish)
|
||||
{
|
||||
//
|
||||
// Update Values ...
|
||||
trendBullishPivot.value = GetMin(trendBullishPivot.values);
|
||||
trendBullishPivot.reserve = GetMax(trendBullishPivot.values);
|
||||
|
||||
//
|
||||
result =
|
||||
trendBullishPivot.IsValid() &&
|
||||
trendBullishPivot.GetAge() >= pivotVerifications;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
result = trendBullishPivot.AsBox(iBox);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
newTrendBullishPivotDetected = AddBox(
|
||||
iBox,
|
||||
trendBullishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
trendBullishPivot.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
if (forBearish)
|
||||
{
|
||||
//
|
||||
// Update Values ...
|
||||
trendBearishPivot.value = GetMax(trendBearishPivot.values);
|
||||
trendBearishPivot.reserve = GetMin(trendBearishPivot.values);
|
||||
|
||||
//
|
||||
result =
|
||||
trendBearishPivot.IsValid() &&
|
||||
trendBearishPivot.GetAge() >= pivotVerifications;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
result = trendBearishPivot.AsBox(iBox);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
newTrendBearishPivotDetected = AddBox(
|
||||
iBox,
|
||||
trendBearishPivots //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
trendBearishPivot.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void ValidateTrendPivots(
|
||||
XBoxZone &unavailables[],
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
has = HasTrendBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ApplyValidationOnBoxes(
|
||||
trendBullishPivots,
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
has = HasTrendBearishPivots();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
ApplyValidationOnBoxes(
|
||||
trendBearishPivots,
|
||||
unavailables,
|
||||
barIndex //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
|
||||
//
|
||||
XCAPivot trendBullishPivot;
|
||||
XBoxZone trendBullishPivots[];
|
||||
bool detectTrendBullishPivots;
|
||||
bool newTrendBullishPivotDetected;
|
||||
|
||||
//
|
||||
bool HasTrendBullishPivots()
|
||||
{
|
||||
return HasChild(trendBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTrendBullishPivots()
|
||||
{
|
||||
return ArraySize(trendBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
|
||||
//
|
||||
XCAPivot trendBearishPivot;
|
||||
XBoxZone trendBearishPivots[];
|
||||
bool detectTrendBearishPivots;
|
||||
bool newTrendBearishPivotDetected;
|
||||
|
||||
//
|
||||
bool HasTrendBearishPivots()
|
||||
{
|
||||
return HasChild(trendBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
int CountTrendBearishPivots()
|
||||
{
|
||||
return ArraySize(trendBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -2378,6 +2911,8 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
peakPivot.Clean();
|
||||
valePivot.Clean();
|
||||
trendBullishPivot.Clean();
|
||||
trendBearishPivot.Clean();
|
||||
|
||||
//
|
||||
Clean(peakPivots);
|
||||
@@ -2386,6 +2921,10 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
Clean(fvgBullishPivots);
|
||||
Clean(fvgBearishPivots);
|
||||
|
||||
//
|
||||
Clean(trendBullishPivots);
|
||||
Clean(trendBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -2394,6 +2933,9 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
//
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
// PV ...
|
||||
|
||||
//
|
||||
// PEAK ...
|
||||
has = HasPeakPivots();
|
||||
@@ -2411,7 +2953,10 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// FVG Bullish ...
|
||||
// FVG ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
has = HasFVGBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
@@ -2419,12 +2964,31 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// FVG Bearish ...
|
||||
// Bearish ...
|
||||
has = HasFVGBearishPivots();
|
||||
if (has)
|
||||
{
|
||||
ApplySortOnBoxes(fvgBearishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
has = HasTrendBullishPivots();
|
||||
if (has)
|
||||
{
|
||||
ApplySortOnBoxes(trendBullishPivots);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
has = HasTrendBearishPivots();
|
||||
if (has)
|
||||
{
|
||||
ApplySortOnBoxes(trendBearishPivots);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -88,6 +88,8 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
bool drawValePivots;
|
||||
bool drawFVGBullishPivots;
|
||||
bool drawFVGBearishPivots;
|
||||
bool drawTrendBullishPivots;
|
||||
bool drawTrendBearishPivots;
|
||||
|
||||
//
|
||||
// Styling ...
|
||||
@@ -104,6 +106,10 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
XCAPivotStyle fvgBullishPivotStyle;
|
||||
XCAPivotStyle fvgBearishPivotStyle;
|
||||
|
||||
//
|
||||
XCAPivotStyle trendBullishPivotStyle;
|
||||
XCAPivotStyle trendBearishPivotStyle;
|
||||
|
||||
//
|
||||
// Constructors ...
|
||||
XCXCAEAPOIDrawer(
|
||||
@@ -141,8 +147,12 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
{
|
||||
//
|
||||
// Drawing ...
|
||||
drawPeakPivots = false;
|
||||
drawValePivots = false;
|
||||
drawFVGBullishPivots = false;
|
||||
drawFVGBearishPivots = false;
|
||||
drawTrendBullishPivots = false;
|
||||
drawTrendBearishPivots = false;
|
||||
|
||||
//
|
||||
// Styling ...
|
||||
@@ -171,18 +181,30 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
// FVG ...
|
||||
fvgBullishPivotStyle = defaultBullishStyle;
|
||||
fvgBearishPivotStyle = defaultBearishStyle;
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
trendBullishPivotStyle = defaultBullishStyle;
|
||||
trendBearishPivotStyle = defaultBearishStyle;
|
||||
}
|
||||
|
||||
//
|
||||
void Draw(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
// PV ...
|
||||
DrawPeakPivots(to);
|
||||
DrawValePivots(to);
|
||||
|
||||
//
|
||||
// FVG ...
|
||||
DrawFVGBullishPivots(to);
|
||||
DrawFVGBearishPivots(to);
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
DrawTrendBullishPivots(to);
|
||||
DrawTrendBearishPivots(to);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -244,6 +266,24 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
to //
|
||||
);
|
||||
break;
|
||||
|
||||
//
|
||||
case XCA_TREND_BULL:
|
||||
//
|
||||
DrawTrendBullishPivot(
|
||||
box,
|
||||
to //
|
||||
);
|
||||
break;
|
||||
|
||||
//
|
||||
case XCA_TREND_BEAR:
|
||||
//
|
||||
DrawTrendBearishPivot(
|
||||
box,
|
||||
to //
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +333,8 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
valePivotStyle.Clean();
|
||||
fvgBullishPivotStyle.Clean();
|
||||
fvgBearishPivotStyle.Clean();
|
||||
trendBullishPivotStyle.Clean();
|
||||
trendBearishPivotStyle.Clean();
|
||||
|
||||
//
|
||||
// Cleanup Pivot Objects Holder ...
|
||||
@@ -300,6 +342,8 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
mValePivotObjects.Clear();
|
||||
mFVGBullishPivotObjects.Clear();
|
||||
mFVGBearishPivotObjects.Clear();
|
||||
mTrendBullishPivotObjects.Clear();
|
||||
mTrendBearishPivotObjects.Clear();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -445,6 +489,76 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void DrawTrendBullishPivots(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
bool has = drawTrendBullishPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = detector.HasTrendBullishPivots();
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = detector.CountTrendBullishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = detector.trendBullishPivots[i];
|
||||
|
||||
//
|
||||
DrawTrendBullishPivot(
|
||||
iBox,
|
||||
to //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void DrawTrendBearishPivots(datetime to = NULL)
|
||||
{
|
||||
//
|
||||
bool has = drawTrendBearishPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = detector.HasTrendBearishPivots();
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = detector.CountTrendBearishPivots();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = detector.trendBearishPivots[i];
|
||||
|
||||
//
|
||||
DrawTrendBearishPivot(
|
||||
iBox,
|
||||
to //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// One Item Drawers ...
|
||||
|
||||
@@ -660,6 +774,112 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
void DrawTrendBullishPivot(
|
||||
XBoxZone &item,
|
||||
datetime to = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = drawTrendBullishPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = item.IsValid() &&
|
||||
item.type == GetBoxType(XCA_TREND_BULL) &&
|
||||
item.dir == GetDirection(XCA_TREND_BULL);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool canUpdateTo = IsValid(to);
|
||||
if (canUpdateTo)
|
||||
{
|
||||
// item.to = to;
|
||||
}
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Style Object ...
|
||||
ApplyPivotStyle(
|
||||
iObj,
|
||||
trendBullishPivotStyle //
|
||||
);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mTrendBullishPivotObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
void DrawTrendBearishPivot(
|
||||
XBoxZone &item,
|
||||
datetime to = NULL //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool has = drawTrendBearishPivots;
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
has = item.IsValid() &&
|
||||
item.type == GetBoxType(XCA_TREND_BEAR) &&
|
||||
item.dir == GetDirection(XCA_TREND_BEAR);
|
||||
if (!has)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool canUpdateTo = IsValid(to);
|
||||
if (canUpdateTo)
|
||||
{
|
||||
// item.to = to;
|
||||
}
|
||||
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
item,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
// Style Object ...
|
||||
ApplyPivotStyle(
|
||||
iObj,
|
||||
trendBearishPivotStyle //
|
||||
);
|
||||
|
||||
//
|
||||
// Store Object ...
|
||||
mTrendBearishPivotObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
// Protected ...
|
||||
protected:
|
||||
@@ -702,6 +922,10 @@ class XCXCAEAPOIDrawer : public XCBase
|
||||
CArrayObj mFVGBullishPivotObjects;
|
||||
CArrayObj mFVGBearishPivotObjects;
|
||||
|
||||
//
|
||||
CArrayObj mTrendBullishPivotObjects;
|
||||
CArrayObj mTrendBearishPivotObjects;
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
@@ -207,16 +207,12 @@ class XCXCAEASignaller : XCBase
|
||||
// drawer.Draw(cTime);
|
||||
|
||||
//
|
||||
drawer.DrawPeakPivots(cTime);
|
||||
drawer.DrawValePivots(cTime);
|
||||
drawer.DrawFVGBullishPivots(cTime);
|
||||
drawer.DrawFVGBearishPivots(cTime);
|
||||
// drawer.DrawRSICrossedOverOSPivots(cTime);
|
||||
// drawer.DrawRSICrossedUnderOBPivots(cTime);
|
||||
// drawer.DrawPeakResSWHPivots(cTime);
|
||||
// drawer.DrawValeSupSWLPivots(cTime);
|
||||
// drawer.DrawRSIPeakPivots(cTime);
|
||||
// drawer.DrawRSIValePivots(cTime);
|
||||
// drawer.DrawPeakPivots(cTime);
|
||||
// drawer.DrawValePivots(cTime);
|
||||
// drawer.DrawFVGBullishPivots(cTime);
|
||||
// drawer.DrawFVGBearishPivots(cTime);
|
||||
drawer.DrawTrendBullishPivots(cTime);
|
||||
drawer.DrawTrendBearishPivots(cTime);
|
||||
|
||||
//
|
||||
// Retrieve Valid Pviots ...
|
||||
@@ -828,7 +824,7 @@ class XCXCAEASignaller : XCBase
|
||||
inputs.caInputs.showMAL = false;
|
||||
inputs.caInputs.showMAC = true;
|
||||
inputs.caInputs.showVidya = false;
|
||||
inputs.caInputs.showTrend = false;
|
||||
inputs.caInputs.showTrend = true;
|
||||
inputs.caInputs.showSwings = false;
|
||||
inputs.caInputs.showLongCycle = false;
|
||||
inputs.caInputs.showHindCycle = false;
|
||||
@@ -887,7 +883,7 @@ class XCXCAEASignaller : XCBase
|
||||
// PV ...
|
||||
detector.applySwingsOnPVPivots = true;
|
||||
detector.selectRejectedPVPivots = true;
|
||||
detector.selectEngulfedPVPivots = true;
|
||||
detector.selectEngulfedPVPivots = true;
|
||||
detector.applySupportAndResistanceOnPVPivots = true;
|
||||
|
||||
//
|
||||
@@ -906,9 +902,22 @@ class XCXCAEASignaller : XCBase
|
||||
detector.applyPVToFVGBoundary = false;
|
||||
detector.detectFVGBullishPivots = true;
|
||||
detector.detectFVGBearishPivots = true;
|
||||
detector.selectRejectedFVGPivots = true;
|
||||
detector.selectEngulfedFVGPivots = true;
|
||||
detector.applyLastBarToFVGBoundary = false;
|
||||
detector.selectOnlyFVGWhichHasIndirectionalLastBar = true;
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
detector.detectTrendBullishPivots = true;
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
detector.detectTrendBearishPivots = true;
|
||||
|
||||
//
|
||||
// Initialize and Configure Drawer ...
|
||||
drawer = new XCXCAEAPOIDrawer(detector);
|
||||
@@ -922,6 +931,8 @@ class XCXCAEASignaller : XCBase
|
||||
drawer.drawValePivots = true;
|
||||
drawer.drawFVGBullishPivots = true;
|
||||
drawer.drawFVGBearishPivots = true;
|
||||
drawer.drawTrendBullishPivots = true;
|
||||
drawer.drawTrendBearishPivots = true;
|
||||
|
||||
//
|
||||
// Configure Styles ...
|
||||
@@ -968,6 +979,27 @@ class XCXCAEASignaller : XCBase
|
||||
drawer.fvgBearishPivotStyle = fvgBearishStyle;
|
||||
fvgBearishStyle.Clean();
|
||||
|
||||
//
|
||||
// TREND ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
XCAPivotStyle trendBullishStyle;
|
||||
trendBullishStyle.width = 2;
|
||||
trendBullishStyle.clr = clrLime;
|
||||
trendBullishStyle.style = STYLE_DOT;
|
||||
drawer.trendBullishPivotStyle = trendBullishStyle;
|
||||
trendBullishStyle.Clean();
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
XCAPivotStyle trendBearishStyle;
|
||||
trendBearishStyle.width = 2;
|
||||
trendBearishStyle.clr = clrRed;
|
||||
trendBearishStyle.style = STYLE_DOT;
|
||||
drawer.trendBearishPivotStyle = trendBearishStyle;
|
||||
trendBearishStyle.Clean();
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user