This commit is contained in:
2025-03-01 04:52:23 +03:30
parent c3bc38befb
commit 1d554ec21d
5 changed files with 882 additions and 429 deletions
+365 -34
View File
@@ -302,6 +302,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
X121Conditions visionXConditions = visionConditions.x121Conditions;
//
// Select Drawer Class ...
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
//
@@ -311,11 +312,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
double point = 0;
double targets[];
double reward = 0;
XBoxZone signalBox;
XOBFVG selectedZone;
double amountPercent = 0;
bool hasPriority = false;
bool hasSignalBox = false;
bool hasRewardAmount = false;
bool hasSelectedZone = false;
bool isSignalBoxReversal = false;
bool isSelectedZoneReversal = false;
bool hasSelectedConsolidationZone = false;
XConsolidationZone selectedConsolidationZone;
@@ -369,6 +373,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
bool hasWaitingZones = hasWorkingZone &&
workingZone.HasWaitingZones();
//
//
//
//
// Check Conditions if Has Inside Zones ...
bool hasInsideZones = hasWorkingZone &&
@@ -422,7 +430,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.HasBreakedZones();
if (hasBreakedZones)
{
//
if (!hasSelectedZone)
{
//
@@ -467,12 +475,189 @@ class XCX121SMCXWZSignalDetector : public XCBase
}
}
//
//
//
//
bool hasInsideBoxes = hasWorkingZone &&
workingZone.HasInsideBoxes();
if (hasInsideBoxes)
{
Print("Inside Boxes ...");
//
XOHCL zBar;
XOHCL cBar;
int count = 0;
bool has = false;
XBoxZone tmpSelectedBox;
int tmpSelectedBoxIDX = -1;
//
has = zBar.Init(
symbol,
period,
zIndex //
);
has = has &&
zBar.GetPreviousBar(cBar);
if (has)
{
//
count = workingZone.CountInsideBoxes();
for (int i = 0; i < count; i++)
{
//
tmpSelectedBox = workingZone.insideBoxes[i];
//
bool isBullish = tmpSelectedBox.IsBullish();
bool isBearish = tmpSelectedBox.IsBearish();
//
bool hasFiboPressure =
visionCycleHelper
.mBarAnalyser
.HasFiboPressure(
cBar,
tmpSelectedBox.dir,
X_FIBO_LEVEL_382 //
);
//
bool isBullishRejectedUpper =
cBar.low < tmpSelectedBox.upper &&
cBar.GetDown() > tmpSelectedBox.upper;
//
bool isBullishRejectedLower =
cBar.low < tmpSelectedBox.lower &&
cBar.GetDown() > tmpSelectedBox.lower;
//
bool isBearishRejectedUpper =
cBar.high > tmpSelectedBox.upper &&
cBar.GetUp() < tmpSelectedBox.upper;
//
bool isBearishRejectedLower =
cBar.high > tmpSelectedBox.lower &&
cBar.GetUp() < tmpSelectedBox.lower;
//
bool isBullishRejected =
// isBullishRejectedUpper ||
isBullishRejectedLower;
//
bool isBearishRejected =
isBearishRejectedUpper
// || isBearishRejectedLower
;
//
bool isMaWapBullish =
//
(decisionXConditions.isX3MaBullishState &&
decisionXConditions.isX3MaBullishOrdered)
//
&&
//
(decisionXConditions.isVWapBullishState &&
decisionXConditions.isVWapBullishOrdered)
//
;
//
bool isMaWapBearish =
//
(decisionXConditions.isX3MaBearishState &&
decisionXConditions.isX3MaBearishOrdered)
//
&&
//
(decisionXConditions.isVWapBearishState &&
decisionXConditions.isVWapBearishOrdered)
//
;
//
bool isX2MaWapInside =
//
(decisionXConditions.x3maFastBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.x3maMidBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.x3maFastBuffer[cIndex] > tmpSelectedBox.lower &&
decisionXConditions.x3maMidBuffer[cIndex] > tmpSelectedBox.lower)
//
&&
//
(decisionXConditions.vwapFastBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.vwapMidBuffer[cIndex] < tmpSelectedBox.upper &&
decisionXConditions.vwapFastBuffer[cIndex] > tmpSelectedBox.lower &&
decisionXConditions.vwapMidBuffer[cIndex] > tmpSelectedBox.lower)
//
;
//
bool isBullishConditions =
//
isBullish &&
isMaWapBearish &&
isX2MaWapInside &&
hasFiboPressure &&
isBullishRejected &&
cBar.low < cBar.GetDown()
//
;
//
bool isBearishConditions =
//
isBearish &&
isMaWapBullish &&
isX2MaWapInside &&
hasFiboPressure &&
isBearishRejected &&
cBar.high > cBar.GetUp()
//
;
//
has = isBullishConditions ||
isBearishConditions;
if (!has)
{
//
tmpSelectedBox.Clean();
continue;
}
//
tmpSelectedBoxIDX = i;
signalBox = tmpSelectedBox;
//
tmpSelectedBox.Clean();
break;
}
}
//
isSignalBoxReversal = false;
hasSignalBox = signalBox.IsValid();
if (hasSignalBox)
{
//
ArrayRemove(
workingZone.insideBoxes,
tmpSelectedBoxIDX,
1 //
);
}
//
zBar.Clean();
cBar.Clean();
tmpSelectedBox.Clean();
}
//
@@ -480,35 +665,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
workingZone.HasBreakedBoxes();
if (hasBreakedBoxes)
{
Print("Breaked Boxes ...");
}
//
// Checking Other Senario for Signals ...
// if (!hasWaitingZones &&
// !hasSelectedZone)
// {
// //
// bool has = false;
// ENUM_X_DIRECTION dir;
// //
// has = DetectX121Conditions(
// pivot,
// point,
// sls,
// targets,
// dir,
// analyseState,
// decisionState,
// decisionXConditions,
// drawer //
// );
// }
//
//
//
// Double Check and Prepare Signal Conditions ...
// including Targets and SLs ...
//
if (hasSelectedZone)
{
//
@@ -640,7 +807,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
mConditions.priority = priority;
mConditions.provider = provider;
mConditions.dir = selectedZoneDir;
mConditions.signalZone = selectedZone;
mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent;
}
@@ -654,6 +821,137 @@ class XCX121SMCXWZSignalDetector : public XCBase
selectedConsolidationZone.Clean();
}
//
if (hasSignalBox)
{
//
workingZone.mInsideZoneObjects.Clear();
workingZone.mBreakedZoneObjects.Clear();
workingZone.mWaitingZoneObjects.Clear();
workingZone.mWorkingZoneObjects.Clear();
//
XCBoxObject *iObj;
signalBox.to = cTime;
bool isCreated = drawer.CreateBox(
signalBox,
iObj //
);
//
if (isCreated)
{
//
iObj.BoxWidth(2);
iObj.BoxColor(clrYellow);
iObj.BoxStyle(STYLE_SOLID);
}
//
bool isSignalBoxBullishDir = signalBox.IsBullish();
//
// Calculate Priority ...
hasPriority =
hasWorkingZone &&
workingZone
.DetectPriority(
priority,
signalBox.dir,
zIndex,
period //
);
//
// Calculate Risk Reward Ration based on Priority ...
hasRewardAmount = CalculateRiskReward(
priority,
reward,
amountPercent //
);
//
// Calculate Pivot and Point ...
//
pivot =
isSignalBoxBullishDir
? signalBox.lower
: signalBox.upper;
//
point =
isSignalBoxBullishDir
? signalBox.upper
: signalBox.lower;
//
double defaultTarget =
isSignalBoxBullishDir
? signalBox.upper
: signalBox.lower;
Add(
defaultTarget,
targets //
);
//
// Detect SLs ...
double iAtr = decisionXConditions.atrBuffer[0];
iAtr *= 1.5;
//
double defaultSL =
isSignalBoxBullishDir
? decisionXConditions.valesBuffer[0] - iAtr
: decisionXConditions.peaksBuffer[0] + iAtr;
//
Add(
defaultSL,
sls //
);
//
// Summaries Conditions ...
result =
pivot > 0 &&
point > 0 &&
hasPriority &&
hasRewardAmount;
if (result)
{
//
isBullish = signalBox.IsBullish();
isBearish = signalBox.IsBearish();
//
Copy(
sls,
mConditions.sls //
);
Copy(
targets,
mConditions.targets //
);
//
mConditions.pivot = pivot;
mConditions.point = point;
mConditions.reward = reward;
mConditions.setupTime = cTime;
mConditions.priority = priority;
mConditions.provider = provider;
mConditions.dir = signalBox.dir;
mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent;
}
//
signalBox.Clean();
hasSignalBox = false;
}
//
UpdateTo(cTime);
@@ -664,15 +962,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
workingZone.Draw(
drawer,
true, // Draw Waiting Zones ..
true, // Draw Inside Zones ..
false, // Draw Breaked Zones ..
false, // Draw Supply Zone ..
false, // Draw Demand Zone ..
false, // Draw Supply Zones ..
false, // Draw Demand Zones ..
false, // Draw Support Zones ..
false // Draw Resistance Zones ..
true, // Draw Waiting Zones ...
true, // Draw Inside Zones ...
true, // Draw Breaked Zones ...
true, // Draw Supply Zone ...
true, // Draw Demand Zone ...
true, // Draw Supply Zones ...
true, // Draw Demand Zones ...
false, // Draw Support Zones ...
false // Draw Resistance Zones ...
);
//
@@ -698,6 +996,39 @@ class XCX121SMCXWZSignalDetector : public XCBase
// true, // Ignore BullishConsolidationZones ...
// true // Ignore BearishConsolidationZones ...
// );
// //
// int count = 0;
// bool has = false;
// //
// has = workingZone.HasSupplyZones();
// if (has)
// {
// }
// //
// has = workingZone.HasDemandZones();
// if (has)
// {
// //
// count = workingZone.CountDemandZones();
// for (int i = 0; i < count; i++)
// {
// //
// XCDemandZone *iZone = workingZone.demandZones[i];
// //
// XCDemandZoneObject *iObj;
// bool isCreated = drawer.CreateDemandZone(
// iZone,
// iObj //
// );
// }
// }
// //
// Print("");
}
//