last ...
This commit is contained in:
@@ -500,6 +500,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
idx = i;
|
||||
signalBox = iBox;
|
||||
hasSignalBox = has;
|
||||
signalBox.to = cTime;
|
||||
signalBoxDir = iBox.dir;
|
||||
isSignalBoxReversal = false;
|
||||
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||
@@ -553,119 +554,25 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
if (!hasSignalBox)
|
||||
{
|
||||
//
|
||||
// Score Conditions ...
|
||||
double scoreMultiplier = 3;
|
||||
bool isBullishScorePassed =
|
||||
//
|
||||
analyseBullishScore > (analyseBearishScore * scoreMultiplier) &&
|
||||
decisionBullishScore > (decisionBearishScore * scoreMultiplier)
|
||||
//
|
||||
;
|
||||
bool isBearishScorePassed =
|
||||
//
|
||||
analyseBearishScore > (analyseBullishScore * scoreMultiplier) &&
|
||||
decisionBearishScore > (decisionBullishScore * scoreMultiplier)
|
||||
//
|
||||
;
|
||||
// Senari A ...
|
||||
|
||||
//
|
||||
// X3Ma ...
|
||||
|
||||
//
|
||||
// X3Ma Bullish ...
|
||||
bool isX3MaBullish =
|
||||
//
|
||||
decisionXConditions.isX3MaBullishState &&
|
||||
decisionXConditions.isX3MaSwitchedToBullishOrdered &&
|
||||
decisionXConditions.x3maMidBuffer[1] > decisionXConditions.x3maSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// X3Ma Bearish ...
|
||||
bool isX3MaBearish =
|
||||
//
|
||||
decisionXConditions.isX3MaBearishState &&
|
||||
decisionXConditions.isX3MaSwitchedToBearishOrdered &&
|
||||
decisionXConditions.x3maMidBuffer[1] < decisionXConditions.x3maSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isX3MaHasCondition =
|
||||
(isX3MaBullish &&
|
||||
isBullishScorePassed) ||
|
||||
(isX3MaBearish &&
|
||||
isBearishScorePassed);
|
||||
|
||||
//
|
||||
// VWap ...
|
||||
|
||||
//
|
||||
// VWap Bullish ...
|
||||
bool isVWapBullish =
|
||||
//
|
||||
decisionXConditions.isVWapBullishState &&
|
||||
decisionXConditions.isVWapSwitchedToBullishOrdered &&
|
||||
decisionXConditions.vwapMidBuffer[1] > decisionXConditions.vwapSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// VWap Bearish ...
|
||||
bool isVWapBearish =
|
||||
//
|
||||
decisionXConditions.isVWapBearishState &&
|
||||
decisionXConditions.isVWapSwitchedToBearishOrdered &&
|
||||
decisionXConditions.vwapMidBuffer[1] < decisionXConditions.vwapSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isVWapHasCondition =
|
||||
(isVWapBullish &&
|
||||
isBullishScorePassed) ||
|
||||
(isVWapBearish &&
|
||||
isBearishScorePassed);
|
||||
|
||||
//
|
||||
// Checking Other Conditions XWZ Reject on EMA 20 ...
|
||||
|
||||
//
|
||||
// Check Has Conditions ...
|
||||
bool hasXConditions =
|
||||
(isX3MaHasCondition ||
|
||||
isVWapHasCondition);
|
||||
|
||||
//
|
||||
if (hasXConditions)
|
||||
hasSignalBox = hasWorkingZone &&
|
||||
workingZone.DetectSenarioASignalBox(
|
||||
signalBox,
|
||||
signalBoxDir,
|
||||
decisionXConditions,
|
||||
analyseXConditions,
|
||||
decisionCycleHelper,
|
||||
drawer,
|
||||
zIndex //
|
||||
);
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
if (isX3MaHasCondition)
|
||||
{
|
||||
//
|
||||
signalBoxDir =
|
||||
isX3MaBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: isX3MaBearish
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
if (isVWapHasCondition)
|
||||
{
|
||||
//
|
||||
signalBoxDir =
|
||||
isVWapBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: isVWapBearish
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
Print("X Conditions ...");
|
||||
signalBox.to = cTime;
|
||||
isSignalBoxReversal = false;
|
||||
provider = X121SMC_XWZ_PROVIDER_PV_ZONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -711,10 +618,394 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
iObj.BoxWidth(1);
|
||||
iObj.BoxColor(clrYellow);
|
||||
iObj.BoxStyle(STYLE_SOLID);
|
||||
}
|
||||
|
||||
//
|
||||
isBullish = IsBullish(signalBoxDir);
|
||||
isBearish = IsBearish(signalBoxDir);
|
||||
|
||||
//
|
||||
pivot = isBullish
|
||||
? signalBox.lower
|
||||
: signalBox.upper;
|
||||
|
||||
//
|
||||
point = isBullish
|
||||
? signalBox.upper
|
||||
: signalBox.lower;
|
||||
|
||||
//
|
||||
double iSL = 0;
|
||||
double signalBoxRange = (signalBox.upper - signalBox.lower);
|
||||
if (signalBoxRange < points * 100)
|
||||
{
|
||||
iSL = pivot;
|
||||
}
|
||||
else
|
||||
{
|
||||
iSL = signalBox.lower + (signalBox.upper - signalBox.lower) / 2;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
iSL,
|
||||
sls //
|
||||
);
|
||||
|
||||
//
|
||||
// Targets ...
|
||||
|
||||
//
|
||||
// Based On Priority ...
|
||||
has = priority != X121SMC_XWZ_PRIORITY_NONE;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
switch (priority)
|
||||
{
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_WEAK:
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
Print("Signal Box Exists ...");
|
||||
case X121SMC_XWZ_PRIORITY_LOW:
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_REGULAR:
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// High ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// High ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
||||
//
|
||||
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// High ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Strong High ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
// Weak ...
|
||||
Add(
|
||||
workingZone.demandZone.Upper(),
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Low ...
|
||||
Add(
|
||||
workingZone.quarter3,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Regular ...
|
||||
Add(
|
||||
workingZone.quarter2,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// High ...
|
||||
Add(
|
||||
workingZone.quarter1,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
// Strong High ...
|
||||
Add(
|
||||
workingZone.supplyZone.Lower(),
|
||||
targets //
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone waitingBoxes[];
|
||||
has = workingZone.HasWaitingBoxes();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
workingZone.waitingBoxes,
|
||||
waitingBoxes //
|
||||
);
|
||||
|
||||
//
|
||||
while (HasChild(waitingBoxes))
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
idx = GetYoungest(waitingBoxes);
|
||||
has = IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
iBox = waitingBoxes[idx];
|
||||
ArrayRemove(
|
||||
waitingBoxes,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasInside = workingZone.HasInsideBox(iBox);
|
||||
if (!hasInside)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
double iTarget =
|
||||
IsBullish(signalBoxDir)
|
||||
? iBox.lower
|
||||
: iBox.upper;
|
||||
|
||||
//
|
||||
Add(
|
||||
iTarget,
|
||||
targets //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = hasPriority &&
|
||||
hasSignalBox &&
|
||||
hasRewardAmount;
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Copy(
|
||||
sls,
|
||||
mConditions.sls //
|
||||
);
|
||||
Copy(
|
||||
targets,
|
||||
mConditions.targets //
|
||||
);
|
||||
|
||||
//
|
||||
mConditions.pivot = pivot;
|
||||
mConditions.point = point;
|
||||
mConditions.reward = reward;
|
||||
mConditions.setupTime = cTime;
|
||||
mConditions.dir = signalBoxDir;
|
||||
mConditions.priority = priority;
|
||||
mConditions.provider = provider;
|
||||
mConditions.signalBox = signalBox;
|
||||
mConditions.amountPercent = amountPercent;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -953,6 +1244,18 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
? longSL
|
||||
: shortSL;
|
||||
|
||||
//
|
||||
// Add TP 2 as Target ...
|
||||
double risk = MathAbs(entry - sl);
|
||||
double reward2 = 2 * risk;
|
||||
double iTP2 = isBullish
|
||||
? entry + reward2
|
||||
: entry - reward2;
|
||||
Add(
|
||||
iTP2,
|
||||
conditions.targets //
|
||||
);
|
||||
|
||||
//
|
||||
conditions.sl = sl;
|
||||
conditions.triggerTime = cTime;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user