last ...
This commit is contained in:
@@ -962,7 +962,7 @@ bool DetectDecisionZone(
|
||||
|
||||
//
|
||||
// Custom Senarios ...
|
||||
|
||||
|
||||
//
|
||||
bool isCond1Bullish =
|
||||
//
|
||||
@@ -1627,6 +1627,126 @@ bool CanTriggerCond2(
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Trigger Based On Decision Zone's
|
||||
// Block Based Triggering ...
|
||||
bool CanTriggerCond3(
|
||||
XCXCAEAHelper *helper,
|
||||
XBoxZone &box,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
double &sl,
|
||||
double &tp,
|
||||
int barIndex = 0,
|
||||
int loopback = 10 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Normalize Args ...
|
||||
sl = 0;
|
||||
tp = 0;
|
||||
dir = X_DIRECTION_NONE;
|
||||
loopback = NormalizeInt(loopback, 5);
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
|
||||
//
|
||||
// Validate Decision Box ...
|
||||
result = box.IsValid() &&
|
||||
helper != NULL;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect At Least one Outside Bar ...
|
||||
// TODO: Complete this ...
|
||||
|
||||
//
|
||||
// Add Support for a Breaked Swing as Liquidity ...
|
||||
// for Improve Validations ...
|
||||
// TODO: Complete this ...
|
||||
|
||||
//
|
||||
// Detect Block Based Trigger ...
|
||||
XBoxZone ob;
|
||||
XOHCL swing;
|
||||
XOHCL breaker;
|
||||
XOHCL outSide;
|
||||
ENUM_X_DIRECTION passedDir;
|
||||
bool isPassed = helper.IsBlockBasedTriggerBar(
|
||||
ob,
|
||||
swing,
|
||||
breaker,
|
||||
outSide,
|
||||
passedDir,
|
||||
barIndex + 1, // Bar Index ...
|
||||
30, // Loopback ...
|
||||
3 // Swing Length ...
|
||||
);
|
||||
bool isBullishPassed =
|
||||
isPassed &&
|
||||
ob.IsBullish() &&
|
||||
box.IsBullish() &&
|
||||
ob.upper < box.upper &&
|
||||
ob.lower > box.lower;
|
||||
bool isBearishPassed =
|
||||
isPassed &&
|
||||
ob.IsBearish() &&
|
||||
box.IsBearish() &&
|
||||
ob.upper < box.upper &&
|
||||
ob.lower > box.lower;
|
||||
|
||||
//
|
||||
// Summarizing ...
|
||||
|
||||
//
|
||||
bool canTriggerLong =
|
||||
isBullishPassed;
|
||||
|
||||
//
|
||||
bool canTriggerShort =
|
||||
isBearishPassed;
|
||||
|
||||
//
|
||||
result = canTriggerLong ||
|
||||
canTriggerShort;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
dir = canTriggerLong
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
// Preparing TP and SL ...
|
||||
|
||||
//
|
||||
sl = canTriggerLong
|
||||
? ob.lower
|
||||
: ob.upper;
|
||||
|
||||
//
|
||||
// Since Here TP Must Calculated
|
||||
// Using R2R we Ignore Target ...
|
||||
tp = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
ob.Clean();
|
||||
swing.Clean();
|
||||
breaker.Clean();
|
||||
outSide.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Helper Functions ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user