Complete Rejection Bar POi Detection mechanism ...
This commit is contained in:
@@ -1309,10 +1309,59 @@ class XCPOI : public XSCBaseAlert
|
||||
X_MOMENTUM_BAR_DETECTED,
|
||||
state //
|
||||
);
|
||||
OnMomentumBarDetected(pBar);
|
||||
NotifyMomentumBarEventListeners(pBar);
|
||||
OnMomentumBarDetected(cBar);
|
||||
NotifyMomentumBarEventListeners(cBar);
|
||||
}
|
||||
|
||||
//
|
||||
// Rejection Bars ...
|
||||
int rejectionBarsCount = ArraySize(mRejectionBars);
|
||||
int rejectionBarLoopBackBarIndex = RejectionBarLoopBack() + 1;
|
||||
XOHCL iRBar;
|
||||
bool isIRBarInited = iRBar.Init(
|
||||
Symbol(),
|
||||
Period(),
|
||||
rejectionBarLoopBackBarIndex //
|
||||
);
|
||||
if (isIRBarInited)
|
||||
{
|
||||
//
|
||||
bool isRejectionBar =
|
||||
iRBar.HasStrongLowShadow(
|
||||
RejectionBarPercent(),
|
||||
RejectionBarLoopBack(),
|
||||
RejectionBarSharpRatio() //
|
||||
) ||
|
||||
iRBar.HasStrongHighShadow(
|
||||
RejectionBarPercent(),
|
||||
RejectionBarLoopBack(),
|
||||
RejectionBarSharpRatio() //
|
||||
);
|
||||
if (isRejectionBar)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
iRBar,
|
||||
mRejectionBars //
|
||||
);
|
||||
rejectionBarsCount = ArraySize(mRejectionBars);
|
||||
|
||||
//
|
||||
DrawRejectionBars();
|
||||
|
||||
//
|
||||
Add(
|
||||
X_REJECTION_BAR_DETECTED,
|
||||
state //
|
||||
);
|
||||
OnRejectionBarDetected(iRBar);
|
||||
NotifyRejectionBarEventListeners(iRBar);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// ...
|
||||
|
||||
//
|
||||
mBarTracker.Waits();
|
||||
|
||||
@@ -1728,7 +1777,6 @@ class XCPOI : public XSCBaseAlert
|
||||
|
||||
//
|
||||
bool canContinue = true;
|
||||
int maxAllowedScanPrevBars = 2000;
|
||||
while (canContinue)
|
||||
{
|
||||
//
|
||||
@@ -1961,8 +2009,36 @@ class XCPOI : public XSCBaseAlert
|
||||
if (rejectionBarsCount < requiredPOIs)
|
||||
{
|
||||
//
|
||||
bool isRejectionBar =
|
||||
cBar.HasStrongLowShadow(
|
||||
RejectionBarPercent(),
|
||||
RejectionBarLoopBack(),
|
||||
RejectionBarSharpRatio() //
|
||||
) ||
|
||||
cBar.HasStrongHighShadow(
|
||||
RejectionBarPercent(),
|
||||
RejectionBarLoopBack(),
|
||||
RejectionBarSharpRatio() //
|
||||
);
|
||||
|
||||
//
|
||||
if (isRejectionBar)
|
||||
{
|
||||
//
|
||||
AddRef(
|
||||
cBar,
|
||||
mRejectionBars //
|
||||
);
|
||||
|
||||
//
|
||||
rejectionBarsCount = ArraySize(mRejectionBars);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Required Conditions for Loop ...
|
||||
//
|
||||
|
||||
//
|
||||
bool isNeedMoreMarketSessions = (!IsValidSize(sessionsCount)
|
||||
? true
|
||||
@@ -1976,7 +2052,9 @@ class XCPOI : public XSCBaseAlert
|
||||
swingHighsCount < requiredPOIs ||
|
||||
swingLowsCount < requiredPOIs ||
|
||||
//
|
||||
momentumBarsCount < requiredPOIs
|
||||
momentumBarsCount < requiredPOIs ||
|
||||
//
|
||||
rejectionBarsCount < requiredPOIs
|
||||
//
|
||||
;
|
||||
if (canContinue)
|
||||
@@ -1985,6 +2063,14 @@ class XCPOI : public XSCBaseAlert
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
int errorArr[];
|
||||
if (canContinue)
|
||||
{
|
||||
//
|
||||
int t = errorArr[5];
|
||||
}
|
||||
|
||||
//
|
||||
// Complete Calculations ...
|
||||
|
||||
@@ -2062,6 +2148,23 @@ class XCPOI : public XSCBaseAlert
|
||||
);
|
||||
Clean(tmpBars);
|
||||
|
||||
//
|
||||
// Reverse Rejection Bars ...
|
||||
Copy(
|
||||
mRejectionBars,
|
||||
tmpBars //
|
||||
);
|
||||
Clean(mRejectionBars);
|
||||
ArrayReverse(tmpBars);
|
||||
Copy(
|
||||
tmpBars,
|
||||
mRejectionBars //
|
||||
);
|
||||
Clean(tmpBars);
|
||||
|
||||
//
|
||||
// ...
|
||||
|
||||
//
|
||||
Unlock();
|
||||
DrawPOIs();
|
||||
@@ -2335,7 +2438,39 @@ class XCPOI : public XSCBaseAlert
|
||||
void DrawRejectionBars()
|
||||
{
|
||||
//
|
||||
// TODO: Implement Rejection Bars ...
|
||||
bool allow = AllowDrawRejectionBars();
|
||||
if (!allow)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int count = ArraySize(mRejectionBars);
|
||||
if (!IsValidSize(count))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XOHCL iBar = mRejectionBars[i];
|
||||
|
||||
//
|
||||
string iName = iBar.GetTag(ToString(X_POI_REJECTION_BAR));
|
||||
int iIDX = HasObject(
|
||||
iName,
|
||||
mRejectionBarObjects //
|
||||
);
|
||||
if (IsValidIndex(iIDX))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
CreateRejectionBarObject(iBar, iName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3085,7 +3220,7 @@ class XCPOI : public XSCBaseAlert
|
||||
iObj.ToStyle(mSessions[sessionIDX].endStyle);
|
||||
|
||||
//
|
||||
mMarketSessionObjects.Add(iObj);
|
||||
mMarketSessionObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -3297,6 +3432,69 @@ class XCPOI : public XSCBaseAlert
|
||||
CArrayObj mRejectionBarObjects; // Rejection Bar Chart Objects ...
|
||||
TXOHCLEventHandler mRejectionBarEventListeners[]; // Rejection Bars Event Listeners ...
|
||||
|
||||
/**
|
||||
* Create an Object to Represent Rejection Bar on Chart ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param name: String ...
|
||||
*/
|
||||
void CreateRejectionBarObject(
|
||||
XOHCL &bar,
|
||||
string name //
|
||||
)
|
||||
{
|
||||
//
|
||||
if (!bar.IsValid() ||
|
||||
!IsValid(name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = bar.GetLowShadow() > bar.GetHighShadow();
|
||||
double price =
|
||||
isBullish
|
||||
? bar.low
|
||||
: bar.high;
|
||||
char arrowCode =
|
||||
isBullish
|
||||
? RejectionBarBullishArrowCode()
|
||||
: RejectionBarBearishArrowCode();
|
||||
color clr =
|
||||
isBullish
|
||||
? RejectionBarBullishColor()
|
||||
: RejectionBarBearishColor();
|
||||
ENUM_ARROW_ANCHOR anchor =
|
||||
isBullish
|
||||
? ANCHOR_TOP
|
||||
: ANCHOR_BOTTOM;
|
||||
|
||||
//
|
||||
CChartObjectArrow *iObj;
|
||||
iObj = new CChartObjectArrow();
|
||||
bool isCreated = iObj.Create(
|
||||
ChartID(),
|
||||
name,
|
||||
Window(),
|
||||
bar.time,
|
||||
price,
|
||||
arrowCode //
|
||||
);
|
||||
if (!isCreated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Configure Object ...
|
||||
iObj.Width(RejectionBarWidth());
|
||||
iObj.Color(clr);
|
||||
iObj.Anchor(anchor);
|
||||
|
||||
//
|
||||
mRejectionBarObjects.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user