last ...
This commit is contained in:
@@ -0,0 +1,843 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Order Flow ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawOrderFlow;
|
||||||
|
XBoxZone orderFlow[];
|
||||||
|
bool manageOrderFlow;
|
||||||
|
ENUM_X_DIRECTION orderFlowDir;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasOrderFlow()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return HasChild(orderFlow) &&
|
||||||
|
HasDirection(orderFlowDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasBullishOrderFlow()
|
||||||
|
{
|
||||||
|
return HasOrderFlow() &&
|
||||||
|
IsXBullish(orderFlowDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasBearishOrderFlow()
|
||||||
|
{
|
||||||
|
return HasOrderFlow() &&
|
||||||
|
IsXBearish(orderFlowDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool GetOrderFlowBoundary(
|
||||||
|
double &upper,
|
||||||
|
double &lower //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
upper = EMPTY_VALUE;
|
||||||
|
lower = EMPTY_VALUE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = HasOrderFlow();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Upper ...
|
||||||
|
idx = GetHighest(orderFlow);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
upper = orderFlow[idx].upper;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lower ...
|
||||||
|
idx = GetLowest(orderFlow);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
lower = orderFlow[idx].lower;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = NotEmptyZero(upper) &&
|
||||||
|
NotEmptyZero(lower) &&
|
||||||
|
upper > lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = EMPTY_VALUE;
|
||||||
|
lower = EMPTY_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool ValidateOrderFlow(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
HasOrderFlow();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double upper = EMPTY_VALUE;
|
||||||
|
double lower = EMPTY_VALUE;
|
||||||
|
result = GetOrderFlowBoundary(upper, lower);
|
||||||
|
result = result &&
|
||||||
|
HasBullishOrderFlow()
|
||||||
|
? bar.low > lower
|
||||||
|
: bar.high < upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void DrawOrderFlow()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!drawOrderFlow || !HasOrderFlow())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDrawer.DrawZones(orderFlow, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ManageOrderFlow(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Exists ...
|
||||||
|
if (HasOrderFlow())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!ValidateOrderFlow(bar))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Invalidate OrderFlow ...
|
||||||
|
XClean(orderFlow);
|
||||||
|
orderFlowDir = X_DIRECTION_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect New ...
|
||||||
|
if (!HasOrderFlow())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPatternAnalysisConfig patternConfig = structureConfig.barsAnalysisConfig;
|
||||||
|
// patternConfig.Default();
|
||||||
|
// patternConfig.supportAndResistanceLoopbackLength = 21;
|
||||||
|
// patternConfig.supportAndResistanceValidationLength = 7;
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDetector.HasOrderFlow(
|
||||||
|
bar,
|
||||||
|
orderFlowDir,
|
||||||
|
orderFlow,
|
||||||
|
structureConfig.orderFlowValidation,
|
||||||
|
structureConfig.orderFlowUseOB,
|
||||||
|
structureConfig.orderFlowUseFVG,
|
||||||
|
structureConfig.orderFlowUseSupportAndResistance,
|
||||||
|
patternConfig.supportAndResistanceLoopbackLength,
|
||||||
|
patternConfig.supportAndResistanceValidationLength,
|
||||||
|
structureConfig.loopback //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Exists ...
|
||||||
|
if (HasOrderFlow())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Update to Times ...
|
||||||
|
UpdateToTime(orderFlow, TimeCurrent());
|
||||||
|
|
||||||
|
//
|
||||||
|
DrawOrderFlow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Zone ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone support;
|
||||||
|
XBoxZone resistance;
|
||||||
|
bool drawZones;
|
||||||
|
bool drawSupport;
|
||||||
|
bool manageZones;
|
||||||
|
bool drawResistance;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasZones()
|
||||||
|
{
|
||||||
|
return HasSupport() ||
|
||||||
|
HasResistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasSupport()
|
||||||
|
{
|
||||||
|
return support.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasResistance()
|
||||||
|
{
|
||||||
|
return resistance.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool ValidateZones(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
HasZones();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support ...
|
||||||
|
bool hasSupport = HasSupport();
|
||||||
|
if (hasSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bar.close > support.lower &&
|
||||||
|
!IsBreaked(support, X_PRICE_CLOSE);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iResistance = support;
|
||||||
|
iResistance.breakAt = NULL;
|
||||||
|
iResistance.dir = X_DIRECTION_BEARISH;
|
||||||
|
iResistance.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iResistance.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
|
||||||
|
//
|
||||||
|
support.breakAt = bar.time;
|
||||||
|
support.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance ...
|
||||||
|
bool hasResistance = HasResistance();
|
||||||
|
if (hasResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bar.close < resistance.upper &&
|
||||||
|
!IsBreaked(resistance, X_PRICE_CLOSE);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSupport = resistance;
|
||||||
|
iSupport.breakAt = NULL;
|
||||||
|
iSupport.dir = X_DIRECTION_BULLISH;
|
||||||
|
iSupport.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iSupport.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
|
||||||
|
//
|
||||||
|
resistance.breakAt = bar.time;
|
||||||
|
resistance.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
(hasSupport && !HasSupport()) ||
|
||||||
|
(hasResistance && !HasResistance());
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void DrawZones()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!drawZones || !HasZones())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (drawSupport && HasSupport())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawZone(support, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (drawResistance && HasResistance())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawZone(resistance, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ManageZones(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Exists ...
|
||||||
|
if (HasZones())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!ValidateZones(bar))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Invalidate Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support ...
|
||||||
|
if (IsXValid(support.breakAt))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iResistance = support;
|
||||||
|
iResistance.breakAt = NULL;
|
||||||
|
iResistance.dir = X_DIRECTION_BEARISH;
|
||||||
|
iResistance.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iResistance.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
|
||||||
|
//
|
||||||
|
support.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance ...
|
||||||
|
if (IsXValid(resistance.breakAt))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSupport = resistance;
|
||||||
|
iSupport.breakAt = NULL;
|
||||||
|
iSupport.dir = X_DIRECTION_BULLISH;
|
||||||
|
iSupport.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iSupport.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
|
||||||
|
//
|
||||||
|
resistance.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect New ...
|
||||||
|
XOHCL tmpBar;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Support ...
|
||||||
|
if (!HasSupport())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = poiDetector.HasSupport(
|
||||||
|
bar,
|
||||||
|
tmpBar,
|
||||||
|
structureConfig.barsAnalysisConfig.supportAndResistanceValidationLength,
|
||||||
|
structureConfig.barsAnalysisConfig.supportAndResistanceLoopbackLength //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = ToSupportBox(tmpBar, support, bar.time);
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
!IsBreaked(support, X_PRICE_CLOSE);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (support.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iResistance = support;
|
||||||
|
iResistance.breakAt = NULL;
|
||||||
|
iResistance.dir = X_DIRECTION_BEARISH;
|
||||||
|
iResistance.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iResistance.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
support.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Resistance ...
|
||||||
|
if (!HasResistance())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = poiDetector.HasResistance(
|
||||||
|
bar,
|
||||||
|
tmpBar,
|
||||||
|
structureConfig.barsAnalysisConfig.supportAndResistanceValidationLength,
|
||||||
|
structureConfig.barsAnalysisConfig.supportAndResistanceLoopbackLength //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
has = ToResistanceBox(tmpBar, resistance, bar.time);
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
!IsBreaked(resistance, X_PRICE_CLOSE);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (resistance.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSupport = resistance;
|
||||||
|
iSupport.breakAt = NULL;
|
||||||
|
iSupport.dir = X_DIRECTION_BULLISH;
|
||||||
|
iSupport.to = bar.time + (PeriodSeconds(bar.period));
|
||||||
|
iSupport.from = bar.time - (PeriodSeconds(bar.period));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
resistance.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Exists ...
|
||||||
|
if (HasZones())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (HasSupport())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
support.to = bar.time;
|
||||||
|
support.type = "XFIMASup";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (HasResistance())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
resistance.to = bar.time;
|
||||||
|
resistance.type = "XFIMARes";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
DrawZones();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
tmpBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iSupport;
|
||||||
|
XBoxZone iResistance;
|
||||||
|
bool drawIZones;
|
||||||
|
bool drawISupport;
|
||||||
|
bool manageIZones;
|
||||||
|
bool drawIResistance;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasIZones()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return HasISupport() ||
|
||||||
|
HasIResistance();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasISupport()
|
||||||
|
{
|
||||||
|
return iSupport.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasIResistance()
|
||||||
|
{
|
||||||
|
return iResistance.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void DrawIZones()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!drawIZones || !HasIZones())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (drawISupport && HasISupport())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawZone(iSupport, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (drawIResistance && HasIResistance())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawZone(iResistance, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool ValidateIZones(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
HasIZones();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support ...
|
||||||
|
bool hasSupport = HasISupport();
|
||||||
|
if (hasSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bar.close > iSupport.lower &&
|
||||||
|
!IsBreaked(iSupport, X_PRICE_CLOSE);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSupport.breakAt = bar.time;
|
||||||
|
iSupport.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance ...
|
||||||
|
bool hasResistance = HasIResistance();
|
||||||
|
if (hasResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = bar.close < iResistance.upper &&
|
||||||
|
!IsBreaked(iResistance, X_PRICE_CLOSE);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iResistance.breakAt = bar.time;
|
||||||
|
iResistance.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
(hasSupport && !HasISupport()) ||
|
||||||
|
(hasResistance && !HasIResistance());
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ManageIZones(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Exists ...
|
||||||
|
if (HasIZones())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!ValidateIZones(bar))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Invalidate Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support ...
|
||||||
|
if (IsXValid(iSupport.breakAt))
|
||||||
|
{
|
||||||
|
iSupport.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance ...
|
||||||
|
if (IsXValid(iResistance.breakAt))
|
||||||
|
{
|
||||||
|
iResistance.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Exists ...
|
||||||
|
if (HasIZones())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (HasISupport())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iSupport.to = bar.time;
|
||||||
|
iSupport.type = "XFIMAISup";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (HasIResistance())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iResistance.to = bar.time;
|
||||||
|
iResistance.type = "XFIMAIRes";
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
DrawIZones();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Trends ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XTrend scTrend;
|
||||||
|
XTrend mcTrend;
|
||||||
|
XTrend lcTrend;
|
||||||
|
XTrend hcTrend;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool drawTrends;
|
||||||
|
bool drawSCTrend;
|
||||||
|
bool drawMCTrend;
|
||||||
|
bool drawLCTrend;
|
||||||
|
bool drawHCTrend;
|
||||||
|
bool manageTrends;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasTrend()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result =
|
||||||
|
HasSCTrend() ||
|
||||||
|
HasMCTrend() ||
|
||||||
|
HasLCTrend() ||
|
||||||
|
HasHCTrend();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasSCTrend()
|
||||||
|
{
|
||||||
|
return scTrend.IsValid() &&
|
||||||
|
scTrend.HasTrend();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasMCTrend()
|
||||||
|
{
|
||||||
|
return mcTrend.IsValid() &&
|
||||||
|
mcTrend.HasTrend();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasLCTrend()
|
||||||
|
{
|
||||||
|
return lcTrend.IsValid() &&
|
||||||
|
lcTrend.HasTrend();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasHCTrend()
|
||||||
|
{
|
||||||
|
return hcTrend.IsValid() &&
|
||||||
|
hcTrend.HasTrend();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void DrawTrends()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (!drawTrends || !HasTrend())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// SC ...
|
||||||
|
if (drawSCTrend && HasSCTrend())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawTrendLine(scTrend, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// MC ...
|
||||||
|
if (drawMCTrend && HasMCTrend())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawTrendLine(mcTrend, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// LC ...
|
||||||
|
if (drawLCTrend && HasLCTrend())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawTrendLine(lcTrend, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// HC ...
|
||||||
|
if (drawHCTrend && HasHCTrend())
|
||||||
|
{
|
||||||
|
poiDrawer.DrawTrendLine(hcTrend, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void ManageTrends(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
bool has = bar.IsValid();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XTrend tmpTrend;
|
||||||
|
|
||||||
|
//
|
||||||
|
// SC ...
|
||||||
|
tmpTrend.Clean();
|
||||||
|
has = fimaParser.HasSCTrend(tmpTrend, bar.Index());
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
scTrend = tmpTrend;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// MC ...
|
||||||
|
tmpTrend.Clean();
|
||||||
|
has = fimaParser.HasMCTrend(tmpTrend, bar.Index());
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
mcTrend = tmpTrend;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// LC ...
|
||||||
|
tmpTrend.Clean();
|
||||||
|
has = fimaParser.HasLCTrend(tmpTrend, bar.Index());
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
lcTrend = tmpTrend;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// HC ...
|
||||||
|
tmpTrend.Clean();
|
||||||
|
has = fimaParser.HasHCTrend(tmpTrend, bar.Index());
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
hcTrend = tmpTrend;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
DrawTrends();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
tmpTrend.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void Manage(XOHCL &bar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool has = bar.IsValid();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
XOHCL p2Bar;
|
||||||
|
XOHCL p3Bar;
|
||||||
|
has = bar.GetPreviousBar(pBar);
|
||||||
|
has = has &&
|
||||||
|
pBar.GetPreviousBar(p2Bar);
|
||||||
|
has = has &&
|
||||||
|
p2Bar.GetPreviousBar(p3Bar);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
p2Bar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ManageTrends(bar);
|
||||||
|
ManageZones(p2Bar);
|
||||||
|
ManageIZones(p2Bar);
|
||||||
|
ManageOrderFlow(p3Bar);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
pBar.Clean();
|
||||||
|
p2Bar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Configure ...
|
||||||
|
drawZones = false;
|
||||||
|
drawIZones = false;
|
||||||
|
drawTrends = false;
|
||||||
|
drawSCTrend = false;
|
||||||
|
drawMCTrend = false;
|
||||||
|
drawLCTrend = false;
|
||||||
|
drawHCTrend = false;
|
||||||
|
drawSupport = false;
|
||||||
|
drawISupport = false;
|
||||||
|
drawOrderFlow = false;
|
||||||
|
drawResistance = false;
|
||||||
|
drawIResistance = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
manageZones = true;
|
||||||
|
manageIZones = true;
|
||||||
|
manageTrends = false;
|
||||||
|
manageOrderFlow = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Manage ...
|
||||||
|
Manage(iBar);
|
||||||
@@ -0,0 +1,496 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Check Bar Has Signal Based on Strategy 3 ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL, reference to Bar ...
|
||||||
|
* @param zone: XBoxZone, reference to holds affected zone ...
|
||||||
|
* @param targets: XTarget, reference to detected Signal's Targets collections ...
|
||||||
|
* @param dir: ENUM_X_DIRECTION, detected Signal's direction ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool Strategy1HasSignal(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &zone,
|
||||||
|
XTarget &targets[],
|
||||||
|
ENUM_X_DIRECTION &dir //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare ...
|
||||||
|
zone.Clean();
|
||||||
|
XClean(targets);
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate ...
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validator Flags ...
|
||||||
|
bool validateByZones = true;
|
||||||
|
bool validateByPinBar = true;
|
||||||
|
bool validateByBarPatterns = true;
|
||||||
|
bool validateByCyclesTrend = true;
|
||||||
|
bool validateByMaFastSlowGrows = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Define Requirements ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
XOHCL p2Bar;
|
||||||
|
XOHCL p3Bar;
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
XPatternAnalysis pBarPatterns;
|
||||||
|
XPatternAnalysis p2BarPatterns;
|
||||||
|
XPatternAnalysis p3BarPatterns;
|
||||||
|
XPatternAnalysisConfig iPatternsConfig;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Bars ...
|
||||||
|
result = bar.GetPreviousBar(pBar);
|
||||||
|
result = result &&
|
||||||
|
pBar.GetPreviousBar(p2Bar);
|
||||||
|
result = result &&
|
||||||
|
p2Bar.GetPreviousBar(p3Bar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
p2Bar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Bar Patterns ...
|
||||||
|
iPatternsConfig.Default();
|
||||||
|
iPatternsConfig.FullPattern();
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
poiDetector.AnalyseBarPatterns(
|
||||||
|
pBar,
|
||||||
|
pBarPatterns,
|
||||||
|
iPatternsConfig //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
poiDetector.AnalyseBarPatterns(
|
||||||
|
p2Bar,
|
||||||
|
p2BarPatterns,
|
||||||
|
iPatternsConfig //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
poiDetector.AnalyseBarPatterns(
|
||||||
|
p3Bar,
|
||||||
|
p3BarPatterns,
|
||||||
|
iPatternsConfig //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
pBar.Clean();
|
||||||
|
p2Bar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
pBarPatterns.Clean();
|
||||||
|
p2BarPatterns.Clean();
|
||||||
|
p3BarPatterns.Clean();
|
||||||
|
iPatternsConfig.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect a Cross of MAs ...
|
||||||
|
bool isFastCrossedOverSlow = fimaParser.IsMAFastCrossedOverSlow(p2Bar.Index());
|
||||||
|
bool isFastCrossedUnderSlow = fimaParser.IsMAFastCrossedUnderSlow(p2Bar.Index());
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish = isFastCrossedOverSlow;
|
||||||
|
isBearish = isFastCrossedUnderSlow;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Cross By Over/Under Last ...
|
||||||
|
if (result && validateByMaFastSlowGrows)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
bool isFastOverLast = fimaParser.IsMAFastOverLast(pBar.Index());
|
||||||
|
bool isSlowOverLast = fimaParser.IsMASlowOverLast(pBar.Index());
|
||||||
|
bool isOverLast = isFastOverLast && isSlowOverLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
bool isFastUnderLast = fimaParser.IsMAFastUnderLast(pBar.Index());
|
||||||
|
bool isSlowUnderLast = fimaParser.IsMASlowUnderLast(pBar.Index());
|
||||||
|
bool isUnderLast = isFastUnderLast && isSlowUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
isOverLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
isUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate By Cycles Trend ...
|
||||||
|
if (result && validateByCyclesTrend)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Reading Cycles Trend ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLCMABullish = fimaParser.IsLCMABullish(pBar.Index());
|
||||||
|
bool isHCMABullish = fimaParser.IsHCMABullish(pBar.Index());
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLCMAOverLast = fimaParser.IsLCMAOverLast(pBar.Index());
|
||||||
|
bool isHCMAOverLast = fimaParser.IsHCMAOverLast(pBar.Index());
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCyclesMABullish = isLCMABullish && isHCMABullish && isLCMAOverLast && isHCMAOverLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLCMABearish = fimaParser.IsLCMABearish(pBar.Index());
|
||||||
|
bool isHCMABearish = fimaParser.IsHCMABearish(pBar.Index());
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLCMAUnderLast = fimaParser.IsLCMAUnderLast(pBar.Index());
|
||||||
|
bool isHCMAUnderLast = fimaParser.IsHCMAUnderLast(pBar.Index());
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isCyclesMABearish = isLCMABearish && isHCMABearish && isLCMAUnderLast && isHCMAUnderLast;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
isCyclesMABullish;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
isCyclesMABearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Has a PinBar ...
|
||||||
|
if (result && validateByPinBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool isPBarIsPinBar = poiDetector.IsPinnedBar(pBar, dir);
|
||||||
|
bool isPBarIsPinBarBullish = isPBarIsPinBar && IsXBullish(dir);
|
||||||
|
bool isPBarIsPinBarBearish = isPBarIsPinBar && IsXBearish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isP2BarIsPinBar = poiDetector.IsPinnedBar(p2Bar, dir);
|
||||||
|
bool isP2BarIsPinBarBullish = isP2BarIsPinBar && IsXBullish(dir);
|
||||||
|
bool isP2BarIsPinBarBearish = isP2BarIsPinBar && IsXBearish(dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishPin = isPBarIsPinBarBullish || isP2BarIsPinBarBullish;
|
||||||
|
bool isBearishPin = isPBarIsPinBarBearish || isP2BarIsPinBarBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
isBullishPin;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
isBearishPin;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate By Bar Patterns ...
|
||||||
|
if (result && validateByBarPatterns)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = 0;
|
||||||
|
int bullishCount = 0;
|
||||||
|
int bearishCount = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
count = pBarPatterns.Count(X_DIRECTION_BULLISH);
|
||||||
|
bullishCount += count;
|
||||||
|
|
||||||
|
//
|
||||||
|
count = p2BarPatterns.Count(X_DIRECTION_BULLISH);
|
||||||
|
bullishCount += count;
|
||||||
|
|
||||||
|
//
|
||||||
|
count = pBarPatterns.Count(X_DIRECTION_BEARISH);
|
||||||
|
bearishCount += count;
|
||||||
|
|
||||||
|
//
|
||||||
|
count = p2BarPatterns.Count(X_DIRECTION_BEARISH);
|
||||||
|
bearishCount += count;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBullishScore = IsValidSize(bullishCount) &&
|
||||||
|
bullishCount > bearishCount;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasBearishScore = IsValidSize(bearishCount) &&
|
||||||
|
bearishCount > bullishCount;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Bar Patterns ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
bool isPBarHasBullishPatterns =
|
||||||
|
(pBarPatterns.HasPattern(X_BAR_PATTERN_FLAG, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_STAR, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_RISING, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_MOMENTUM, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_PIERCING, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BULLISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_TRUE_GAPED, X_DIRECTION_BULLISH));
|
||||||
|
bool isP2BarHasBullishPatterns =
|
||||||
|
(p2BarPatterns.HasPattern(X_BAR_PATTERN_FLAG, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_STAR, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_RISING, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_MOMENTUM, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_PIERCING, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BULLISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_TRUE_GAPED, X_DIRECTION_BULLISH));
|
||||||
|
bool hasBullishPatterns = isPBarHasBullishPatterns || isP2BarHasBullishPatterns;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
bool isPBarHasBearishPatterns =
|
||||||
|
(pBarPatterns.HasPattern(X_BAR_PATTERN_FLAG, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_STAR, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_RISING, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_MOMENTUM, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_PIERCING, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BEARISH) ||
|
||||||
|
pBarPatterns.HasPattern(X_BAR_PATTERN_TRUE_GAPED, X_DIRECTION_BEARISH));
|
||||||
|
bool isP2BarHasBearishPatterns =
|
||||||
|
(p2BarPatterns.HasPattern(X_BAR_PATTERN_FLAG, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_STAR, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_PINNED, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_RISING, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_ENGULFED, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_MOMENTUM, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_PIERCING, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_SIGNALKEY, X_DIRECTION_BEARISH) ||
|
||||||
|
p2BarPatterns.HasPattern(X_BAR_PATTERN_TRUE_GAPED, X_DIRECTION_BEARISH));
|
||||||
|
bool hasBearishPatterns = isPBarHasBearishPatterns || isP2BarHasBearishPatterns;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
hasBullishScore &&
|
||||||
|
hasBullishPatterns;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
hasBearishScore &&
|
||||||
|
hasBearishPatterns;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish || isBearish;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate By Zones ...
|
||||||
|
if (result && validateByZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone zones[];
|
||||||
|
int count = poiDetector.DetectZones(
|
||||||
|
pBar,
|
||||||
|
zones,
|
||||||
|
true, // Validate Zones ...
|
||||||
|
false, // OB ...
|
||||||
|
true, // FVG ...
|
||||||
|
true, // Supports ...
|
||||||
|
true, // Resistances ...
|
||||||
|
X_DIRECTION_NONE, // All Directions ...
|
||||||
|
X_SORT_BY_DATE, // Sort By ...
|
||||||
|
X_DIRECTION_BEARISH, // Sort Direction ...
|
||||||
|
5, // Zones Loopback ...
|
||||||
|
5, // Zones Validation ...
|
||||||
|
100 // Loopback ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
poiDrawer.DrawZones(zones, structureDrawConfig.drawConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
DebugBreak();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = false;
|
||||||
|
isBullish = false;
|
||||||
|
isBearish = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting Direction ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = HasDirection(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Zone ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Since Zone Prepared in Above Steps ...
|
||||||
|
// here we only Validate it ...
|
||||||
|
result = zone.IsValid();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draws ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPOIDrawConfig iConfig = structureDrawConfig.drawConfig;
|
||||||
|
XPatternAnalysisDrawConfig iPatternsConfig = structureDrawConfig.barAnalysisDrawConfig;
|
||||||
|
iConfig.trendRayLeft = false;
|
||||||
|
iConfig.trendRayRight = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Zone ...
|
||||||
|
if (zone.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iConfig.zonesStyle = STYLE_DASHDOT;
|
||||||
|
iConfig.bullishColor = clrYellow;
|
||||||
|
iConfig.bearishColor = clrDarkOrange;
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDrawer.DrawZone(zone, iConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// poiDrawer.DrawZone(mcPVZone, iConfig);
|
||||||
|
// poiDrawer.DrawZone(lcPVZone, iConfig);
|
||||||
|
// poiDrawer.DrawZone(hcPVZone, iConfig);
|
||||||
|
|
||||||
|
//
|
||||||
|
// poiDrawer.DrawZone(pinBarZone, iConfig);
|
||||||
|
// poiDrawer.DrawZone(pullbackZone, iConfig);
|
||||||
|
// poiDrawer.DrawTrendLine(pinBarZoneTrend, iConfig);
|
||||||
|
|
||||||
|
//
|
||||||
|
poiDrawer.DrawPatternAnalysis(pBarPatterns, iPatternsConfig);
|
||||||
|
poiDrawer.DrawPatternAnalysis(p2BarPatterns, iPatternsConfig);
|
||||||
|
poiDrawer.DrawPatternAnalysis(p3BarPatterns, iPatternsConfig);
|
||||||
|
|
||||||
|
//
|
||||||
|
// if (hasATRBox)
|
||||||
|
// {
|
||||||
|
// poiDrawer.DrawZone(atrBox, iConfig);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
// if (hasDoublePatterns)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// poiDrawer.DrawPatternAnalysis(iPatterns, iPatternsConfig);
|
||||||
|
// poiDrawer.DrawPatternAnalysis(iPPatterns, iPatternsConfig);
|
||||||
|
// }
|
||||||
|
|
||||||
|
//
|
||||||
|
iConfig.Clean();
|
||||||
|
iPatternsConfig.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
DebugBreak();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// result = false;
|
||||||
|
// isBullish = false;
|
||||||
|
// isBearish = false;
|
||||||
|
// zone.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Targets ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zone.Clean();
|
||||||
|
XClean(targets);
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
}
|
||||||
|
pBar.Clean();
|
||||||
|
p2Bar.Clean();
|
||||||
|
p3Bar.Clean();
|
||||||
|
pBarPatterns.Clean();
|
||||||
|
p2BarPatterns.Clean();
|
||||||
|
p3BarPatterns.Clean();
|
||||||
|
iPatternsConfig.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -2110,7 +2110,7 @@ class XCXFIMAPOIDetector : public XCMarketPatternDetector
|
|||||||
ENUM_X_PRICE bullishRejectLowerPriceType = X_PRICE_LOW,
|
ENUM_X_PRICE bullishRejectLowerPriceType = X_PRICE_LOW,
|
||||||
ENUM_X_PRICE bearishRejectUpperPriceType = X_PRICE_HIGH,
|
ENUM_X_PRICE bearishRejectUpperPriceType = X_PRICE_HIGH,
|
||||||
ENUM_X_PRICE bearishRejectLowerPriceType = X_PRICE_UP,
|
ENUM_X_PRICE bearishRejectLowerPriceType = X_PRICE_UP,
|
||||||
bool ignoreBoundary = false //
|
bool ignoreBoundary = true //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user