Complete Rejection Bars ...
This commit is contained in:
@@ -71,7 +71,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
|
||||
//
|
||||
// Apply Default Configurations ...
|
||||
ApplyDefaultConfig();
|
||||
Default();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -203,6 +203,120 @@ class XCPOIDetector : public XCBaseAlert
|
||||
mSwingRange = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Momentum Bars ...
|
||||
|
||||
/**
|
||||
* Get Momentum Bars must Extends Range ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int MomentumBarExtendRange()
|
||||
{
|
||||
return mMomentumBarExtendRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Momentum Bars must Extends Range ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
void MomentumBarExtendRange(int value)
|
||||
{
|
||||
//
|
||||
if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
//
|
||||
mMomentumBarExtendRange = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Momentum Bars Body Percent ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double MomentumBarBodyPercent()
|
||||
{
|
||||
return mMomentumBarBodyPercent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Momentum Bars Body Percent ...
|
||||
*
|
||||
* @param value: Double ...
|
||||
*/
|
||||
void MomentumBarBodyPercent(double value)
|
||||
{
|
||||
//
|
||||
if (value < 50)
|
||||
{
|
||||
value = 50;
|
||||
}
|
||||
|
||||
//
|
||||
mMomentumBarBodyPercent = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Rejection Bars ...
|
||||
|
||||
/**
|
||||
* Get Rejection Bars must Extends Range ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int RejectionBarExtendRange()
|
||||
{
|
||||
return mRejectionBarExtendRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rejection Bars must Extends Range ...
|
||||
*
|
||||
* @param value: Integer ...
|
||||
*/
|
||||
void RejectionBarExtendRange(int value)
|
||||
{
|
||||
//
|
||||
if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
//
|
||||
mRejectionBarExtendRange = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Rejection Bars Shadow Percent ...
|
||||
*
|
||||
* @return ( double )
|
||||
*/
|
||||
double RejectionBarShadowPercent()
|
||||
{
|
||||
return mRejectionBarShadowPercent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Rejection Bars Shadow Percent ...
|
||||
*
|
||||
* @param value: Double ...
|
||||
*/
|
||||
void RejectionBarShadowPercent(double value)
|
||||
{
|
||||
//
|
||||
if (value < 50)
|
||||
{
|
||||
value = 50;
|
||||
}
|
||||
|
||||
//
|
||||
mRejectionBarShadowPercent = value;
|
||||
}
|
||||
|
||||
//
|
||||
// Actions ...
|
||||
|
||||
@@ -274,7 +388,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
|
||||
//
|
||||
// POI Detecting ...
|
||||
bool isDetect = false;
|
||||
bool isDetected = false;
|
||||
|
||||
//
|
||||
// Swings ...
|
||||
@@ -292,8 +406,8 @@ class XCPOIDetector : public XCBaseAlert
|
||||
{
|
||||
//
|
||||
// Swing High ...
|
||||
isDetect = DetectSwingHigh(swingBar);
|
||||
if (isDetect)
|
||||
isDetected = DetectSwingHigh(swingBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_SWING_HIGH_DETECTED;
|
||||
@@ -320,8 +434,8 @@ class XCPOIDetector : public XCBaseAlert
|
||||
|
||||
//
|
||||
// Swing Low ...
|
||||
isDetect = DetectSwingLow(swingBar);
|
||||
if (isDetect)
|
||||
isDetected = DetectSwingLow(swingBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_SWING_LOW_DETECTED;
|
||||
@@ -348,6 +462,118 @@ class XCPOIDetector : public XCBaseAlert
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
isDetected = DetectBullishMomentumBar(cBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_BULLISH_MOMENTUM_BAR_DETECTED;
|
||||
XCMomentumBar *param;
|
||||
bool hasItem = GetLastItem(
|
||||
param,
|
||||
mBullishMomentumBars //
|
||||
);
|
||||
if (hasItem)
|
||||
{
|
||||
//
|
||||
NotifyEventListeners(
|
||||
event,
|
||||
param //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
event,
|
||||
state //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Momentum Bars ...
|
||||
isDetected = DetectBearishMomentumBar(cBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_BEARISH_MOMENTUM_BAR_DETECTED;
|
||||
XCMomentumBar *param;
|
||||
bool hasItem = GetLastItem(
|
||||
param,
|
||||
mBearishMomentumBars //
|
||||
);
|
||||
if (hasItem)
|
||||
{
|
||||
//
|
||||
NotifyEventListeners(
|
||||
event,
|
||||
param //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
event,
|
||||
state //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Rejection Bars ...
|
||||
isDetected = DetectBullishRejectionBar(cBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_BULLISH_REJECTION_BAR_DETECTED;
|
||||
XCRejectionBar *param;
|
||||
bool hasItem = GetLastItem(
|
||||
param,
|
||||
mBullishRejectionBars //
|
||||
);
|
||||
if (hasItem)
|
||||
{
|
||||
//
|
||||
NotifyEventListeners(
|
||||
event,
|
||||
param //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
event,
|
||||
state //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Rejection Bars ...
|
||||
isDetected = DetectBearishRejectionBar(cBar);
|
||||
if (isDetected)
|
||||
{
|
||||
//
|
||||
ENUM_XPOI_EVENTS event = X_BEARISH_REJECTION_BAR_DETECTED;
|
||||
XCRejectionBar *param;
|
||||
bool hasItem = GetLastItem(
|
||||
param,
|
||||
mBearishRejectionBars //
|
||||
);
|
||||
if (hasItem)
|
||||
{
|
||||
//
|
||||
NotifyEventListeners(
|
||||
event,
|
||||
param //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
event,
|
||||
state //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
CleanupUnusedPOIs();
|
||||
|
||||
@@ -424,6 +650,14 @@ class XCPOIDetector : public XCBaseAlert
|
||||
//
|
||||
Clean(mSwingHighs);
|
||||
Clean(mSwingLows);
|
||||
|
||||
//
|
||||
Clean(mBullishMomentumBars);
|
||||
Clean(mBearishMomentumBars);
|
||||
|
||||
//
|
||||
Clean(mBullishRejectionBars);
|
||||
Clean(mBearishRejectionBars);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,7 +681,7 @@ class XCPOIDetector : public XCBaseAlert
|
||||
/**
|
||||
* Apply Default Configurations ...
|
||||
*/
|
||||
virtual void ApplyDefaultConfig()
|
||||
virtual void Default()
|
||||
{
|
||||
//
|
||||
// Common ...
|
||||
@@ -460,6 +694,12 @@ class XCPOIDetector : public XCBaseAlert
|
||||
SwingRange(2);
|
||||
|
||||
//
|
||||
MomentumBarExtendRange(2);
|
||||
MomentumBarBodyPercent(70);
|
||||
|
||||
//
|
||||
RejectionBarExtendRange(0);
|
||||
RejectionBarShadowPercent(55);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -516,6 +756,14 @@ class XCPOIDetector : public XCBaseAlert
|
||||
int swingLowsCount = 0;
|
||||
int swingHighsCount = 0;
|
||||
|
||||
//
|
||||
int bullishMomentumBarsCount = 0;
|
||||
int bearishMomentumBarsCount = 0;
|
||||
|
||||
//
|
||||
int bullishRejectionBarsCount = 0;
|
||||
int bearishRejectionBarsCount = 0;
|
||||
|
||||
//
|
||||
bool canContinue = true;
|
||||
|
||||
@@ -538,6 +786,38 @@ class XCPOIDetector : public XCBaseAlert
|
||||
ArrayReverse(mSwingLows);
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
bullishMomentumBarsCount = DetectRequiredBullishMomentumBars(barIndex);
|
||||
if (bullishMomentumBarsCount == requiredPOIs)
|
||||
{
|
||||
ArrayReverse(mBullishMomentumBars);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Momentum Bars ...
|
||||
bearishMomentumBarsCount = DetectRequiredBearishMomentumBars(barIndex);
|
||||
if (bearishMomentumBarsCount == requiredPOIs)
|
||||
{
|
||||
ArrayReverse(mBearishMomentumBars);
|
||||
}
|
||||
|
||||
//
|
||||
// Bullish Rejection Bars ...
|
||||
bullishRejectionBarsCount = DetectRequiredBullishRejectionBars(barIndex);
|
||||
if (bullishRejectionBarsCount == requiredPOIs)
|
||||
{
|
||||
ArrayReverse(mBullishRejectionBars);
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish Rejection Bars ...
|
||||
bearishRejectionBarsCount = DetectRequiredBearishRejectionBars(barIndex);
|
||||
if (bearishRejectionBarsCount == requiredPOIs)
|
||||
{
|
||||
ArrayReverse(mBearishRejectionBars);
|
||||
}
|
||||
|
||||
//
|
||||
canContinue =
|
||||
//
|
||||
@@ -549,6 +829,26 @@ class XCPOIDetector : public XCBaseAlert
|
||||
// Swing Lows ...
|
||||
swingLowsCount < requiredPOIs
|
||||
//
|
||||
||
|
||||
//
|
||||
// Bullish Momentum Bars ...
|
||||
bullishMomentumBarsCount < requiredPOIs
|
||||
//
|
||||
||
|
||||
//
|
||||
// Bearish Momentum Bars ...
|
||||
bearishMomentumBarsCount < requiredPOIs
|
||||
//
|
||||
||
|
||||
//
|
||||
// Bullish Rejection Bars ...
|
||||
bullishRejectionBarsCount < requiredPOIs
|
||||
//
|
||||
||
|
||||
//
|
||||
// Bearish Rejection Bars ...
|
||||
bearishRejectionBarsCount < requiredPOIs
|
||||
//
|
||||
;
|
||||
if (canContinue)
|
||||
{
|
||||
@@ -930,8 +1230,8 @@ class XCPOIDetector : public XCBaseAlert
|
||||
int mMaxNumberOfRequiredPOIs; // Max Allowed Number of POI(s) which Must Find at Initializion Time ...
|
||||
|
||||
//
|
||||
CArrayObj mDrawnObjects; // Drawn Objects ...
|
||||
XBarTracker mBarTracker; // Market Bar Tracker ...
|
||||
CArrayObj mDrawnObjects; // Drawn Objects ...
|
||||
XBarTracker mBarTracker; // Market Bar Tracker ...
|
||||
XCBarAnalyser mBarAnalyser; // Bar Analyser ...
|
||||
|
||||
//
|
||||
@@ -1010,15 +1310,15 @@ class XCPOIDetector : public XCBaseAlert
|
||||
);
|
||||
|
||||
//
|
||||
XCSwingHighObject *iObj;
|
||||
bool isCreated = mDrawer.CreateSwingHigh(
|
||||
swing,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
// XCSwingHighObject *iObj;
|
||||
// bool isCreated = mDrawer.CreateSwingHigh(
|
||||
// swing,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,16 +1453,16 @@ class XCPOIDetector : public XCBaseAlert
|
||||
mSwingHighs //
|
||||
);
|
||||
|
||||
//
|
||||
XCSwingLowObject *iObj;
|
||||
bool isCreated = mDrawer.CreateSwingLow(
|
||||
swing,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
// //
|
||||
// XCSwingLowObject *iObj;
|
||||
// bool isCreated = mDrawer.CreateSwingLow(
|
||||
// swing,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1240,9 +1540,537 @@ class XCPOIDetector : public XCBaseAlert
|
||||
|
||||
//
|
||||
// Momentum Bars ...
|
||||
int mMomentumBarExtendRange; // Momentum Bars must Extends Range ...
|
||||
double mMomentumBarBodyPercent; // Momentum Bars Body Percent ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
XCMomentumBar *mBullishMomentumBars[]; // Holds Founded Bullish Momentum Bars ...
|
||||
|
||||
/**
|
||||
* Detect Bullish Momentum Bar ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectBullishMomentumBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int extendRange = MomentumBarExtendRange();
|
||||
double bodyPercent = MomentumBarBodyPercent();
|
||||
ENUM_X_DIRECTION dir;
|
||||
result = mBarAnalyser.IsMomentumBar(
|
||||
bar,
|
||||
dir,
|
||||
extendRange,
|
||||
bodyPercent //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
dir == X_DIRECTION_BULLISH;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *momentumBar;
|
||||
momentumBar = new XCMomentumBar();
|
||||
result = momentumBar.Init(bar);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
momentumBar,
|
||||
mBullishMomentumBars //
|
||||
);
|
||||
|
||||
//
|
||||
// XCBullishMomentumObject *iObj;
|
||||
// bool isCreated = mDrawer.CreateBullishMomentumBar(
|
||||
// momentumBar,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Required Bullish Momentum Bars ...
|
||||
*
|
||||
* @param barIndex: Integer Start bar index ...
|
||||
* 0 is Default ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DetectRequiredBullishMomentumBars(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
int required = MaxNumberOfRequiredPOIs();
|
||||
if (required <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mBullishMomentumBars);
|
||||
if (count >= required)
|
||||
{
|
||||
//
|
||||
result = count;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isInited = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
DetectBullishMomentumBar(bar);
|
||||
|
||||
//
|
||||
result = ArraySize(mBullishMomentumBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
XCMomentumBar *mBearishMomentumBars[]; // Holds Founded Bearish Momentum Bars ...
|
||||
|
||||
/**
|
||||
* Detect Bearish Momentum Bar ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectBearishMomentumBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int extendRange = MomentumBarExtendRange();
|
||||
double bodyPercent = MomentumBarBodyPercent();
|
||||
ENUM_X_DIRECTION dir;
|
||||
result = mBarAnalyser.IsMomentumBar(
|
||||
bar,
|
||||
dir,
|
||||
extendRange,
|
||||
bodyPercent //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
dir == X_DIRECTION_BEARISH;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XCMomentumBar *momentumBar;
|
||||
momentumBar = new XCMomentumBar();
|
||||
result = momentumBar.Init(bar);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
momentumBar,
|
||||
mBearishMomentumBars //
|
||||
);
|
||||
|
||||
//
|
||||
// XCBearishMomentumObject *iObj;
|
||||
// bool isCreated = mDrawer.CreateBearishMomentumBar(
|
||||
// momentumBar,
|
||||
// iObj //
|
||||
// );
|
||||
// if (isCreated)
|
||||
// {
|
||||
// AddObjectIfNotExists(iObj);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Required Bearish Momentum Bars ...
|
||||
*
|
||||
* @param barIndex: Integer Start bar index ...
|
||||
* 0 is Default ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DetectRequiredBearishMomentumBars(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
int required = MaxNumberOfRequiredPOIs();
|
||||
if (required <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mBearishMomentumBars);
|
||||
if (count >= required)
|
||||
{
|
||||
//
|
||||
result = count;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isInited = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
DetectBearishMomentumBar(bar);
|
||||
|
||||
//
|
||||
result = ArraySize(mBearishMomentumBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Rejection Bars ...
|
||||
int mRejectionBarExtendRange; // Rejection Bars must Extends Range ...
|
||||
double mRejectionBarShadowPercent; // Rejection Bars Shadow Percent ...
|
||||
|
||||
//
|
||||
// Bullish ...
|
||||
XCRejectionBar *mBullishRejectionBars[]; // Holds Founded Bullish Rejection Bars ...
|
||||
|
||||
/**
|
||||
* Detect Bullish Rejection Bar ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectBullishRejectionBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int extendRange = RejectionBarExtendRange();
|
||||
double shadowPercent = RejectionBarShadowPercent();
|
||||
ENUM_X_DIRECTION dir;
|
||||
result = mBarAnalyser.IsRejectionBar(
|
||||
bar,
|
||||
dir,
|
||||
extendRange,
|
||||
shadowPercent //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
dir == X_DIRECTION_BULLISH;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *rejectionBar;
|
||||
rejectionBar = new XCRejectionBar();
|
||||
result = rejectionBar.Init(bar);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
rejectionBar,
|
||||
mBullishRejectionBars //
|
||||
);
|
||||
|
||||
//
|
||||
XCBullishRejectionObject *iObj;
|
||||
bool isCreated = mDrawer.CreateBullishRejectionBar(
|
||||
rejectionBar,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Required Bullish Rejection Bars ...
|
||||
*
|
||||
* @param barIndex: Integer Start bar index ...
|
||||
* 0 is Default ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DetectRequiredBullishRejectionBars(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
int required = MaxNumberOfRequiredPOIs();
|
||||
if (required <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mBullishRejectionBars);
|
||||
if (count >= required)
|
||||
{
|
||||
//
|
||||
result = count;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isInited = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
DetectBullishRejectionBar(bar);
|
||||
|
||||
//
|
||||
result = ArraySize(mBullishRejectionBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Bearish ...
|
||||
XCRejectionBar *mBearishRejectionBars[]; // Holds Founded Bearish Rejection Bars ...
|
||||
|
||||
/**
|
||||
* Detect Bearish Rejection Bar ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectBearishRejectionBar(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid() &&
|
||||
bar.Index() > 0;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int extendRange = RejectionBarExtendRange();
|
||||
double shadowPercent = RejectionBarShadowPercent();
|
||||
ENUM_X_DIRECTION dir;
|
||||
result = mBarAnalyser.IsRejectionBar(
|
||||
bar,
|
||||
dir,
|
||||
extendRange,
|
||||
shadowPercent //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
dir == X_DIRECTION_BEARISH;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
XCRejectionBar *rejectionBar;
|
||||
rejectionBar = new XCRejectionBar();
|
||||
result = rejectionBar.Init(bar);
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
rejectionBar,
|
||||
mBearishRejectionBars //
|
||||
);
|
||||
|
||||
//
|
||||
XCBearishRejectionObject *iObj;
|
||||
bool isCreated = mDrawer.CreateBearishRejectionBar(
|
||||
rejectionBar,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect Required Bearish Rejection Bars ...
|
||||
*
|
||||
* @param barIndex: Integer Start bar index ...
|
||||
* 0 is Default ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DetectRequiredBearishRejectionBars(int barIndex = 0)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (barIndex < 0)
|
||||
{
|
||||
barIndex = 0;
|
||||
}
|
||||
|
||||
//
|
||||
int required = MaxNumberOfRequiredPOIs();
|
||||
if (required <= 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mBearishRejectionBars);
|
||||
if (count >= required)
|
||||
{
|
||||
//
|
||||
result = count;
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
string symbol = GetSymbol();
|
||||
ENUM_TIMEFRAMES period = GetPeriod();
|
||||
|
||||
//
|
||||
XOHCL bar;
|
||||
bool isInited = bar.Init(
|
||||
symbol,
|
||||
period,
|
||||
barIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
DetectBearishRejectionBar(bar);
|
||||
|
||||
//
|
||||
result = ArraySize(mBearishRejectionBars);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Support Zone(s) ...
|
||||
|
||||
Reference in New Issue
Block a user