Add support for Draw Trend Line for Order Flow ...
This commit is contained in:
@@ -6067,6 +6067,51 @@ struct XBoxZone
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
struct XOBFVGPivot
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
double value;
|
||||
datetime at;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XOBFVGPivot()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
//
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
value = 0;
|
||||
at = NULL;
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
//
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
value > 0 &&
|
||||
IsValid(at);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
struct XOBFVG
|
||||
{
|
||||
@@ -6105,6 +6150,9 @@ struct XOBFVG
|
||||
Clean(demandZones);
|
||||
Clean(supportZones);
|
||||
Clean(resistanceZones);
|
||||
|
||||
//
|
||||
ZeroMemory(this);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -6176,6 +6224,166 @@ struct XOBFVG
|
||||
return ArraySize(resistanceZones);
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION GetDirection()
|
||||
{
|
||||
//
|
||||
ENUM_X_DIRECTION result = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
bool isValid = IsValid();
|
||||
if (!isValid)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result = ob.GetDirection();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool IsBullish()
|
||||
{
|
||||
return IsBullish(GetDirection());
|
||||
}
|
||||
|
||||
//
|
||||
bool IsBearish()
|
||||
{
|
||||
return IsBearish(GetDirection());
|
||||
}
|
||||
|
||||
//
|
||||
int GetSwings(
|
||||
XOBFVGPivot &pivots[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(pivots);
|
||||
|
||||
//
|
||||
if (!IsValid())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
ENUM_X_DIRECTION forDir = GetDirection();
|
||||
bool isBullish = IsBullish(forDir);
|
||||
|
||||
//
|
||||
XOHCL passedBar;
|
||||
XOBFVGPivot iPivot;
|
||||
bool isPassed = false;
|
||||
double appliedPrice = 0;
|
||||
bool isBodyState = false;
|
||||
|
||||
//
|
||||
// Start ...
|
||||
isPassed = ob.IsStarted(
|
||||
forDir,
|
||||
passedBar,
|
||||
isBodyState //
|
||||
);
|
||||
if (isPassed)
|
||||
{
|
||||
//
|
||||
appliedPrice =
|
||||
isBullish
|
||||
? passedBar.low
|
||||
: passedBar.high;
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
iPivot.value = appliedPrice;
|
||||
iPivot.at = passedBar.time;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iPivot,
|
||||
pivots //
|
||||
);
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Activation ...
|
||||
isPassed = ob.IsActivated(
|
||||
forDir,
|
||||
passedBar,
|
||||
isBodyState //
|
||||
);
|
||||
if (isPassed)
|
||||
{
|
||||
//
|
||||
appliedPrice =
|
||||
isBullish
|
||||
? passedBar.low
|
||||
: passedBar.high;
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
iPivot.value = appliedPrice;
|
||||
iPivot.at = passedBar.time;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iPivot,
|
||||
pivots //
|
||||
);
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Worked ...
|
||||
isPassed = ob.IsWorked(
|
||||
forDir,
|
||||
passedBar,
|
||||
isBodyState //
|
||||
);
|
||||
if (isPassed)
|
||||
{
|
||||
//
|
||||
appliedPrice =
|
||||
isBullish
|
||||
? passedBar.low
|
||||
: passedBar.high;
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
iPivot.value = appliedPrice;
|
||||
iPivot.at = passedBar.time;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
iPivot,
|
||||
pivots //
|
||||
);
|
||||
|
||||
//
|
||||
iPivot.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
passedBar.Clean();
|
||||
|
||||
//
|
||||
result = ArraySize(pivots);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void UpdateTo(datetime value = NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user