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 //
)
{
//
+41 -1
View File
@@ -24,7 +24,6 @@
// Imports ...
#include "../../Classes/x-saherelm.x-bar.analyser.class.mq5"
#include "../../Classes/x-saherelm.x-poi.drawer.class.mq5"
#include "../Libraries/xcatbea.lib.mq5"
//
// Definiions ...
@@ -194,6 +193,7 @@ struct XTriggerBlockFilters
{
//
// Props ...
bool filterBasedOnKI; // Filter Based On KI Flats ...
bool filterBasedOnPV; // Filter Based On PV ...
bool filterBasedOnSar; // Filter Based On SAR ...
bool filterBasedOnRSI; // Filter Based On RSI ...
@@ -203,6 +203,7 @@ struct XTriggerBlockFilters
bool filterBasedOnDelta; // Filter Based On Delta ...
bool filterBasedOnVolume; // Filter Based On Volume ...
bool filterBasedOnSignalBar; // Filter Based on Signal Bar ...
bool filterBasedOnRoundPrice; // Filter Based On Round Prices ...
bool filterBasedOnHKSignalBar; // Filter Based On HK Signal Bar ...
//
@@ -251,6 +252,7 @@ struct XTriggerBlockFilters
void Clean()
{
//
filterBasedOnKI = false;
filterBasedOnPV = false;
filterBasedOnSar = false;
filterBasedOnRSI = false;
@@ -260,6 +262,7 @@ struct XTriggerBlockFilters
filterBasedOnDelta = false;
filterBasedOnVolume = false;
filterBasedOnSignalBar = false;
filterBasedOnRoundPrice = false;
filterBasedOnHKSignalBar = false;
//
@@ -1158,6 +1161,34 @@ bool FilterTriggerBlock(
//
// Checking Conditions ...
//
// Filter Based KI ...
if (result &&
filters.filterBasedOnKI)
{
//
int count = 0;
toIDX = triggerBlock.ob.ToIndex();
fromIDX = triggerBlock.ob.FromIndex();
double lKI = conditions.kiBuffer[zIDX];
for (int i = toIDX; i < fromIDX; i++)
{
//
double iKI = helper.GetKI(i);
if (iKI == lKI)
{
count++;
}
else
{
break;
}
}
//
result = count >= 3;
}
//
// Filter Based On PV ...
if (result &&
@@ -2230,6 +2261,15 @@ bool FilterTriggerBlock(
}
}
//
// Filter Based Round Price ...
if (result &&
filters.filterBasedOnRoundPrice)
{
//
// TODO: Implement this ...
}
//
if (!result)
{
+6 -3
View File
@@ -21,10 +21,11 @@
//
// Imports ...
#include "../../Helpers/x-saherelm.x121.xcatb.helper.mq5"
#include "../../Libraries/x-saherelm.common.lib.mq5"
#include "../../Libraries/x-saherelm.x-poi.lib.mq5"
#include "../../Libraries/x-saherelm.x-trade.lib.mq5"
#include "../../Helpers/x-saherelm.x121.xcatb.helper.mq5"
#include "../Libraries/xcatbea.lib.mq5"
//
// Definitions ...
@@ -60,8 +61,9 @@ struct XCATBEAStrategyConditions
datetime triggerTime;
//
XBoxZone pivotZone;
ENUM_X_DIRECTION dir;
XBoxZone decisionZone;
XTriggerBlock triggerBlock;
ENUM_X_POSITION_TYPES type;
X121XCatbConditions conditions;
@@ -102,8 +104,9 @@ struct XCATBEAStrategyConditions
Clean(targets);
//
pivotZone.Clean();
conditions.Clean();
decisionZone.Clean();
triggerBlock.Clean();
//
dir = X_DIRECTION_NONE;
File diff suppressed because it is too large Load Diff