last ...
This commit is contained in:
@@ -1300,12 +1300,12 @@ class XCBarAnalyser : public XCBase
|
||||
|
||||
/**
|
||||
* Check Specified Bar is Engulfing Bar or not ...
|
||||
*
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param dir: ENUM_X_DIRECTION member ...
|
||||
* @param extend: Integer ...
|
||||
* @param bodyPercent: Double ...
|
||||
*
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsEngulfBar(
|
||||
@@ -1402,6 +1402,208 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Specified Bar is Pin Bar or not ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param dir: ENUM_X_DIRECTION member ...
|
||||
* @param extend: Integer ...
|
||||
* @param shadowPercent: Double ...
|
||||
* @param bodyPercent: Double ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsPinBar(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
int extend = 1,
|
||||
double shadowPercent = 65,
|
||||
double bodyPercent = 25 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0 &&
|
||||
bodyPercent > 0 &&
|
||||
shadowPercent > 0 &&
|
||||
bodyPercent < shadowPercent;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Chack Range Extends ...
|
||||
if (extend > 0)
|
||||
{
|
||||
//
|
||||
result = HasExtendedRange(
|
||||
bar,
|
||||
extend //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Body ...
|
||||
double rangePercent = GetBarRangePercent(bar);
|
||||
|
||||
//
|
||||
double body = bar.GetBody();
|
||||
double highShadow = bar.GetHighShadow();
|
||||
double lowShadow = bar.GetLowShadow();
|
||||
|
||||
//
|
||||
// Check Body ...
|
||||
result = body / rangePercent >= bodyPercent;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isPassedHighShadow =
|
||||
highShadow / rangePercent >= shadowPercent;
|
||||
bool isPassedLowShadow =
|
||||
lowShadow / rangePercent >= shadowPercent;
|
||||
result =
|
||||
isPassedLowShadow ||
|
||||
isPassedHighShadow;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
dir = isPassedLowShadow
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Decision Bar (Pin, Momentum or Rejection) ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param dir: ENUM_X_DIRECTION member ...
|
||||
* @param extend: Integer ...
|
||||
* @param shadowForPinAndRejectionBarPercent: Double ...
|
||||
* @param bodyForPinBarPercent: Double ...
|
||||
* @param bodyForEngulfBarPercent: Double ...
|
||||
* @param bodyForMomentumBarPercent: Double ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsDecisionBar(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
int extend = 1,
|
||||
double shadowForPinAndRejectionBarPercent = 65,
|
||||
double bodyForPinBarPercent = 25,
|
||||
double bodyForEngulfBarPercent = 65,
|
||||
double bodyForMomentumBarPercent = 70 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Pin Bar ...
|
||||
ENUM_X_DIRECTION pinDir;
|
||||
bool isPiBar = IsPinBar(
|
||||
bar,
|
||||
pinDir,
|
||||
extend,
|
||||
shadowForPinAndRejectionBarPercent,
|
||||
bodyForPinBarPercent //
|
||||
);
|
||||
|
||||
//
|
||||
// Engulfing Bar ...
|
||||
ENUM_X_DIRECTION engulfDir;
|
||||
bool isEngulfBar = IsEngulfBar(
|
||||
bar,
|
||||
engulfDir,
|
||||
extend,
|
||||
bodyForEngulfBarPercent //
|
||||
);
|
||||
|
||||
//
|
||||
// Momentum Bar ...
|
||||
ENUM_X_DIRECTION momentumDir;
|
||||
bool isMomentumBar = IsMomentumBar(
|
||||
bar,
|
||||
momentumDir,
|
||||
extend,
|
||||
bodyForMomentumBarPercent //
|
||||
);
|
||||
|
||||
//
|
||||
// Rejection Bar ...
|
||||
ENUM_X_DIRECTION rejectionDir;
|
||||
bool isRejectionBar = IsRejectionBar(
|
||||
bar,
|
||||
rejectionDir,
|
||||
extend,
|
||||
shadowForPinAndRejectionBarPercent //
|
||||
);
|
||||
|
||||
//
|
||||
result = isPiBar ||
|
||||
isEngulfBar ||
|
||||
isMomentumBar ||
|
||||
isRejectionBar;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
if (isPiBar)
|
||||
{
|
||||
dir = pinDir;
|
||||
}
|
||||
else if (isEngulfBar)
|
||||
{
|
||||
dir = engulfDir;
|
||||
}
|
||||
else if (isMomentumBar)
|
||||
{
|
||||
dir = momentumDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
dir = rejectionDir;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = IsBullish(dir) ||
|
||||
IsBearish(dir);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Support and Resistance Zones ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user