last ...
This commit is contained in:
@@ -1365,11 +1365,12 @@ bool DetectSignalZone(
|
||||
|
||||
//
|
||||
// Summarize Result ...
|
||||
int requiredPushers = 1;
|
||||
result =
|
||||
(isBullish &&
|
||||
longPushers >= 3) ||
|
||||
longPushers >= requiredPushers) ||
|
||||
(isBearish &&
|
||||
shortPushers >= 3);
|
||||
shortPushers >= requiredPushers);
|
||||
|
||||
//
|
||||
// Preparing Signal Zone ...
|
||||
@@ -1443,7 +1444,7 @@ bool DetectSignalZone(
|
||||
|
||||
//
|
||||
Print("Conditions ...");
|
||||
signalZone.Clean();
|
||||
// signalZone.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1467,4 +1468,123 @@ bool DetectSignalZone(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Signal Zone is Breaked or Not ...
|
||||
*
|
||||
* @param helper: XCX121XCatbHelper instance pointer ...
|
||||
* @param box: XBoxZone instance reference ...
|
||||
* @param barIndex: int, Bar Index ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSignalZoneBreaked(
|
||||
XCX121XCatbHelper *helper,
|
||||
XBoxZone &box,
|
||||
int barIndex = 0 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Normalize Args ...
|
||||
barIndex = NormalizeInt(barIndex, 0);
|
||||
|
||||
//
|
||||
// Validate Args ...
|
||||
result =
|
||||
box.IsValid() &&
|
||||
helper != NULL;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
// Assume Box Invalid and Breaked
|
||||
// When Args not Valid ...
|
||||
result = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = box.IsBullish();
|
||||
bool isBearish = box.IsBearish();
|
||||
|
||||
//
|
||||
// Extract Bars ...
|
||||
|
||||
//
|
||||
XOHCL cBar;
|
||||
XOHCL pBar;
|
||||
XOHCL p2Bar;
|
||||
XOHCL p3Bar;
|
||||
|
||||
//
|
||||
result = cBar.Init(
|
||||
box.symbol,
|
||||
box.period,
|
||||
barIndex + 1 //
|
||||
);
|
||||
result = result &&
|
||||
cBar.GetPreviousBar(pBar);
|
||||
result = result &&
|
||||
pBar.GetPreviousBar(p2Bar);
|
||||
result = result &&
|
||||
p2Bar.GetPreviousBar(p3Bar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
|
||||
//
|
||||
// Assume Box Invalid and Breaked
|
||||
// When Args not Valid ...
|
||||
result = true;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Box is Breaked or not ...
|
||||
// a Box Assume Breakes when at least 3 Bars Close over / under applied Price ...
|
||||
|
||||
//
|
||||
double appliedPrice =
|
||||
isBullish
|
||||
? box.lower
|
||||
: box.upper;
|
||||
|
||||
//
|
||||
bool isBullishBreaked =
|
||||
isBullish &&
|
||||
cBar.close < appliedPrice &&
|
||||
pBar.close < appliedPrice &&
|
||||
p2Bar.close < appliedPrice;
|
||||
|
||||
//
|
||||
bool isBearishBreaked =
|
||||
isBearish &&
|
||||
cBar.close > appliedPrice &&
|
||||
pBar.close > appliedPrice &&
|
||||
p2Bar.close > appliedPrice;
|
||||
|
||||
//
|
||||
result = isBullishBreaked ||
|
||||
isBearishBreaked;
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user