This commit is contained in:
2025-05-13 20:19:58 +03:30
parent 8a329570a5
commit 4b91fff5d9
9 changed files with 875 additions and 820 deletions
+11 -68
View File
@@ -1018,7 +1018,7 @@ class XCXCAEATradeManager : public XCBaseAlert
{
//
// Handle Risk Free On Targets ...
double targets[];
XTarget targets[];
Copy(
trades[idx].signal.targets,
targets //
@@ -1031,7 +1031,7 @@ class XCXCAEATradeManager : public XCBaseAlert
for (int j = 0; j < targetsCount; j++)
{
//
double jTarget = targets[j];
XTarget jTarget = targets[j];
//
int appliedTargetIDX = -1;
@@ -1053,8 +1053,8 @@ class XCXCAEATradeManager : public XCBaseAlert
iPosition.sl == 0
? true
: isLong
? iPosition.sl < jTarget
: iPosition.sl > jTarget;
? iPosition.sl < jTarget.target
: iPosition.sl > jTarget.target;
if (!has)
{
continue;
@@ -1062,23 +1062,23 @@ class XCXCAEATradeManager : public XCBaseAlert
//
double targetDelta = isLong
? jTarget + (targetDistance * points)
: jTarget - (targetDistance * points);
? jTarget.target + (targetDistance * points)
: jTarget.target - (targetDistance * points);
//
// Can Risk Free ...
bool canRF = jTarget > 0 &&
bool canRF = jTarget.target > 0 &&
(isLong
? jTarget > iPosition.entry
: jTarget < iPosition.entry) &&
? jTarget.target > iPosition.entry
: jTarget.target < iPosition.entry) &&
(isLong
? iPosition.price > targetDelta
: iPosition.price < targetDelta);
if (canRF)
{
//
double sl = jTarget;
double tp = iPosition.tp;
double sl = jTarget.target;
string comment = "RF On Target ...";
bool isModified = trader.Modify(
iPosition.ticket,
@@ -1097,64 +1097,7 @@ class XCXCAEATradeManager : public XCBaseAlert
ToString(iPosition.type) +
" Position: " +
ToString(iPosition.ticket) +
" RF On Traget: " + ToString(jTarget) +
" Successfully ...";
HandleReportProtector(message);
}
}
}
}
//
// Handle Partial Close on Specified Targets ...
has = !trades[idx].signal.isPartiallyClosed &&
trades[idx].signal.partialCloseOnTPLevel > 0 &&
trades[idx].signal.partialCloseMultiplier > 0;
if (has)
{
//
// Check Reward Touched ...
double iCurrReward = iPosition.CalculateTouchedReward();
has = iCurrReward >= trades[idx].signal.partialCloseOnTPLevel;
if (has)
{
//
// Check Volume Multiplier ...
double volumeMultiplier = trades[idx].signal.partialCloseMultiplier;
has = volumeMultiplier > 0 &&
volumeMultiplier <= 1;
if (has)
{
//
// Do Partial Closing ...
double volume = iPosition.volume * volumeMultiplier;
//
// Normalizing Volume ...
volume = NormalizeVolume(
volume,
iPosition.symbol //
);
//
string comment = "PC On Target ...";
has = trader.ClosePartial(
iPosition.ticket,
volume,
comment //
);
if (has)
{
//
// Update Model ...
trades[idx].signal.isPartiallyClosed = true;
//
string message = prefix +
ToString(iPosition.type) +
" Position: " +
ToString(iPosition.ticket) +
" PC (" + ToString(volume) + ") On Traget: " + ToString(iCurrReward) +
" RF On Traget: " + ToString(jTarget.target) +
" Successfully ...";
HandleReportProtector(message);
}
+8 -11
View File
@@ -1226,17 +1226,6 @@ bool DetectDecisionZone(
dir = X_DIRECTION_NONE;
}
//
// Check Box Size ...
double range = box.GetRange();
double maxAllowedBoxRange = 400;
double ponts = GetPoints(box.symbol);
bool isTooLarget = range > (maxAllowedBoxRange * points);
if (isTooLarget)
{
Print("Too Large ...");
}
//
// Check Box is Prepared or Not ...
result = box.IsValid();
@@ -1897,6 +1886,14 @@ bool CanTriggerCond2(
// Since Here TP Must Calculated
// Using R2R we Ignore Target ...
tp = 0;
// if (isBullish && zBar.close < decisionZone.upper)
// {
// tp = decisionZone.upper;
// }
// else if (isBearish && zBar.close > decisionZone.lower)
// {
// tp = decisionZone.lower;
// }
}
//
+46 -65
View File
@@ -261,6 +261,12 @@ class XCXCAEASignaller : XCBase
loopback //
);
//
// Here we Can Validate Decision Zone ...
if (hasDecisionZone)
{
}
//
// Make Signal Box UnAvailable ...
if (hasDecisionZone)
@@ -409,6 +415,13 @@ class XCXCAEASignaller : XCBase
int toIDX = conditions.decisionZone.ToIndex();
int fromIDX = conditions.decisionZone.FromIndex();
//
// Check Box Size ...
double maxAllowedBoxRange = 400;
double range = conditions.decisionZone.GetRange();
bool isTooLarge = range > (maxAllowedBoxRange * points);
double decisionMiddlePrice = conditions.decisionZone.GetMid();
//
XBoxZone decisionOBs[];
ENUM_XCA_PIVOTS allowedTypes[];
@@ -455,27 +468,37 @@ class XCXCAEASignaller : XCBase
//
// Checking Trigger Cond 1 ...
bool canTriggerCond1 = false;
// CanTriggerCond1(
// helper,
// conditions.decisionZone,
// triggerDir,
// sl,
// tp,
// barIndex //
// );
if (isTooLarge)
{
//
canTriggerCond1 = CanTriggerCond1(
helper,
conditions.decisionZone,
triggerDir,
sl,
tp,
iObjects,
barIndex //
);
}
//
// Checking Trigger Cond 2 ...
bool canTriggerCond2 = CanTriggerCond2(
helper,
conditions.decisionZone,
decisionOBs,
triggerDir,
sl,
tp,
iObjects,
barIndex //
);
bool canTriggerCond2 = false;
if (!isTooLarge)
{
//
canTriggerCond2 = CanTriggerCond2(
helper,
conditions.decisionZone,
decisionOBs,
triggerDir,
sl,
tp,
iObjects,
barIndex //
);
}
//
// Checking Trigger Cond 3 ...
@@ -490,63 +513,21 @@ class XCXCAEASignaller : XCBase
// barIndex //
// );
//
// Update Signal Box To ...
conditions.decisionZone.to = cTime;
//
// Draw Decision Zone ...
XCBoxObject *iDecisionObj;
has = helper.poiDrawer.DrawBox(
drawer.DrawBox(
conditions.decisionZone,
iDecisionObj //
cTime,
true, // Draw Middle Line ...
true // Ignore Type ...
);
if (has)
{
mObjects.Add(iDecisionObj);
}
ZeroMemory(iDecisionObj);
//
// Drw Box Range Middle ...
double decisionMiddlePrice = conditions.decisionZone.GetMid();
string iDecisionMiddleName = conditions.decisionZone.GetMiddleTag();
CChartObjectTrend *iDecisionMiddleObj;
iDecisionMiddleObj = new CChartObjectTrend();
has = iDecisionMiddleObj.Create(
0,
iDecisionMiddleName,
0,
conditions.decisionZone.from,
decisionMiddlePrice,
conditions.decisionZone.to,
decisionMiddlePrice //
);
if (has)
{
//
iDecisionMiddleObj.Width(2);
iDecisionMiddleObj.Style(STYLE_DASH);
//
color iColor =
conditions.decisionZone.IsBullish()
? clrAqua
: clrMagenta;
iDecisionMiddleObj.Color(iColor);
//
mObjects.Add(iDecisionMiddleObj);
}
ZeroMemory(iDecisionMiddleObj);
//
// Adding Drawn Objects to Drawn Stores ...
for (int i = 0; i < iObjects.Total(); i++)
{
mObjects.Add(iObjects.At(i));
}
// iObjects.Clear();
// ZeroMemory(iObjects);
//
// Summarizing Result ...