This commit is contained in:
2025-01-02 13:24:37 +03:30
parent 1c169cebe2
commit 410c6793ae
8 changed files with 795 additions and 266 deletions
@@ -519,15 +519,22 @@ class XC121SMCCycleHelper : public XCBase
return result;
}
/**
* Detect Market Structure ...
*
* @param model: XMarketStructure instance Reference ...
*
* @return ( bool )
*/
bool DetectMarketStructure(
ENUM_X_DIRECTION &dir //
XMarketStructure &model //
)
{
//
bool result = false;
//
dir = X_DIRECTION_NONE;
model.Clean();
//
int barIndex = 0;
@@ -536,6 +543,10 @@ class XC121SMCCycleHelper : public XCBase
string symbol = GetSymbol();
ENUM_TIMEFRAMES period = GetPeriod();
//
model.symbol = symbol;
model.period = period;
//
int highestPeakIndex = -1;
double highestPeakVale = 0;
@@ -565,7 +576,7 @@ class XC121SMCCycleHelper : public XCBase
}
//
dir =
model.bias =
highestPeakIndex < lowestValeIndex
? X_DIRECTION_BEARISH
: highestPeakIndex > lowestValeIndex
@@ -573,14 +584,14 @@ class XC121SMCCycleHelper : public XCBase
: X_DIRECTION_NONE;
//
result = HasDirection(dir);
result = HasDirection(model.bias);
if (!result)
{
return result;
}
//
bool isBullish = IsBullish(dir);
bool isBullish = IsBullish(model.bias);
//
// Looking for Change Of Character Proved ...
@@ -714,14 +725,10 @@ class XC121SMCCycleHelper : public XCBase
// based on Detected Range ...
//
XPVPivotPoint vales[];
XPVPivotPoint peaks[];
XPVPivotPoint iPeakPoint;
XPVPivotPoint iValePoint;
XPriceZones peakPriceZone;
XPriceZones valePriceZone;
XPriceZones peakPriceZones[];
XPriceZones valePriceZones[];
//
XPOIState state;
@@ -730,7 +737,7 @@ class XC121SMCCycleHelper : public XCBase
);
//
int minRepetition = 5; // ValidPivotRepetition();
int minRepetition = 5;
//
int from =
@@ -788,13 +795,13 @@ class XC121SMCCycleHelper : public XCBase
//
AddRef(
iPeakPoint,
peaks //
model.peaks //
);
//
AddRef(
peakPriceZone,
peakPriceZones //
model.peakPriceZones //
);
}
@@ -838,13 +845,13 @@ class XC121SMCCycleHelper : public XCBase
//
AddRef(
iValePoint,
vales //
model.vales //
);
//
AddRef(
valePriceZone,
valePriceZones //
model.valePriceZones //
);
}
@@ -865,306 +872,102 @@ class XC121SMCCycleHelper : public XCBase
// in Bearish Bias we Looking for Peaks Oder ...
//
// Draw ...
XCBaseObject *drawnObjects[];
//
// Bearish Bias ...
// Bullish Bias Drawn ...
if (isBullish)
{
//
// Draw Lowest Vale Bar ...
XOHCL lowestValeBar;
result = GetBar(
lowestValeBar,
model.lowestValeBar,
lowestValeIndex //
);
if (!result)
{
return result;
}
XCOHCLObject *iLowestValeBarObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
lowestValeBar,
iLowestValeBarObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iLowestValeBarObj,
drawnObjects //
);
}
//
// Draw Lowest Vale Peak Breaker Bar ...
XOHCL lowestValePeakBreakeUpBar;
if (isValidBreakeUpLowestValePeak)
{
//
result = GetBar(
lowestValePeakBreakeUpBar,
model.lowestValePeakBreakeUpBar,
lowestValePeakBreakeUpIndex //
);
if (!result)
{
return result;
}
//
XCOHCLObject *iObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
lowestValePeakBreakeUpBar,
iObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Draw Vale Above Lowest Vale Peak ...
XOHCL valeAboveLowestValePeakBar;
if (isValidValeAboveLowestValePeak)
{
//
result = GetBar(valeAboveLowestValePeakBar,
valeAboveLowestValePeakIndex //
result = GetBar(
model.valeAboveLowestValePeakBar,
valeAboveLowestValePeakIndex //
);
if (!result)
{
return result;
}
//
XCOHCLObject *iObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
valeAboveLowestValePeakBar,
iObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Draw Vales ...
int valesCount = ArraySize(vales);
if (IsValidSize(valesCount))
{
//
for (int i = 0; i < valesCount; i++)
{
//
iValePoint = vales[i];
//
CChartObjectTrend *iValeObj;
iValeObj = new CChartObjectTrend();
//
string iValeName = "XVALE_" + ToString(iValePoint.value);
//
long chartID = mPOIDetector.mDrawer.ChartIdentification();
int window = mPOIDetector.mDrawer.SubWindowIdentification();
//
bool isCreate = iValeObj.Create(
chartID,
iValeName,
window,
iValePoint.time,
iValePoint.value,
TimeCurrent(),
iValePoint.value //
);
if (isCreated)
{
}
}
}
//
// Draw Price Zone ...
valesCount = ArraySize(valePriceZones);
if (IsValidSize(valesCount))
{
//
for (int i = 0; i < valesCount; i++)
{
//
XPriceZones iZone = valePriceZones[i];
//
bool hasSupport = iZone.HasSupportZone();
if (hasSupport)
{
//
XCSupportZoneObject *iObj;
bool isCreated = mPOIDetector.mDrawer.CreateSupportZone(
iZone.supportZone,
iObj //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
}
}
}
//
// Bullish Bias Drawn ...
// Bearish Bias Drawn ...
if (!isBullish)
{
//
// Draw Highest Peak Bar ...
XOHCL highestPeakBar;
result = GetBar(
highestPeakBar,
model.highestPeakBar,
highestPeakIndex //
);
if (!result)
{
return result;
}
XCOHCLObject *iHighestPeakBarObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
highestPeakBar,
iHighestPeakBarObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iHighestPeakBarObj,
drawnObjects //
);
}
//
// Draw Highest Peak Vale Breaker Bar ...
XOHCL highestPeakValeBreakeDownBar;
if (isValidBreakeDownHighestPeakVale)
{
//
result = GetBar(
highestPeakValeBreakeDownBar,
model.highestPeakValeBreakeDownBar,
highestPeakValeBreakeDownIndex //
);
if (!result)
{
return result;
}
//
XCOHCLObject *iObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
highestPeakValeBreakeDownBar,
iObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Draw Peak Below Highest Peak Vale ...
XOHCL peakBelowHighestPeakValeBar;
if (isValidPeakBelowHighestPeakVale)
{
//
result = GetBar(peakBelowHighestPeakValeBar,
peakBelowHighestPeakValeIndex //
result = GetBar(
model.peakBelowHighestPeakValeBar,
peakBelowHighestPeakValeIndex //
);
if (!result)
{
return result;
}
//
XCOHCLObject *iObj;
bool isCreated = mPOIDetector.mDrawer.CreateBar(
peakBelowHighestPeakValeBar,
iObj,
TimeCurrent() //
);
if (isCreated)
{
//
Add(
(XCBaseObject *)iObj,
drawnObjects //
);
}
}
//
// Draw Peaks ...
int peaksCount = ArraySize(peaks);
if (IsValidSize(peaksCount))
{
//
for (int i = 0; i < peaksCount; i++)
{
//
iPeakPoint = peaks[i];
//
CChartObjectTrend *iPeakObj;
iPeakObj = new CChartObjectTrend();
//
string iPeakName = "XPEAK_" + ToString(iPeakPoint.value);
//
long chartID = mPOIDetector.mDrawer.ChartIdentification();
int window = mPOIDetector.mDrawer.SubWindowIdentification();
//
bool isCreate = iPeakObj.Create(
chartID,
iPeakName,
window,
iPeakPoint.time,
iPeakPoint.value,
TimeCurrent(),
iPeakPoint.value //
);
if (isCreated)
{
}
}
}
}
//
result = model.IsValid();
//
// TODO: Remove this ...
XCBaseObject *objects[];
int dObjects = mPOIDetector.mDrawer.DrawMarketStructure(
model,
objects //
);
//
return result;
}
@@ -246,8 +246,7 @@ bool DetectX121SMCTestSiganlSetup(
//
int zoneValidationDivider = 10;
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
int validPivotRepetition = 10;
//
double selectedSL = 0;
@@ -492,8 +491,7 @@ bool DetectX121SMCTestSiganlTrigger(
//
int zoneValidationDivider = 10;
int validPivotRepetition = triggerCycleHelper.mX121Helper
.GetDonChainLength();
int validPivotRepetition = 10;
//
double selectedSL = 0;
@@ -647,10 +647,10 @@ bool DetectX121SMCXTWPVSiganlSetup(
// Setup Conditions ...
//
ENUM_X_DIRECTION biasDir;
XMarketStructure marketStructure;
bool hasMarketStructure =
analyseCycleHelper
.DetectMarketStructure(biasDir);
.DetectMarketStructure(marketStructure);
//
XOHCL analyseCBar;
@@ -693,14 +693,14 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
x121Inputs.showFibo4Levels = false;
//
x121Inputs.showSar = false;
x121Inputs.showSar = true;
x121Inputs.showPeaks = true;
x121Inputs.showVales = true;
x121Inputs.showVWap = false;
x121Inputs.showDonchain = true;
//
x121Inputs.showOpen = true;
x121Inputs.showOpen = false;
x121Inputs.showHigh = true;
x121Inputs.showClose = true;
x121Inputs.showLow = true;