add support for leg management in XFIMA1 Signaller ...
This commit is contained in:
@@ -343,6 +343,10 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Manage Leg ...
|
||||
ManageLeg(iBar);
|
||||
|
||||
//
|
||||
// Strategy X ...
|
||||
has = HasSignal(
|
||||
@@ -516,6 +520,118 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
XLeg leg; // Exists Leg ...
|
||||
|
||||
//
|
||||
bool HasLeg()
|
||||
{
|
||||
return leg.IsValid();
|
||||
}
|
||||
|
||||
//
|
||||
bool ValidateLeg(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = HasLeg() && bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
result =
|
||||
leg.IsBullish()
|
||||
? bar.low > leg.lower
|
||||
: leg.IsBearish()
|
||||
? bar.high < leg.upper
|
||||
: false;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
void DrawLeg()
|
||||
{
|
||||
//
|
||||
if (!HasLeg())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Update to Times ...
|
||||
leg.UpdateTimes();
|
||||
|
||||
//
|
||||
// Draw Leg Box ...
|
||||
XBoxZone legZone;
|
||||
leg.ToBox(legZone);
|
||||
if (legZone.IsValid())
|
||||
{
|
||||
//
|
||||
legZone.to = TimeCurrent();
|
||||
poiDrawer.DrawZone(legZone, structureDrawConfig.drawConfig);
|
||||
}
|
||||
|
||||
//
|
||||
// Draw Legs Other Stufs ...
|
||||
return;
|
||||
|
||||
//
|
||||
// FVGs ...
|
||||
poiDrawer.DrawZones(leg.bullishFVGs, structureDrawConfig.drawConfig);
|
||||
poiDrawer.DrawZones(leg.bearishFVGs, structureDrawConfig.drawConfig);
|
||||
|
||||
//
|
||||
// Support and Resistances ...
|
||||
poiDrawer.DrawZones(leg.supports, structureDrawConfig.drawConfig);
|
||||
poiDrawer.DrawZones(leg.resistances, structureDrawConfig.drawConfig);
|
||||
|
||||
//
|
||||
// Patterns ...
|
||||
poiDrawer.DrawPatternAnalysises(leg.patterns, structureDrawConfig.barAnalysisDrawConfig);
|
||||
}
|
||||
|
||||
//
|
||||
void ManageLeg(XOHCL &bar)
|
||||
{
|
||||
//
|
||||
if (HasLeg())
|
||||
{
|
||||
//
|
||||
if (!ValidateLeg(bar))
|
||||
{
|
||||
//
|
||||
// Invalidate XLeg ...
|
||||
leg.Clean();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Detect New Leg ...
|
||||
if (!HasLeg())
|
||||
{
|
||||
poiDetector.IsLegPattern(bar, leg);
|
||||
}
|
||||
|
||||
//
|
||||
// Update Exists Leg ...
|
||||
if (HasLeg())
|
||||
{
|
||||
//
|
||||
// Update to Times ...
|
||||
leg.UpdateTimes();
|
||||
|
||||
//
|
||||
DrawLeg();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Implementing Strategies ...
|
||||
|
||||
@@ -1905,51 +2021,80 @@ class XCXFIMAStrategy1Signaller : public XCXFIMABaseSignaller
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
UpdateToTime(orderFlow, bar.time);
|
||||
poiDrawer.DrawZones(orderFlow, structureDrawConfig.drawConfig);
|
||||
poiDrawer.DrawPatternAnalysis(pBarPatterns, structureDrawConfig.barAnalysisDrawConfig);
|
||||
// //
|
||||
// UpdateToTime(orderFlow, bar.time);
|
||||
// poiDrawer.DrawZones(orderFlow, structureDrawConfig.drawConfig);
|
||||
// poiDrawer.DrawPatternAnalysis(pBarPatterns, structureDrawConfig.barAnalysisDrawConfig);
|
||||
|
||||
//
|
||||
// Draw ATR Band Middle ...
|
||||
if (NotEmptyZero(atrBandMiddle))
|
||||
{
|
||||
//
|
||||
XPOIDrawConfig iConfig = structureDrawConfig.drawConfig;
|
||||
iConfig.trendRayLeft = false;
|
||||
iConfig.trendRayRight = false;
|
||||
// //
|
||||
// // Draw ATR Band Middle ...
|
||||
// if (NotEmptyZero(atrBandMiddle))
|
||||
// {
|
||||
// //
|
||||
// XPOIDrawConfig iConfig = structureDrawConfig.drawConfig;
|
||||
// iConfig.trendRayLeft = false;
|
||||
// iConfig.trendRayRight = false;
|
||||
|
||||
//
|
||||
datetime to = bar.time;
|
||||
datetime from = p2Bar.BeforeOn();
|
||||
string trendName = "ATRBandMiddle_" + ToXString(TimeToSeconds(p2Bar.time));
|
||||
poiDrawer.DrawTrendLine(
|
||||
trendName,
|
||||
atrBandMiddle,
|
||||
from,
|
||||
atrBandMiddle,
|
||||
to,
|
||||
iConfig,
|
||||
clrYellow //
|
||||
);
|
||||
// //
|
||||
// datetime to = bar.time;
|
||||
// datetime from = p2Bar.BeforeOn();
|
||||
// string trendName = "ATRBandMiddle_" + ToXString(TimeToSeconds(p2Bar.time));
|
||||
// poiDrawer.DrawTrendLine(
|
||||
// trendName,
|
||||
// atrBandMiddle,
|
||||
// from,
|
||||
// atrBandMiddle,
|
||||
// to,
|
||||
// iConfig,
|
||||
// clrYellow //
|
||||
// );
|
||||
|
||||
//
|
||||
iConfig.Clean();
|
||||
}
|
||||
// //
|
||||
// iConfig.Clean();
|
||||
// }
|
||||
|
||||
//
|
||||
Print("OrderFlow ...");
|
||||
// //
|
||||
// Print("OrderFlow ...");
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone legZone;
|
||||
result = poiDetector.IsLegPattern(pBar, legZone);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
poiDrawer.DrawZone(legZone, structureDrawConfig.drawConfig);
|
||||
Print("Leg Pattern Detected ...");
|
||||
}
|
||||
// //
|
||||
// XLeg leg;
|
||||
// result = poiDetector.IsLegPattern(pBar, leg);
|
||||
// if (result)
|
||||
// {
|
||||
// //
|
||||
// // Update to Times ...
|
||||
// leg.UpdateTimes(bar.time);
|
||||
|
||||
// //
|
||||
// // Draw Leg Box ...
|
||||
// XBoxZone legZone;
|
||||
// leg.ToBox(legZone);
|
||||
// if (legZone.IsValid())
|
||||
// {
|
||||
// poiDrawer.DrawZone(legZone, structureDrawConfig.drawConfig);
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Draw Legs Other Stufs ...
|
||||
|
||||
// //
|
||||
// // FVGs ...
|
||||
// poiDrawer.DrawZones(leg.bullishFVGs, structureDrawConfig.drawConfig);
|
||||
// poiDrawer.DrawZones(leg.bearishFVGs, structureDrawConfig.drawConfig);
|
||||
|
||||
// //
|
||||
// // Support and Resistances ...
|
||||
// poiDrawer.DrawZones(leg.supports, structureDrawConfig.drawConfig);
|
||||
// poiDrawer.DrawZones(leg.resistances, structureDrawConfig.drawConfig);
|
||||
|
||||
// //
|
||||
// // Patterns ...
|
||||
// poiDrawer.DrawPatternAnalysises(leg.patterns, structureDrawConfig.barAnalysisDrawConfig);
|
||||
|
||||
// //
|
||||
// Print("Leg Pattern Detected ...");
|
||||
// }
|
||||
|
||||
//
|
||||
isBullish =
|
||||
|
||||
Reference in New Issue
Block a user