This commit is contained in:
2025-05-08 13:07:25 +03:30
parent 6b95e10890
commit c013e593ad
5 changed files with 233 additions and 33 deletions
+9
View File
@@ -34,6 +34,15 @@
"id": "2", "id": "2",
"references": [], "references": [],
"title": "Add Support for Daily Max Volume and Ticks Box in XCAEA POI Detector ..." "title": "Add Support for Daily Max Volume and Ticks Box in XCAEA POI Detector ..."
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-07T22:57:51.059Z",
"id": "3",
"references": [],
"title": "add support for Block Detection in Bar Analyser Class"
} }
], ],
"done": [] "done": []
+163
View File
@@ -1868,6 +1868,169 @@ class XCBarAnalyser : public XCBase
return result; return result;
} }
/**
* Check a Bar is End of an OrderBlock Bar or Not ...
*
* @param bar: XOHCL ...
* @param box: XBoxZone ...
* @param forceFVGBarType: bool, Force all Bars must be Same as Direction ...
* @param forceOBTwoBar: bool, Force Two Bars of OB Start must be InDirection ...
*
* @return ( bool )
*/
bool IsOrderBlock(
XOHCL &bar,
XBoxZone &box,
bool forceFVGBarType = false,
bool forceOBTwoBar = false //
)
{
//
bool result = false;
//
box.Clean();
//
result = bar.IsValid();
if (!result)
{
return result;
}
//
// Check Bar Must be FVG ...
result = IsFVG(
bar,
box,
forceFVGBarType //
);
if (!result)
{
//
box.Clean();
//
return result;
}
//
box.type = "XOB";
//
bool isBullish = box.IsBullish();
bool isBearish = box.IsBearish();
//
// Order Block Includes an FVG which Starts by atleast One
// or More Indirectional Bars ...
XOHCL fvgLastBar;
XOHCL fvgLastBarPrev;
//
int barIndex = bar.Index();
int fvgLastBarIndex = barIndex + 3;
result = fvgLastBar.Init(
bar.symbol,
bar.period,
fvgLastBarIndex //
);
result =
result &&
fvgLastBar.GetPreviousBar(fvgLastBarPrev);
if (!result)
{
//
box.Clean();
fvgLastBar.Clean();
fvgLastBarPrev.Clean();
//
return result;
}
//
// Check FVG Last Bar ...
//
bool isBullishBlock =
isBullish &&
fvgLastBar.IsBearish();
//
bool isBearishBlock =
isBearish &&
fvgLastBar.IsBullish();
//
// Update Box ...
//
if (isBullishBlock ||
isBearishBlock)
{
//
box.from = fvgLastBar.time;
//
box.lower = MathMin(box.lower, fvgLastBar.low);
box.upper = MathMax(box.upper, fvgLastBar.high);
}
//
// Apply Force Two Bar ...
if (forceOBTwoBar)
{
//
isBullishBlock =
isBullishBlock &&
fvgLastBarPrev.IsBearish();
//
isBearishBlock =
isBearishBlock &&
fvgLastBarPrev.IsBullish();
//
// Update Box ...
if (isBullishBlock ||
isBearishBlock)
{
//
box.from = fvgLastBarPrev.time;
box.lower = MathMin(box.lower, fvgLastBarPrev.low);
box.upper = MathMax(box.upper, fvgLastBarPrev.high);
}
}
//
result = isBullishBlock ||
isBearishBlock;
if (!result)
{
//
box.Clean();
fvgLastBar.Clean();
fvgLastBarPrev.Clean();
//
return result;
}
//
result = box.IsValid();
//
// Cleanup Resources ...
//
fvgLastBar.Clean();
fvgLastBarPrev.Clean();
//
return result;
}
// //
// Candlestick ... // Candlestick ...
+14 -10
View File
@@ -63,6 +63,7 @@ input string eaSessionEndTime = ""; // Trade End Time
input int eaMaxAllowedPositions = 5; // Max Allowed Same Time Trades input int eaMaxAllowedPositions = 5; // Max Allowed Same Time Trades
input double eaMaxAllowedSpread = 25; // Max Allowed Spread For Trade input double eaMaxAllowedSpread = 25; // Max Allowed Spread For Trade
input double eaMaxAllowedDrawdownFactor = 0.3; // Max Allowed DrawDown for Trade input double eaMaxAllowedDrawdownFactor = 0.3; // Max Allowed DrawDown for Trade
input string eaCloseAllOpenTradesAt = ""; // Close All Open Trades per Day At Specified Time
// //
// Alert ... // Alert ...
@@ -182,12 +183,6 @@ void OnTick()
int count = 0; int count = 0;
bool has = false; bool has = false;
//
if (eaTimeTracker.IsNewDay())
{
eaTradeManager.HandleNewDay();
}
// //
HandleTimeReport(); HandleTimeReport();
@@ -715,14 +710,23 @@ void HandleTimeReport()
// //
// Daily Report .... // Daily Report ....
if (eaReportNewDays && bool isNewDay = eaTimeTracker.IsNewDay();
eaTimeTracker.IsNewDay()) if (isNewDay)
{ {
// //
string msg = "New Day ..."; // Handle New Day on Trade Manager ...
eaTradeManager.HandleNewDay();
// //
eaAlert.Alert(msg); // Reporting New Day if Reuired ...
if (eaReportNewDays)
{
//
string msg = "New Day ...";
//
eaAlert.Alert(msg);
}
} }
// //
+21
View File
@@ -578,6 +578,24 @@ bool DetectDecisionZone(
// //
bool isVolumeNeutural = MathAbs(bullishVolume - bearishVolume) == 0; bool isVolumeNeutural = MathAbs(bullishVolume - bearishVolume) == 0;
//
// Checking OB ...
XBoxZone ob;
bool isOB = helper
.barAnalyser
.IsOrderBlock(
cBar,
ob,
false, // Force FVG Bar Type
true // Force Two Bar Start ...
);
bool isBullishOB =
isOB &&
ob.IsBullish();
bool isBearishOB =
isOB &&
ob.IsBearish();
// //
// Reading Values ... // Reading Values ...
@@ -1074,6 +1092,7 @@ bool DetectDecisionZone(
// //
bool isCond1Bullish = bool isCond1Bullish =
isBullishOB &&
isCIsValePivot && isCIsValePivot &&
isRSICrossedOverOS && isRSICrossedOverOS &&
!isFiboSectionChanged && !isFiboSectionChanged &&
@@ -1081,6 +1100,7 @@ bool DetectDecisionZone(
// //
bool isCond1Bearish = bool isCond1Bearish =
isBearishOB &&
isCIsPeakPivot && isCIsPeakPivot &&
isRSICrossedUnderOB && isRSICrossedUnderOB &&
!isFiboSectionChanged && !isFiboSectionChanged &&
@@ -1234,6 +1254,7 @@ bool DetectDecisionZone(
// Cleaning Up ... // Cleaning Up ...
// //
ob.Clean();
zBar.Clean(); zBar.Clean();
cBar.Clean(); cBar.Clean();
pBar.Clean(); pBar.Clean();
+23 -20
View File
@@ -121,28 +121,28 @@ class XCXCAEASignaller : XCBase
inputs.x3maInputs.fastLength = 5; inputs.x3maInputs.fastLength = 5;
// //
inputs.x3maInputs.showFast = true; inputs.x3maInputs.showFast = false;
inputs.x3maInputs.showSlow = true; inputs.x3maInputs.showSlow = false;
inputs.x3maInputs.showMedium = true; inputs.x3maInputs.showMedium = false;
// //
inputs.caInputs.showMAH = true; inputs.caInputs.showMAH = false;
inputs.caInputs.showMAL = true; inputs.caInputs.showMAL = false;
inputs.caInputs.showMAC = true; inputs.caInputs.showMAC = false;
inputs.caInputs.showSar = true; inputs.caInputs.showSar = false;
inputs.caInputs.showSwings = true; inputs.caInputs.showSwings = true;
inputs.caInputs.showFiboLevel1 = true; inputs.caInputs.showFiboLevel1 = false;
inputs.caInputs.showFiboLevel2 = true; inputs.caInputs.showFiboLevel2 = false;
inputs.caInputs.showFiboLevel3 = true; inputs.caInputs.showFiboLevel3 = false;
inputs.caInputs.showFiboLevel4 = true; inputs.caInputs.showFiboLevel4 = false;
inputs.caInputs.showFiboLevel5 = true; inputs.caInputs.showFiboLevel5 = false;
inputs.caInputs.showPeaksAndVales = true; inputs.caInputs.showPeaksAndVales = true;
// //
inputs.caInputs.showKI = true; inputs.caInputs.showKI = false;
inputs.caInputs.showTKI = true; inputs.caInputs.showTKI = false;
inputs.caInputs.showVidya = true; inputs.caInputs.showVidya = false;
inputs.caInputs.showTrend = true; inputs.caInputs.showTrend = false;
inputs.caInputs.showPeakAndValeGolden = false; inputs.caInputs.showPeakAndValeGolden = false;
inputs.caInputs.showSupportAndResistance = false; inputs.caInputs.showSupportAndResistance = false;
@@ -159,7 +159,7 @@ class XCXCAEASignaller : XCBase
// //
// Oscillators Views ... // Oscillators Views ...
inputs.showRSI = true; inputs.showRSI = false;
inputs.showCCI = false; inputs.showCCI = false;
inputs.showMFI = false; inputs.showMFI = false;
inputs.showRVI = false; inputs.showRVI = false;
@@ -693,7 +693,10 @@ class XCXCAEASignaller : XCBase
} }
// //
double risk = MathAbs(entry - sl); double spred = GetSpread(conditions.symbol);
//
double risk = MathAbs(entry - sl) + spred;
double reward = (risk * conditions.reward); double reward = (risk * conditions.reward);
tp = tp =
isBullish isBullish
@@ -725,8 +728,8 @@ class XCXCAEASignaller : XCBase
// //
// Handling Partial Close ... // Handling Partial Close ...
conditions.partialCloseOnTPLevel = 1; // conditions.partialCloseOnTPLevel = 1;
conditions.partialCloseMultiplier = 0.5; // conditions.partialCloseMultiplier = 0.5;
// //
conditions.sl = sl; conditions.sl = sl;