last ...
This commit is contained in:
@@ -301,6 +301,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
X121Conditions consolidationXConditions = consolidationConditions.x121Conditions;
|
||||
X121Conditions visionXConditions = visionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Select Drawer Class ...
|
||||
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
|
||||
|
||||
//
|
||||
// Scores ...
|
||||
|
||||
@@ -323,8 +327,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
);
|
||||
|
||||
//
|
||||
// Select Drawer Class ...
|
||||
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Setup Conditions ...
|
||||
@@ -338,6 +342,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
double amountPercent = 0;
|
||||
bool hasPriority = false;
|
||||
bool hasSignalBox = false;
|
||||
bool hasWaitingZones = false;
|
||||
bool hasRewardAmount = false;
|
||||
bool isSignalBoxReversal = false;
|
||||
bool hasWorkingZoneOveralDirection = false;
|
||||
@@ -385,21 +390,22 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
decisionCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||
consolidationCycleHelper.mPOIDetector.MaxAllowedLoopbackForInit(578);
|
||||
|
||||
//
|
||||
// Update Working Zone ...
|
||||
workingZone.Update(
|
||||
zIndex,
|
||||
visionState,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
decisionState //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Working Zone Overal Direction ...
|
||||
hasWorkingZoneOveralDirection = workingZone
|
||||
.DetectOveralDirection(wzOveralDir);
|
||||
|
||||
//
|
||||
hasWaitingZones = workingZone.DetectZone(
|
||||
drawer,
|
||||
analysePoiEvents,
|
||||
consolidationPoiEvents,
|
||||
consolidationPoiEvents,
|
||||
consolidationState,
|
||||
analyseState,
|
||||
consolidationState //
|
||||
);
|
||||
|
||||
//
|
||||
// Checking Working Zone Destory or not ...
|
||||
bool isWorkingZoneDestroyed = workingZone.IsDestroyed(
|
||||
@@ -460,225 +466,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Waiting Box Detected ...
|
||||
bool hasWaitingBoxes = hasWorkingZone &&
|
||||
workingZone.HasWaitingBoxes();
|
||||
if (hasWaitingBoxes)
|
||||
{
|
||||
//
|
||||
XOHCL zBar;
|
||||
XOHCL cBar;
|
||||
XOHCL pBar;
|
||||
int count = 0;
|
||||
int idx = -1;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
bool isInited = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
isInited =
|
||||
isInited &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
isInited =
|
||||
isInited &&
|
||||
cBar.GetPreviousBar(pBar);
|
||||
|
||||
//
|
||||
count = workingZone.CountWaitingBoxes();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = workingZone.waitingBoxes[i];
|
||||
ENUM_X_DIRECTION iDir = iBox.dir;
|
||||
bool isBullish = IsBullish(iDir);
|
||||
|
||||
//
|
||||
// Check Price Rejection ...
|
||||
|
||||
//
|
||||
bool hasBullishFiboPressure =
|
||||
decisionCycleHelper
|
||||
.mBarAnalyser
|
||||
.HasFiboPressure(
|
||||
cBar,
|
||||
X_DIRECTION_BULLISH,
|
||||
X_FIBO_LEVEL_382 //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasBearishFiboPressure =
|
||||
decisionCycleHelper
|
||||
.mBarAnalyser
|
||||
.HasFiboPressure(
|
||||
cBar,
|
||||
X_DIRECTION_BEARISH,
|
||||
X_FIBO_LEVEL_382 //
|
||||
);
|
||||
|
||||
//
|
||||
// Bullish Rejection ...
|
||||
bool isBullishRejected =
|
||||
//
|
||||
isInited &&
|
||||
isBullish &&
|
||||
cBar.low < pBar.low &&
|
||||
zBar.low > iBox.upper &&
|
||||
cBar.low <= iBox.upper &&
|
||||
zBar.open > iBox.upper &&
|
||||
hasBullishFiboPressure &&
|
||||
cBar.GetLowShadow() > pBar.GetLowShadow()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// Bearish Rejection ...
|
||||
bool isBearishhRejected =
|
||||
//
|
||||
isInited &&
|
||||
!isBullish &&
|
||||
cBar.high > pBar.high &&
|
||||
zBar.open < iBox.lower &&
|
||||
zBar.high < iBox.lower &&
|
||||
hasBearishFiboPressure &&
|
||||
cBar.high >= iBox.lower &&
|
||||
cBar.GetHighShadow() > pBar.GetHighShadow()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has = isBullishRejected ||
|
||||
isBearishhRejected;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
idx = i;
|
||||
signalBox = iBox;
|
||||
hasSignalBox = has;
|
||||
signalBox.to = cTime;
|
||||
signalBoxDir = iBox.dir;
|
||||
isSignalBoxReversal = false;
|
||||
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Remove Signal Box from Waiting Boxes of
|
||||
// Working Zone ...
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
if (IsValidIndex(idx))
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
workingZone.waitingBoxes,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Ignore Zone's Signals ...
|
||||
hasSignalBox = false;
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions if Has Inside Boxes ...
|
||||
bool hasInsideBoxes = hasWorkingZone &&
|
||||
workingZone.HasInsideBoxes();
|
||||
if (hasInsideBoxes)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions if has Breaked Boxes ...
|
||||
bool hasBreakedBoxes = hasWorkingZone &&
|
||||
workingZone.HasBreakedBoxes();
|
||||
if (hasBreakedBoxes)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Other Conditions ...
|
||||
if (!hasSignalBox)
|
||||
{
|
||||
//
|
||||
// Senari A ...
|
||||
hasSignalBox = hasWorkingZone &&
|
||||
workingZone.DetectSenarioASignalBox(
|
||||
signalBox,
|
||||
signalBoxDir,
|
||||
decisionXConditions,
|
||||
analyseXConditions,
|
||||
decisionCycleHelper,
|
||||
drawer,
|
||||
zIndex //
|
||||
);
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
signalBox.to = cTime;
|
||||
isSignalBoxReversal = false;
|
||||
provider = X121SMC_XWZ_PROVIDER_PV_ZONE;
|
||||
}
|
||||
|
||||
//
|
||||
// Validating Signal Box if Exists ...
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
// Validate Signal Boxes using Inside Box ...
|
||||
if (hasInsideBoxes)
|
||||
{
|
||||
//
|
||||
int idx = -1;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
idx =
|
||||
IsBullish(signalBoxDir)
|
||||
? GetLowest(workingZone.insideBoxes)
|
||||
: GetHighest(workingZone.insideBoxes);
|
||||
has = IsValidIndex(idx);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
hasSignalBox =
|
||||
signalBoxDir == workingZone.insideBoxes[idx].dir;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Signal Box Using Overal Trend ...
|
||||
if (hasWorkingZoneOveralDirection)
|
||||
{
|
||||
//
|
||||
hasSignalBox =
|
||||
signalBoxDir == wzOveralDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Cleanup Signal if UnApproved ...
|
||||
if (!hasSignalBox)
|
||||
@@ -798,13 +585,13 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
// Force Add TP 2 as Target ...
|
||||
double risk = MathAbs(entry - sl);
|
||||
double reward2 = 2 * risk;
|
||||
double iTP2 = isBullish
|
||||
? entry + reward2
|
||||
: entry - reward2;
|
||||
Add(
|
||||
iTP2,
|
||||
targets //
|
||||
);
|
||||
// double iTP2 = isBullish
|
||||
// ? entry + reward2
|
||||
// : entry - reward2;
|
||||
// Add(
|
||||
// iTP2,
|
||||
// targets //
|
||||
// );
|
||||
|
||||
//
|
||||
// Based On Priority ...
|
||||
@@ -1070,63 +857,6 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1172,17 +902,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
workingZone.Draw(
|
||||
drawer,
|
||||
//
|
||||
true, // Draw Waiting Boxes ...
|
||||
true, // Draw Inside Boxes ...
|
||||
true, // Draw Breaked Boxes ...
|
||||
//
|
||||
true, // Draw Supply Zone ...
|
||||
true, // Draw Demand Zone ...
|
||||
true, // Draw Supply Zones ...
|
||||
true, // Draw Demand Zones ...
|
||||
true, // Draw Support Zones ...
|
||||
true // Draw Resistance Zones ...
|
||||
true // Draw Waiting Zones ...
|
||||
//
|
||||
);
|
||||
|
||||
//
|
||||
if (hasWaitingZones)
|
||||
{
|
||||
Print("Has Waiting Zones ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user