complete XCATBEA and all of it's requirements, such as:

- Expert Class;
- Class Based EA;
- Signaller(s);
- Multi Symbol;
- Multi Session;
- ...
This commit is contained in:
2025-05-31 06:51:39 +03:30
parent 16c58af75c
commit a5891ee2c6
10 changed files with 6236 additions and 264 deletions
File diff suppressed because it is too large Load Diff
+171 -6
View File
@@ -41,7 +41,11 @@ struct XCATBEASignallerInputs
// Pros ...
string symbol;
string provider;
ENUM_TIMEFRAMES period;
bool allowDraws;
bool allowGuards;
ENUM_TIMEFRAMES period;
double slATRMultiplier;
double riskToRewardRatio;
X121XCatbInputs catbInputs;
XTriggerBlockFilters filters;
XTriggerBlockValidationRules validations;
@@ -66,7 +70,11 @@ struct XCATBEASignallerInputs
provider = NULL;
filters.Clean();
catbInputs.Clean();
allowDraws = false;
validations.Clean();
allowGuards = false;
slATRMultiplier = 0;
riskToRewardRatio = 0;
//
ZeroMemory(this);
@@ -84,7 +92,8 @@ struct XCATBEASignallerInputs
IsValid(symbol) &&
IsValid(period) &&
IsValid(provider) &&
catbInputs.IsValid();
catbInputs.IsValid() &&
riskToRewardRatio > 0;
//
return result;
@@ -102,8 +111,10 @@ class XCXCATBEASignaller : XCBase
// Props ...
//
bool useGuards; // Use Guards or not ...
bool allowDraws; // Allow Draws or not ...
bool allowDraws; // Allow Draws or not ...
bool allowGuards; // Allow Guards or not ...
double slATRMultiplier; // SL ATR Multiplier ...
double riskToRewardRatio; // Signals R2R ...
//
XBarTracker barTraker; // Bar Tracker ...
@@ -112,6 +123,9 @@ class XCXCATBEASignaller : XCBase
XCXCATBEAPOIDrawer *drawer; // POI Drawer ...
XCXCATBEAPOIDetector *detector; // POI Detector ...
//
XBoxZone unavailableZones[]; // Un Available Zones ...
//
XCATBEAStrategyConditions mConditions;
XCATBEAStrategyConditions mConditionsCollection[];
@@ -151,6 +165,12 @@ class XCXCATBEASignaller : XCBase
return period;
}
//
double GetR2R()
{
return riskToRewardRatio;
}
//
// Tick Analyser ...
@@ -168,6 +188,7 @@ class XCXCATBEASignaller : XCBase
conditions.Clean();
//
XOHCL bar;
int count = 0;
bool has = false;
int barIndex = 0;
@@ -212,6 +233,18 @@ class XCXCATBEASignaller : XCBase
}
//
// When Setup Invalidated
// Signaller Clean Conditions ...
if (!has &&
!iConditions.IsValid())
{
//
selectedIDX = i;
break;
}
//
// Cleanup Resources ...
iConditions.Clean();
}
@@ -232,6 +265,21 @@ class XCXCATBEASignaller : XCBase
}
else
{
//
// Check Selected Index for Invalid Conditions ...
if (IsValidIndex(selectedIDX))
{
//
// Remove Invalidated Conditions ...
ArrayRemove(
mConditionsCollection,
selectedIDX,
1 //
);
}
//
// Cleanup Resource ...
conditions.Clean();
}
}
@@ -242,11 +290,38 @@ class XCXCATBEASignaller : XCBase
{
return;
}
//
// Initialize Bar ...
bar.Init(
symbol,
period,
barIndex //
);
//
// Detect POI(s) ...
detector.Detect(barIndex);
//
// Validate POI(s) ...
detector.Validate(
unavailableZones,
barIndex //
);
//
// Draw POI(s) ...
if (allowDraws)
{
drawer.Draw(bar.time);
}
//
// Check Signal Setups ...
has = DetectSignalSetup(barIndex);
if (has) {
if (has)
{
//
barTraker.Waits();
@@ -256,6 +331,10 @@ class XCXCATBEASignaller : XCBase
//
mConditions.Clean();
}
//
// Cleanup Resources ...
bar.Clean();
}
//
@@ -312,6 +391,40 @@ class XCXCATBEASignaller : XCBase
return result;
}
//
bool isBullish = IsBullish(conditions.dir);
bool isBearish = IsBearish(conditions.dir);
//
// Validate Direction of Setuped Conditions ...
result =
result &&
(isBullish ||
isBearish);
//
// Do Triggering Senario based on Trigger Block ...
if (result &&
conditions.triggerBlock.IsValid())
{
//
// Complete Conditions Here ...
}
//
// Do Other Validation Senarios ...
//
result = conditions.IsValid() &&
conditions.IsSetuped() &&
conditions.CanTrigger();
//
// Check Setup Age or Setup Validations here ...
if (!result)
{
}
//
// Cleanup Resources ...
@@ -339,14 +452,32 @@ class XCXCATBEASignaller : XCBase
//
// Normalize Args ...
Clean(guards);
barIndex = NormalizeInt(barIndex, 0);
//
result = allowGuards &&
HasChild(positions);
if (!result)
{
return result;
}
//
// TODO: Implement this ...
//
result = HasChild(guards);
//
// Cleanup Resources ...
//
if (!result)
{
Clean(guards);
}
//
return result;
}
@@ -372,6 +503,9 @@ class XCXCATBEASignaller : XCBase
symbol = inputs.symbol;
period = inputs.period;
provider = inputs.provider;
allowGuards = inputs.allowGuards;
slATRMultiplier = inputs.slATRMultiplier;
riskToRewardRatio = inputs.riskToRewardRatio;
//
// Initialize Bar Tracker ...
@@ -540,6 +674,8 @@ class XCXCATBEASignaller : XCBase
//
// Configure ...
detector.detectPeakPivots = true;
detector.detectValePivots = true;
}
//
@@ -552,6 +688,35 @@ class XCXCATBEASignaller : XCBase
//
// Configure ...
drawer.drawPeakPivots = true;
drawer.drawValePivots = true;
//
XCATBPivotStyle iStyle;
//
// Styling Peak Pivot ...
iStyle.width = 1;
iStyle.clr = clrMagenta;
iStyle.style = STYLE_SOLID;
//
drawer.peakPivotStyle = iStyle;
//
// Styling Vale Pivot ...
iStyle.width = 1;
iStyle.clr = clrAqua;
iStyle.style = STYLE_SOLID;
//
drawer.valePivotStyle = iStyle;
//
// Cleanup Resources ...
//
iStyle.Clean();
}
}
@@ -27,7 +27,7 @@
//
// Definitions ...
struct XCAPivotStyle
struct XCATBPivotStyle
{
//
// Properties ...
@@ -37,7 +37,7 @@ struct XCAPivotStyle
//
// Constructor ...
XCAPivotStyle()
XCATBPivotStyle()
{
Default();
}
@@ -89,12 +89,12 @@ class XCXCATBEAPOIDrawer : public XCBase
// Styling ...
//
XCAPivotStyle defaultBullishStyle;
XCAPivotStyle defaultBearishStyle;
XCATBPivotStyle defaultBullishStyle;
XCATBPivotStyle defaultBearishStyle;
//
XCAPivotStyle peakPivotStyle;
XCAPivotStyle valePivotStyle;
XCATBPivotStyle peakPivotStyle;
XCATBPivotStyle valePivotStyle;
//
// Constructors ...
@@ -250,7 +250,7 @@ class XCXCATBEAPOIDrawer : public XCBase
{
//
// Select Styling Config ...
XCAPivotStyle style;
XCATBPivotStyle style;
//
if (box.IsBullish())
@@ -569,7 +569,7 @@ class XCXCATBEAPOIDrawer : public XCBase
//
void ApplyPivotStyle(
XCBoxObject *&object,
XCAPivotStyle &style //
XCATBPivotStyle &style //
)
{
//