last works on XFima Strategy 2 Signalling ...

This commit is contained in:
2025-10-14 02:13:26 +03:30
parent ba2231664a
commit 2271df30c7
8 changed files with 922 additions and 204 deletions
+39 -34
View File
@@ -2685,40 +2685,47 @@ class XCMarketPatternDetector : public XCBase
if (result)
{
//
// Update Quarter ...
UpdateZones(
bar,
analysis.quarterActions,
config.quarterZonesValidationLength, // Zones Validation Length ...
config.quarterZonesRequiredToStart, // Zones Count to Start Processing ...
config.quarterZoneDetectionLoopback // Zones Detection Loopback ...
);
// Retrieve Previous Bar ...
XOHCL pBar;
has = bar.GetPreviousBar(pBar);
if (has)
{
//
// Update Quarter ...
UpdateZones(
bar,
analysis.quarterActions,
config.quarterZonesValidationLength, // Zones Validation Length ...
config.quarterZonesRequiredToStart, // Zones Count to Start Processing ...
config.quarterZoneDetectionLoopback // Zones Detection Loopback ...
);
//
// Fill Quarter Props ...
analysis.majorSupport = majorSupport;
analysis.minorSupport = minorSupport;
analysis.quarter = CalculateQuarter();
analysis.majorResistance = majorResistance;
analysis.minorResistance = minorResistance;
//
// Fill Quarter Props ...
analysis.majorSupport = majorSupport;
analysis.minorSupport = minorSupport;
analysis.quarter = CalculateQuarter();
analysis.majorResistance = majorResistance;
analysis.minorResistance = minorResistance;
//
// Update To Times ...
if (analysis.majorSupport.IsValid())
{
analysis.majorSupport.to = bar.time;
}
if (analysis.minorSupport.IsValid())
{
analysis.minorSupport.to = bar.time;
}
if (analysis.majorResistance.IsValid())
{
analysis.majorResistance.to = bar.time;
}
if (analysis.minorResistance.IsValid())
{
analysis.minorResistance.to = bar.time;
//
// Update To Times ...
if (analysis.majorSupport.IsValid())
{
analysis.majorSupport.to = bar.time;
}
if (analysis.minorSupport.IsValid())
{
analysis.minorSupport.to = bar.time;
}
if (analysis.majorResistance.IsValid())
{
analysis.majorResistance.to = bar.time;
}
if (analysis.minorResistance.IsValid())
{
analysis.minorResistance.to = bar.time;
}
}
}
@@ -3160,7 +3167,6 @@ class XCMarketPatternDetector : public XCBase
X_DETECTOR_ZONE_ACTION_MINOR_SUPPORT_RETESTED,
actions //
);
Print("Quarter: ", quarter);
}
//
@@ -3352,7 +3358,6 @@ class XCMarketPatternDetector : public XCBase
X_DETECTOR_ZONE_ACTION_MINOR_RESISTANCE_RETESTED,
actions //
);
Print("Quarter: ", quarter);
}
//
+110 -2
View File
@@ -1296,7 +1296,6 @@ class XCPOIDrawer : public XCBase
style.Clean();
}
//
// SPecial Draws Functions ...
@@ -1513,6 +1512,7 @@ class XCPOIDrawer : public XCBase
ENUM_X_DIRECTION patternDir;
//
datetime cTime = TimeCurrent();
int patternsPivotThresholdMultiplier = 0;
//
@@ -2379,6 +2379,114 @@ class XCPOIDrawer : public XCBase
}
}
//
// Quarters ...
has = config.drawQuarterZones &&
analysis.IsQuarterReady();
if (has)
{
//
// Draw Majors ...
has = config.drawQuarterMajors;
if (has)
{
//
// Support ...
has = analysis.HasMajorSupport();
if (has)
{
//
analysis.majorSupport.to = cTime;
DrawZone(
analysis.majorSupport,
config.quarterMajorsDrawConfig //
);
}
//
// Resistance ...
has = analysis.HasMajorResistance();
if (has)
{
//
analysis.majorResistance.to = cTime;
DrawZone(
analysis.majorResistance,
config.quarterMajorsDrawConfig //
);
}
}
//
// Draw Minors ...
if (config.drawQuarterMinors)
{
//
// Support ...
has = analysis.HasMinorSupport();
if (has)
{
//
analysis.minorSupport.to = cTime;
DrawZone(
analysis.minorSupport,
config.quarterMinorsDrawConfig //
);
}
//
// Resistance ...
has = analysis.HasMinorResistance();
if (has)
{
//
analysis.minorResistance.to = cTime;
DrawZone(
analysis.minorResistance,
config.quarterMinorsDrawConfig //
);
}
}
//
// Draw Quarter ...
if (config.drawQuarter &&
analysis.quarter > 0)
{
//
double quarter = analysis.quarter;
//
datetime quarterFrom = MathMin(analysis.majorResistance.from,
analysis.majorSupport.from);
datetime quarterTo = cTime;
string quarterName = "XQuarter_" + ToXString(quarter) + "_" + ToXString(TimeToSeconds(quarterFrom));
//
CChartObjectTrend *iObj;
has = DrawTrendLine(
quarter,
quarterFrom,
quarter,
quarterTo,
iObj,
quarterName,
false, // Ray Right ...
false // Ray Left ...
);
if (has)
{
//
iObj.Width(config.quarterWidth);
iObj.Color(config.quarterColor);
iObj.Style(config.quarterStyle);
//
drawnObjects.Add(iObj);
}
}
}
//
// Cleanup Resources ...
patternBar.Clean();
@@ -2388,7 +2496,7 @@ class XCPOIDrawer : public XCBase
/**
* Draw Specified Pivots Analysis ...
*
*
* @param analysis: XPivotAnalysis, reference to Specified Pivot Analysis ...
* @param config: XPivotAnalysisDrawConfig, reference to Provide Drawing Configuration ...
*/
+81 -6
View File
@@ -577,7 +577,8 @@ class XCTarget : public XCBase
//
// Do Risk Free if Provided ...
if (target.doRF)
if (result &&
target.doRF)
{
//
comment = "Taregt Manager do RF ...";
@@ -590,13 +591,48 @@ class XCTarget : public XCBase
//
// Handle Alert ...
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on: " + ToXString(position.price);
alert.SendAlert(message);
if (result)
{
//
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on: " + ToXString(position.price);
alert.SendAlert(message);
}
}
//
// Do Risk Free on Entry if Provided ...
if (result &&
target.doRFOnEntry)
{
//
comment = "Target Manager do RF on Entry ...";
double actingDistance = position.GetPointsValue() * target.actingDistance;
bool isLong = IsLong(position.type);
double sl = position.entry + (isLong
? actingDistance
: (-1 * actingDistance) //
);
result = trader.Modify(
position.ticket,
sl, // SL ...
position.tp, // TP ...
comment //
);
//
// Handle Alert ...
if (result)
{
//
message = "Target Manager do RF " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") on Entry ...";
alert.SendAlert(message);
}
}
//
// Do Partial Close if Provided ...
if (result && target.volumeMultiplier > 0)
if (result &&
target.volumeMultiplier > 0)
{
//
double volume = NormalizeVolume((position.volume * target.volumeMultiplier), position.symbol);
@@ -612,8 +648,47 @@ class XCTarget : public XCBase
//
// Handle Alert ...
message = "Target Manager do Partial Close " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") by: " + ToXString(volume);
alert.SendAlert(message);
if (result)
{
//
message = "Target Manager do Partial Close " + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") by: " + ToXString(volume);
alert.SendAlert(message);
}
}
}
//
// Handle Replace TP ...
if (result &&
target.tpValue > 0)
{
//
// Validate TP Value ...
bool isLong = IsLong(position.type);
bool isValid = isLong
? target.tpValue > position.price &&
target.tpValue > position.tp
: target.tpValue < position.price &&
target.tpValue < position.tp;
if (isValid)
{
//
comment = "Target Manager Change TP ...";
result = trader.Modify(
position.ticket,
position.sl, // SL ...
target.tpValue, // TP ...
comment //
);
//
// Handle Alert ...
if (result)
{
//
message = "Target Manager Change TP of" + ToXString(position.type) + " Position (" + ToXString(position.ticket) + ") to: " + ToXString(target.tpValue) + " ...";
alert.SendAlert(message);
}
}
}