apply correction on fvg cond signalling ...
This commit is contained in:
@@ -2735,6 +2735,100 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Implement Some Custom Senarios ...
|
||||
|
||||
/**
|
||||
* Calculate Specified Bars Range Volume ...
|
||||
*
|
||||
* @param bar: XOHCL instance reference ...
|
||||
* @param bullishVolume: double
|
||||
* @param bearishVolume: double
|
||||
* @param loopback: int
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CalculateRangeVolume(
|
||||
XOHCL &bar,
|
||||
double &bullishVolume,
|
||||
double &bearishVolume,
|
||||
int loopback = 5 //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Normalize Args ...
|
||||
bullishVolume = 0;
|
||||
bearishVolume = 0;
|
||||
loopback = NormalizeInt(loopback, 3);
|
||||
|
||||
//
|
||||
// Validate ...
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool has = false;
|
||||
int start = bar.Index();
|
||||
int end = start + loopback;
|
||||
for (int i = start; i <= end; i++)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
has = iBar.Init(
|
||||
bar.symbol,
|
||||
bar.period,
|
||||
i //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish = iBar.IsBullish();
|
||||
bool isBearish = iBar.IsBearish();
|
||||
|
||||
//
|
||||
if (isBullish)
|
||||
{
|
||||
bullishVolume += iBar.volume;
|
||||
}
|
||||
else if (isBearish)
|
||||
{
|
||||
bearishVolume += iBar.volume;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bullishVolume += iBar.volume;
|
||||
bearishVolume += iBar.volume;
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = iBar.IsValid();
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
protected:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user