last ...
This commit is contained in:
@@ -1762,6 +1762,178 @@ class XCBarAnalyser : public XCBase
|
||||
//
|
||||
// Custom Logics ...
|
||||
|
||||
/**
|
||||
* Check a Bar is End of an OrderBlock Bar or Not ...
|
||||
*
|
||||
* @param bar: XOHCL ...
|
||||
* @param box: XBoxZone ...
|
||||
* @param forceFVGBarType: bool, Force all Bars must be Same as Direction ...
|
||||
* @param forceOBTwoBar: bool, Force Two Bars of OB Start must be InDirection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsOB(
|
||||
XOHCL &bar,
|
||||
XBoxZone &box,
|
||||
bool forceFVGBarType = false,
|
||||
bool forceOBTwoBar = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Bar Must be FVG ...
|
||||
result = IsFVG(
|
||||
bar,
|
||||
box,
|
||||
forceFVGBarType //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
box.type = "XOB";
|
||||
|
||||
//
|
||||
bool isBullish = box.IsBullish();
|
||||
bool isBearish = box.IsBearish();
|
||||
|
||||
//
|
||||
// Order Block Includes an FVG which Starts by atleast One
|
||||
// or More Indirectional Bars ...
|
||||
XOHCL fvgLastBar;
|
||||
XOHCL fvgLastBarPrev;
|
||||
XOHCL fvgLastBarPrev2;
|
||||
|
||||
//
|
||||
int barIndex = bar.Index();
|
||||
int fvgLastBarIndex = barIndex + 3;
|
||||
result = fvgLastBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
fvgLastBarIndex //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
fvgLastBar.GetPreviousBar(fvgLastBarPrev);
|
||||
result =
|
||||
result &&
|
||||
fvgLastBarPrev.GetPreviousBar(fvgLastBarPrev2);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
fvgLastBarPrev2.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check FVG Last Bar ...
|
||||
|
||||
//
|
||||
bool isBullishBlock =
|
||||
isBullish &&
|
||||
(fvgLastBar.IsBearish() ||
|
||||
(fvgLastBar.IsBullish() &&
|
||||
fvgLastBarPrev.IsBearish()));
|
||||
|
||||
//
|
||||
bool isBearishBlock =
|
||||
isBearish &&
|
||||
(fvgLastBar.IsBullish() ||
|
||||
(fvgLastBar.IsBearish() &&
|
||||
fvgLastBarPrev.IsBullish()));
|
||||
|
||||
//
|
||||
// Update Box ...
|
||||
|
||||
//
|
||||
if (isBullishBlock ||
|
||||
isBearishBlock)
|
||||
{
|
||||
//
|
||||
box.from = fvgLastBar.time;
|
||||
|
||||
//
|
||||
box.lower = MathMin(box.lower, fvgLastBar.low);
|
||||
box.upper = MathMax(box.upper, fvgLastBar.high);
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Force Two Bar ...
|
||||
if (forceOBTwoBar)
|
||||
{
|
||||
//
|
||||
isBullishBlock =
|
||||
isBullishBlock &&
|
||||
fvgLastBarPrev.IsBearish();
|
||||
|
||||
//
|
||||
isBearishBlock =
|
||||
isBearishBlock &&
|
||||
fvgLastBarPrev.IsBullish();
|
||||
|
||||
//
|
||||
// Update Box ...
|
||||
if (isBullishBlock ||
|
||||
isBearishBlock)
|
||||
{
|
||||
//
|
||||
box.from = fvgLastBarPrev.time;
|
||||
box.lower = MathMin(box.lower, fvgLastBarPrev.low);
|
||||
box.upper = MathMax(box.upper, fvgLastBarPrev.high);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = isBullishBlock ||
|
||||
isBearishBlock;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bar is End of an FVG Bar or Not ...
|
||||
*
|
||||
@@ -1868,169 +2040,6 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a Bar is End of an OrderBlock Bar or Not ...
|
||||
*
|
||||
* @param bar: XOHCL ...
|
||||
* @param box: XBoxZone ...
|
||||
* @param forceFVGBarType: bool, Force all Bars must be Same as Direction ...
|
||||
* @param forceOBTwoBar: bool, Force Two Bars of OB Start must be InDirection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsOrderBlock(
|
||||
XOHCL &bar,
|
||||
XBoxZone &box,
|
||||
bool forceFVGBarType = false,
|
||||
bool forceOBTwoBar = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check Bar Must be FVG ...
|
||||
result = IsFVG(
|
||||
bar,
|
||||
box,
|
||||
forceFVGBarType //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
box.type = "XOB";
|
||||
|
||||
//
|
||||
bool isBullish = box.IsBullish();
|
||||
bool isBearish = box.IsBearish();
|
||||
|
||||
//
|
||||
// Order Block Includes an FVG which Starts by atleast One
|
||||
// or More Indirectional Bars ...
|
||||
XOHCL fvgLastBar;
|
||||
XOHCL fvgLastBarPrev;
|
||||
|
||||
//
|
||||
int barIndex = bar.Index();
|
||||
int fvgLastBarIndex = barIndex + 3;
|
||||
result = fvgLastBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
fvgLastBarIndex //
|
||||
);
|
||||
result =
|
||||
result &&
|
||||
fvgLastBar.GetPreviousBar(fvgLastBarPrev);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Check FVG Last Bar ...
|
||||
|
||||
//
|
||||
bool isBullishBlock =
|
||||
isBullish &&
|
||||
fvgLastBar.IsBearish();
|
||||
|
||||
//
|
||||
bool isBearishBlock =
|
||||
isBearish &&
|
||||
fvgLastBar.IsBullish();
|
||||
|
||||
//
|
||||
// Update Box ...
|
||||
|
||||
//
|
||||
if (isBullishBlock ||
|
||||
isBearishBlock)
|
||||
{
|
||||
//
|
||||
box.from = fvgLastBar.time;
|
||||
|
||||
//
|
||||
box.lower = MathMin(box.lower, fvgLastBar.low);
|
||||
box.upper = MathMax(box.upper, fvgLastBar.high);
|
||||
}
|
||||
|
||||
//
|
||||
// Apply Force Two Bar ...
|
||||
if (forceOBTwoBar)
|
||||
{
|
||||
//
|
||||
isBullishBlock =
|
||||
isBullishBlock &&
|
||||
fvgLastBarPrev.IsBearish();
|
||||
|
||||
//
|
||||
isBearishBlock =
|
||||
isBearishBlock &&
|
||||
fvgLastBarPrev.IsBullish();
|
||||
|
||||
//
|
||||
// Update Box ...
|
||||
if (isBullishBlock ||
|
||||
isBearishBlock)
|
||||
{
|
||||
//
|
||||
box.from = fvgLastBarPrev.time;
|
||||
box.lower = MathMin(box.lower, fvgLastBarPrev.low);
|
||||
box.upper = MathMax(box.upper, fvgLastBarPrev.high);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = isBullishBlock ||
|
||||
isBearishBlock;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
box.Clean();
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
fvgLastBar.Clean();
|
||||
fvgLastBarPrev.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Candlestick ...
|
||||
|
||||
@@ -2091,7 +2100,7 @@ class XCBarAnalyser : public XCBase
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Specified Bar is Pullback or not ...
|
||||
* Check Specified Bar is Swing or not ...
|
||||
*
|
||||
* @param bar: XOHCL instance reference, Specified Bar to Check ...
|
||||
* @param dir: ENUM_X_DIRECTION member, Specified Doji Direction ...
|
||||
|
||||
Reference in New Issue
Block a user