last ...
This commit is contained in:
@@ -1753,6 +1753,115 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Logics ...
|
||||
|
||||
/**
|
||||
* Check a Bar is End of an FVG Bar or Not ...
|
||||
*
|
||||
* @param bar: XOHCL ...
|
||||
* @param box: XBoxZone ...
|
||||
* @param forceType: bool, Force all Bars must be Same as Direction ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsFVG(
|
||||
XOHCL &bar,
|
||||
XBoxZone &box,
|
||||
bool forceType = false //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL pBar;
|
||||
XOHCL p2Bar;
|
||||
result = bar.GetPreviousBar(pBar);
|
||||
result = result &&
|
||||
pBar.GetPreviousBar(p2Bar);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = p2Bar.high < bar.low;
|
||||
bool isBearish = p2Bar.low > bar.high;
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
|
||||
//
|
||||
// Apply Force Type ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
result =
|
||||
bar.IsBullish() &&
|
||||
pBar.IsBullish() &&
|
||||
p2Bar.IsBullish();
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
//
|
||||
result =
|
||||
bar.IsBearish() &&
|
||||
pBar.IsBearish() &&
|
||||
p2Bar.IsBearish();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
box.to = bar.time;
|
||||
box.from = p2Bar.time;
|
||||
box.symbol = bar.symbol;
|
||||
box.period = bar.period;
|
||||
box.dir = isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
box.upper = isBullish
|
||||
? bar.low
|
||||
: p2Bar.low;
|
||||
box.lower = isBullish
|
||||
? p2Bar.high
|
||||
: bar.high;
|
||||
box.type = "XFVG";
|
||||
}
|
||||
|
||||
//
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
|
||||
//
|
||||
result = box.IsValid();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Candlestick ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user