This commit is contained in:
2025-05-28 02:05:42 +03:30
parent e15c645f01
commit 4c6be67a2d
5 changed files with 1496 additions and 846 deletions
+37 -12
View File
@@ -4,32 +4,48 @@
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-08T10:58:12.985Z",
"id": "7",
"creation_time": "2025-05-27T22:08:09.236Z",
"description": {
"content": "- Create a List of Guards;\n- implement Guards;\n",
"mime": "text/markdown"
},
"id": "12",
"references": [],
"title": "add support for Swings on Block Detection ..."
"title": "Complete Guards ..."
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-08T10:50:29.074Z",
"id": "4",
"creation_time": "2025-05-27T22:08:57.604Z",
"description": {
"content": "- add Support for Multiple XTB Validations;\n- add a Counter to Positions Validation;\n- add Some Filter and Validation rules;\n",
"mime": "text/markdown"
},
"id": "13",
"references": [],
"title": "add support for OB in XCAEA POI Detector"
}
],
"in-progress": [
"title": "Edit XTriggerBlock Structure"
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-09T15:08:11.261Z",
"id": "10",
"creation_time": "2025-05-27T22:07:32.052Z",
"id": "11",
"references": [],
"title": "Add Support for Decision Box Finding Using Analyse ..."
"title": "Test Validations and Filters of XTriggerBlocks"
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-27T22:10:00.132Z",
"id": "14",
"references": [],
"title": "add support for Save Trades"
}
],
"in-progress": [],
"testing": [
{
"assignedTo": {
@@ -82,6 +98,15 @@
"references": [],
"title": "Add Support for Daily Max Volume and Ticks Box in XCAEA POI Detector ..."
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
},
"creation_time": "2025-05-09T15:08:11.261Z",
"id": "10",
"references": [],
"title": "Add Support for Decision Box Finding Using Analyse ..."
},
{
"assignedTo": {
"name": "Hadi Khazaee Asl"
+770
View File
@@ -0,0 +1,770 @@
// hasTB &&
// tb.IsBullish() &&
//
// isPeakOverLast &&
// isSarBullishStart
// &&
// isTrendBullishStart &&
// isADXBullishStart &&
// &&
// isSBarBullishStart
// &&
// isHKSBarBullishStart
//
//
// hasTB &&
// tb.IsBearish() &&
//
// isValeUnderLast &&
// isSarBearishStart
// &&
// isTrendBearishStart &&
// isADXBearishStart &&
// &&
// isSBarBearishStart
// &&
// isHKSBarBearishStart
//
bool DetectTriggerBlock(
XCPOIDrawer *drawer,
XCX121XCatbHelper *helper,
XCBarAnalyser *barAnalyser,
X121XCatbConditions &conditions,
XTriggerBlock &tb,
int barIndex = 0,
int loopback = 10 //
)
{
//
bool result = false;
//
// Normalize Args ...
tb.Clean();
conditions.Clean();
barIndex = NormalizeInt(barIndex, 0);
loopback = NormalizeInt(loopback, 0);
//
// Validate Args ...
result = helper != NULL;
if (!result)
{
return result;
}
//
// Reading Market Conditions ...
result = helper.GetConditions(
conditions,
barIndex,
loopback //
);
if (!result)
{
//
tb.Clean();
conditions.Clean();
}
//
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
int p3IDX = p2IDX + 1;
int p4IDX = p3IDX + 1;
//
// Checking Conditions ...
//
// Detect Bar Verifications ...
//
ENUM_X_DIRECTION iDir;
//
// Rejected ...
bool isRejected =
barAnalyser
.IsRejected(
conditions.bars[cIDX],
iDir //
);
bool isBullishRejected =
isRejected &&
IsBullish(iDir);
bool isBearishRejected =
isRejected &&
IsBearish(iDir);
//
// Engulfed ...
bool isEngulfed =
barAnalyser
.IsEngulfed(
conditions.bars[cIDX],
iDir //
);
bool isBullishEngulfed =
isEngulfed &&
IsBullish(iDir);
bool isBearishEngulfed =
isEngulfed &&
IsBearish(iDir);
//
// Momentum ...
bool isMomentum =
barAnalyser
.IsMomentum(
conditions.bars[cIDX],
iDir //
);
bool isBullishMomentum =
isMomentum &&
IsBullish(iDir);
bool isBearishMomentum =
isMomentum &&
IsBearish(iDir);
//
bool isBarBullishPressured =
isBullishRejected ||
isBullishEngulfed ||
isBullishMomentum;
//
bool isBarBearishPressured =
isBearishRejected ||
isBearishEngulfed ||
isBearishMomentum;
//
// Detect Indicator Base Start Directional Movement ...
//
// SAR ...
//
bool isSarBullishStart =
//
(
//
// Current SAR is Directional ...
conditions.isSarBullish &&
//
// Previous InDirectional Sar Exists ...
helper.lastSarBearish.IsValid() &&
//
// Current Close is Over previous Sar ...
conditions.bars[cIDX].close > helper.lastSarBearish.after &&
//
// Before Close is not Over previous Sar ...
conditions.bars[pIDX].close <= helper.lastSarBearish.after
//
)
//
;
//
bool isSarBearishStart =
//
(
//
// Current SAR is Directional ...
conditions.isSarBearish &&
//
// Previous InDirectional Sar Exists ...
helper.lastSarBullish.IsValid() &&
//
// Current Close is Under previous ...
conditions.bars[cIDX].close < helper.lastSarBullish.after &&
//
// Before Close is not Under previous ...
conditions.bars[pIDX].close >= helper.lastSarBullish.after
//
)
//
;
//
// TREND ...
//
bool isTrendBullishStart =
//
(
//
// Current Trend is Directional ...
conditions.isTrendBullish &&
//
// Previous InDirectiona; Trend Exists ...
helper.lastTrendBearish.IsValid() &&
//
// Current Close is Over previous ...
conditions.bars[cIDX].close > helper.lastTrendBearish.after &&
//
// Before close is not Over previous ...
conditions.bars[pIDX].close <= helper.lastTrendBearish.after
//
)
//
;
//
bool isTrendBearishStart =
//
(
//
// Current Trend is Directional ...
conditions.isTrendBearish &&
//
// Previous InDirectiona; Trend Exists ...
helper.lastTrendBullish.IsValid() &&
//
// Current Close is Under previous ...
conditions.bars[cIDX].close < helper.lastTrendBullish.after &&
//
// Before close is not Under previous ...
conditions.bars[pIDX].close >= helper.lastTrendBullish.after
//
)
//
;
//
// ADX ...
//
bool isADXBullishStart =
//
(
//
// ADX Value is Switched to Strong ...
conditions.adxBuffer[cIDX] > conditions.adxThreshold &&
conditions.adxBuffer[pIDX] <= conditions.adxThreshold &&
//
// ADX must Up ...
conditions.adxBuffer[cIDX] > conditions.adxBuffer[pIDX] &&
//
// ADX +DI is Bigger than -DI ...
conditions.adxpBuffer[cIDX] > conditions.adxnBuffer[cIDX] &&
//
// ADX +DI is Up ...
conditions.adxpBuffer[cIDX] > conditions.adxpBuffer[pIDX]
//
)
//
;
//
bool isADXBearishStart =
//
(
//
// ADX Value is Switched to Strong ...
conditions.adxBuffer[cIDX] > conditions.adxThreshold &&
conditions.adxBuffer[pIDX] <= conditions.adxThreshold &&
//
// ADX must Up ...
conditions.adxBuffer[cIDX] > conditions.adxBuffer[pIDX] &&
//
// ADX -DI is Bigger than +DI ...
conditions.adxnBuffer[cIDX] > conditions.adxpBuffer[cIDX] &&
//
// ADX -DI is Up ...
conditions.adxnBuffer[cIDX] > conditions.adxnBuffer[pIDX]
//
)
//
;
//
// DELTA ...
//
bool isDeltaBullishStart =
//
// Check State ...
(
//
// Delta is Up ...
conditions.deltaBuffer[cIDX] > conditions.deltaBuffer[pIDX] &&
//
// Delta Signal is Up ...
conditions.deltaSignalBuffer[cIDX] > conditions.deltaSignalBuffer[pIDX] &&
//
// Delta Crossed Over Delta Signal ...
conditions.deltaBuffer[cIDX] > conditions.deltaSignalBuffer[cIDX]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastDeltaBearish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close > helper.lastDeltaBearish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close <= helper.lastDeltaBearish.after
//
;
//
bool isDeltaBearishStart =
//
// Check State ...
(
//
// Delta is Down ...
conditions.deltaBuffer[cIDX] < conditions.deltaBuffer[pIDX] &&
//
// Delta Signal is Down ...
conditions.deltaSignalBuffer[cIDX] < conditions.deltaSignalBuffer[pIDX] &&
//
// Delta Crossed Under Delta Signal ...
conditions.deltaBuffer[cIDX] < conditions.deltaSignalBuffer[cIDX]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastDeltaBullish.IsValid() &&
//
// Current Close is Under last ...
conditions.bars[cIDX].close < helper.lastDeltaBullish.after &&
//
// Before Close is not Under last ...
conditions.bars[pIDX].close >= helper.lastDeltaBullish.after
//
;
//
// VOLUME ...
//
bool isVolumeBullishStart =
//
(
//
//
// Volume is Up ...
conditions.bullishVolumeBuffer[1] > conditions.bullishVolumeBuffer[2] &&
//
// Volume Signal is Up ...
conditions.bullishVolumeSignalBuffer[1] > conditions.bullishVolumeSignalBuffer[2] &&
//
// Volume Signals Crossed Over ...
conditions.bullishVolumeSignalBuffer[1] > conditions.bearishVolumeSignalBuffer[1]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastVolumeBearish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close > helper.lastVolumeBearish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close <= helper.lastVolumeBearish.after
//
;
//
bool isVolumeBearishStart =
//
(
//
//
// Volume is Up ...
conditions.bearishVolumeBuffer[1] > conditions.bearishVolumeBuffer[2] &&
//
// Volume Signal is Up ...
conditions.bearishVolumeSignalBuffer[1] > conditions.bearishVolumeSignalBuffer[2] &&
//
// Volume Signals Crossed Over ...
conditions.bearishVolumeSignalBuffer[1] > conditions.bullishVolumeSignalBuffer[1]
//
)
//
&&
//
// Check Last InDirectional Exists ...
helper.lastVolumeBullish.IsValid() &&
//
// Current Close is Over last ...
conditions.bars[cIDX].close < helper.lastVolumeBullish.after &&
//
// Before Close is not Over last ...
conditions.bars[pIDX].close >= helper.lastVolumeBullish.after
//
;
//
// SIGNAL Bar ...
//
bool isSBarBullishStart =
//
(
//
// Check Direction ...
conditions.isSBarBullish &&
//
// Previous InDirectional Exists ...
helper.lastSignalBarBearish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.sBarCloseBuffer[cIDX] > helper.lastSignalBarBearish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.sBarCloseBuffer[pIDX] <= helper.lastSignalBarBearish.after
//
)
//
;
//
bool isSBarBearishStart =
//
(
//
// Check Direction ...
conditions.isSBarBearish &&
//
// Previous InDirectional Exists ...
helper.lastSignalBarBullish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.sBarCloseBuffer[cIDX] < helper.lastSignalBarBullish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.sBarCloseBuffer[pIDX] >= helper.lastSignalBarBullish.after
//
)
//
;
//
// HKSIGNAL Bar ...
//
bool isHKSBarBullishStart =
//
(
//
// Check Direction ...
conditions.isHKSBarBullish &&
//
// Previous InDirectional Exists ...
helper.lastHKSignalBarBearish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.hkSBarCloseBuffer[cIDX] > helper.lastHKSignalBarBearish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.hkSBarCloseBuffer[pIDX] <= helper.lastHKSignalBarBearish.after
//
)
//
;
//
bool isHKSBarBearishStart =
//
(
//
// Check Direction ...
conditions.isHKSBarBearish &&
//
// Previous InDirectional Exists ...
helper.lastHKSignalBarBullish.IsValid() &&
//
// Current Signal Bar close over prev ...
conditions.hkSBarCloseBuffer[cIDX] < helper.lastHKSignalBarBullish.after &&
//
// Prev Signal Bar not close over prev ...
conditions.hkSBarCloseBuffer[pIDX] >= helper.lastHKSignalBarBullish.after
//
)
//
;
//
// Check for Vale and Peak ...
//
bool isPeakOverLast =
//
(conditions.peakBuffer[cIDX] > conditions.peakBuffer[pIDX] &&
conditions.peakBuffer[pIDX] <= conditions.peakBuffer[p2IDX] &&
conditions.bars[cIDX].close > conditions.peakBuffer[pIDX])
//
||
//
(conditions.peakBuffer[pIDX] > conditions.peakBuffer[p2IDX] &&
conditions.peakBuffer[p2IDX] <= conditions.peakBuffer[p3IDX] &&
conditions.bars[pIDX].close > conditions.peakBuffer[p2IDX])
//
||
//
(conditions.peakBuffer[p2IDX] > conditions.peakBuffer[p3IDX] &&
conditions.peakBuffer[p3IDX] <= conditions.peakBuffer[p4IDX] &&
conditions.bars[p2IDX].close > conditions.peakBuffer[p3IDX])
//
;
//
bool isValeUnderLast =
//
(conditions.valeBuffer[cIDX] < conditions.valeBuffer[pIDX] &&
conditions.valeBuffer[pIDX] >= conditions.valeBuffer[p2IDX] &&
conditions.bars[cIDX].close < conditions.valeBuffer[pIDX])
//
||
//
(conditions.valeBuffer[pIDX] < conditions.valeBuffer[p2IDX] &&
conditions.valeBuffer[p2IDX] >= conditions.valeBuffer[p3IDX] &&
conditions.bars[pIDX].close < conditions.valeBuffer[p2IDX])
//
||
//
(conditions.valeBuffer[p2IDX] < conditions.valeBuffer[p3IDX] &&
conditions.valeBuffer[p3IDX] >= conditions.valeBuffer[p4IDX] &&
conditions.bars[p2IDX].close < conditions.valeBuffer[p3IDX])
//
;
//
// if (isValeUnderLast)
// {
// Print("SALAM");
// }
//
// Try to Summarize Conditions ...
//
bool isBullishPassed =
//
(isPeakOverLast &&
isDeltaBullishStart &&
isVolumeBullishStart &&
isBarBullishPressured)
//
;
//
bool isBearishPassed =
(isValeUnderLast &&
isDeltaBearishStart &&
isVolumeBearishStart &&
isBarBearishPressured)
//
;
//
// Try to Detect Trigger Block ...
bool hasTB = false;
int tbLoopback = 100;
X121XCatbInputs mInputs = helper.GetInputs();
for (int i = barIndex; i < barIndex + tbLoopback; i++)
{
//
// Update Helper ...
helper.Update(i);
//
// Check TB ...
hasTB = DetectTriggerBlock(
//
conditions.symbol,
conditions.period,
//
tb,
//
drawer,
barAnalyser,
//
// Required Buffers ...
helper.atrBuffer,
helper.rsiBuffer,
helper.adxBuffer,
helper.adxpBuffer,
helper.adxnBuffer,
helper.peakBuffer,
helper.valeBuffer,
helper.deltaBuffer,
helper.sarBuffer,
helper.sarStateBuffer,
helper.trendBuffer,
helper.trendStateBuffer,
helper.atrUpperBuffer,
helper.atrLowerBuffer,
helper.sBarOpenBuffer,
helper.sBarCloseBuffer,
helper.hkSBarOpenBuffer,
helper.hkSBarCloseBuffer,
helper.peakGoldenBuffer,
helper.valeGoldenBuffer,
helper.deltaSignalBuffer,
helper.bullishVolumeSignalBuffer,
helper.bearishVolumeSignalBuffer,
//
i + 1,
//
// Signalling ...
mInputs.signalR2R,
mInputs.slAtrMultiplier,
//
// Configs ...
mInputs.rsiOBLevel,
mInputs.rsiOSLevel,
mInputs.adxThreshold,
//
// Validators ...
mInputs.forceObBarType,
mInputs.forceOBFVGBarType,
mInputs.forceHasSwing,
mInputs.forceHasFLiquidity,
mInputs.forceHasRLiquidity,
mInputs.validateGapSequence,
mInputs.validateBlockEdgeBreakout,
//
// Filters ...
mInputs.filterBasedOnPV,
mInputs.filterBasedOnSar,
mInputs.filterBasedOnRSI,
mInputs.filterBasedOnADX,
mInputs.filterBasedOnATR,
mInputs.filterBasedOnTrend,
mInputs.filterBasedOnDelta,
mInputs.filterBasedOnVolume,
mInputs.filterBasedOnSignalBar,
mInputs.filterBasedOnHKSignalBar //
);
//
// Checking Trigger Block Validation ...
hasTB =
//
hasTB &&
//
(
//
(isBullishPassed &&
tb.IsBullish())
//
||
//
(isBearishPassed &&
tb.IsBearish())
//
);
if (hasTB)
{
//
break;
}
//
tb.Clean();
}
//
// isBullishPassed = false;
// isBearishPassed = false;
//
// Draw Line for Detect Conditions States on Chart ...
if (hasTB && (isBullishPassed ||
isBearishPassed))
{
//
color iColor = isBullishPassed
? clrAqua
: clrMagenta;
//
datetime iTime = conditions.bars[cIDX].time;
//
string iName = "VL_" + ToFormatString(iTime);
//
long chartID = drawer.ChartIdentification();
int subWindow = drawer.SubWindowIdentification();
//
CChartObjectVLine *iObj;
iObj = new CChartObjectVLine();
bool isDrawn = iObj.Create(
chartID,
iName,
subWindow,
iTime //
);
if (isDrawn)
{
//
iObj.Color(iColor);
}
//
CArrayObj *tbObjects = new CArrayObj();
DrawTriggerBlock(
tb,
drawer,
tbObjects,
conditions.bars[0].time //
);
//
tb.Clean();
}
//
// Summarizing result ...
//
result = (isBullishPassed ||
isBearishPassed);
//
// Cleanup Resources ...
//
if (!result)
{
//
tb.Clean();
conditions.Clean();
}
//
return result;
}
//
// has = DetectTriggerBlock(
// eaDrawer,
// eaHelper,
// eaBarAnalyser,
// iConditions,
// iTB,
// barIndex,
// 10 //
// );
+161 -87
View File
@@ -51,7 +51,7 @@ input group "Detector";
// Validating ...
input group "Validations";
input bool eaForceHasSwing = false; // Force Blocks to Have Swing
input bool eaForceObBarType = false; // Force Block Has Reversal Bar
input bool eaForceOBBarType = false; // Force Block Has Reversal Bar
input bool eaForceOBFVGBarType = false; // Force FVG Has Same Bars
input bool eaForceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
input bool eaForceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
@@ -75,8 +75,8 @@ input bool eaFilterBasedOnHKSignalBar = false; // Filter Based on Hiken Ashi Sig
//
// Signal ...
input group "Signal";
input int eaSignalR2R = 3; // Risk Reward Ratio
input double eaSLAtrMultiplier = 0.5; // ATR Multiplier for SL
input int eaSignalR2R = 2; // Risk Reward Ratio
input double eaSLAtrMultiplier = 0; // ATR Multiplier for SL
//
// Volume ...
@@ -97,10 +97,10 @@ input bool eaAllowTrade = true;
input bool eaAllowLongs = true; // Allow Long Trades
input bool eaAllowShorts = true; // Allow Short Trades
input string eaSessions = ""; // Active Sessions
input ENUM_XCAEA_TRADE_RESTRICTION_PERIOD eaRestrictionsPeriod = XCAEA_TRADE_RESTRICATION_NONE; // Trade Restrictions Period
input int eaMaxAllowedTPs = 0; // Max Allowed TP(s) per Day
input int eaMaxAllowedSLs = 0; // Max Allowed SL(s) per Day
input int eaMaxAllowedTrades = 0; // Max Allowed Trades per Day
input ENUM_XCAEA_TRADE_RESTRICTION_PERIOD eaRestrictionsPeriod = XCAEA_TRADE_RESTRICATION_NONE; // Restrictions Period
input int eaMaxAllowedTPs = 0; // Max Allowed TP(s) in Restrictions Period
input int eaMaxAllowedSLs = 0; // Max Allowed SL(s) in Restrictions Period
input int eaMaxAllowedTrades = 0; // Max Allowed Trades in Restrictions Period
input int eaMaxAllowedPositions = 5; // Max Allowed Same Time Trades
input double eaMaxAllowedSpread = 25; // Max Allowed Spread For Trade
input double eaMaxAllowedDrawdownFactor = 0.3; // Max Allowed DrawDown for Trade
@@ -300,94 +300,168 @@ void OnTick()
if (tradeUsingTriggerBlock)
{
//
XTriggerBlock iTB;
X121XCatbConditions iConditions;
has = DetectTriggerBlock(
//
_Symbol,
_Period,
//
iTB,
//
eaDrawer,
eaBarAnalyser,
//
// Required Buffers ...
eaHelper.atrBuffer,
eaHelper.rsiBuffer,
eaHelper.adxBuffer,
eaHelper.adxpBuffer,
eaHelper.adxnBuffer,
eaHelper.peakBuffer,
eaHelper.valeBuffer,
eaHelper.deltaBuffer,
eaHelper.sarBuffer,
eaHelper.sarStateBuffer,
eaHelper.trendBuffer,
eaHelper.trendStateBuffer,
eaHelper.atrUpperBuffer,
eaHelper.atrLowerBuffer,
eaHelper.sBarOpenBuffer,
eaHelper.sBarCloseBuffer,
eaHelper.hkSBarOpenBuffer,
eaHelper.hkSBarCloseBuffer,
eaHelper.peakGoldenBuffer,
eaHelper.valeGoldenBuffer,
eaHelper.deltaSignalBuffer,
eaHelper.bullishVolumeSignalBuffer,
eaHelper.bearishVolumeSignalBuffer,
//
cBarIndex,
//
// Signalling ...
eaInputs.signalR2R,
eaInputs.slAtrMultiplier,
//
// Configs ...
eaInputs.rsiOBLevel,
eaInputs.rsiOSLevel,
eaInputs.adxThreshold,
//
// Validators ...
eaInputs.forceObBarType,
eaInputs.forceOBFVGBarType,
eaInputs.forceHasSwing,
eaInputs.forceHasFLiquidity,
eaInputs.forceHasRLiquidity,
eaInputs.validateGapSequence,
eaInputs.validateBlockEdgeBreakout,
//
// Filters ...
eaInputs.filterBasedOnPV,
eaInputs.filterBasedOnSar,
eaInputs.filterBasedOnRSI,
eaInputs.filterBasedOnADX,
eaInputs.filterBasedOnATR,
eaInputs.filterBasedOnTrend,
eaInputs.filterBasedOnDelta,
eaInputs.filterBasedOnVolume,
eaInputs.filterBasedOnSignalBar,
eaInputs.filterBasedOnHKSignalBar //
);
// XTriggerBlock iTB;
// X121XCatbConditions iConditions;
// has = DetectTriggerBlock(
// //
// _Symbol,
// _Period,
// //
// iTB,
// //
// eaDrawer,
// eaBarAnalyser,
// //
// // Required Buffers ...
// eaHelper.atrBuffer,
// eaHelper.rsiBuffer,
// eaHelper.adxBuffer,
// eaHelper.adxpBuffer,
// eaHelper.adxnBuffer,
// eaHelper.peakBuffer,
// eaHelper.valeBuffer,
// eaHelper.deltaBuffer,
// eaHelper.sarBuffer,
// eaHelper.sarStateBuffer,
// eaHelper.trendBuffer,
// eaHelper.trendStateBuffer,
// eaHelper.atrUpperBuffer,
// eaHelper.atrLowerBuffer,
// eaHelper.sBarOpenBuffer,
// eaHelper.sBarCloseBuffer,
// eaHelper.hkSBarOpenBuffer,
// eaHelper.hkSBarCloseBuffer,
// eaHelper.peakGoldenBuffer,
// eaHelper.valeGoldenBuffer,
// eaHelper.deltaSignalBuffer,
// eaHelper.bullishVolumeSignalBuffer,
// eaHelper.bearishVolumeSignalBuffer,
// //
// cBarIndex,
// //
// // Signalling ...
// eaInputs.signalR2R,
// eaInputs.slAtrMultiplier,
// //
// // Configs ...
// eaInputs.rsiOBLevel,
// eaInputs.rsiOSLevel,
// eaInputs.adxThreshold,
// //
// // Validators ...
// eaInputs.forceObBarType,
// eaInputs.forceOBFVGBarType,
// eaInputs.forceHasSwing,
// eaInputs.forceHasFLiquidity,
// eaInputs.forceHasRLiquidity,
// eaInputs.validateGapSequence,
// eaInputs.validateBlockEdgeBreakout,
// //
// // Filters ...
// eaInputs.filterBasedOnPV,
// eaInputs.filterBasedOnSar,
// eaInputs.filterBasedOnRSI,
// eaInputs.filterBasedOnADX,
// eaInputs.filterBasedOnATR,
// eaInputs.filterBasedOnTrend,
// eaInputs.filterBasedOnDelta,
// eaInputs.filterBasedOnVolume,
// eaInputs.filterBasedOnSignalBar,
// eaInputs.filterBasedOnHKSignalBar //
// );
//
// has = DetectTriggerBlock(
// eaDrawer,
// eaHelper,
// eaBarAnalyser,
// iConditions,
// iTB,
// barIndex,
// 10 //
// );
// Define Requirements ...
XTriggerBlock iTB;
XTriggerBlockFilters iFilters;
X121XCatbConditions iConditions;
XTriggerBlockValidationRules iValidations;
//
// Fill Validations ...
iValidations.forceHasSwing = eaInputs.forceHasSwing;
iValidations.forceOBBarType = eaInputs.forceOBBarType;
iValidations.forceFVGBarType = eaInputs.forceOBFVGBarType;
iValidations.forceHasFLiquidity = eaInputs.forceHasFLiquidity;
iValidations.forceHasRLiquidity = eaInputs.forceHasRLiquidity;
iValidations.validateGapSequence = eaInputs.validateGapSequence;
iValidations.validateBlockEdgeBreakout = eaInputs.validateBlockEdgeBreakout;
//
// Fill Filters ...
iFilters.filterBasedOnPV = eaInputs.filterBasedOnPV;
iFilters.filterBasedOnSar = eaInputs.filterBasedOnSar;
iFilters.filterBasedOnRSI = eaInputs.filterBasedOnRSI;
iFilters.filterBasedOnADX = eaInputs.filterBasedOnADX;
iFilters.filterBasedOnATR = eaInputs.filterBasedOnATR;
iFilters.filterBasedOnTrend = eaInputs.filterBasedOnTrend;
iFilters.filterBasedOnDelta = eaInputs.filterBasedOnDelta;
iFilters.filterBasedOnVolume = eaInputs.filterBasedOnVolume;
iFilters.filterBasedOnSignalBar = eaInputs.filterBasedOnSignalBar;
iFilters.filterBasedOnHKSignalBar = eaInputs.filterBasedOnHKSignalBar;
//
// Trigger Block Detection ...
has = DetectTriggerBlock1(
eaHelper,
eaBarAnalyser,
iTB,
iConditions,
iValidations,
iFilters,
barIndex,
10 // Loopback ...
);
//
if (has)
{
//
// Wait for Next Bar for anything ...
eaBarTraker.Waits();
//
// Prepare Target ...
double targets[];
for (int i = 1; i <= eaInputs.signalR2R; i++)
{
//
Add(
(double)i,
targets //
);
}
//
// Calculate SL Additions ...
double iATR = 0;
if (barIndex > 0 &&
barIndex < ArraySize(eaHelper.atrBuffer))
{
iATR = eaHelper.atrBuffer[barIndex];
}
double slAdditional = eaInputs.slAtrMultiplier * iATR;
//
// Preparing Signal ...
has = ToSignal(
iTB.trigger,
iTB.signal,
targets,
slAdditional //
);
//
// Draw Trigger Block ...
DrawTriggerBlock(
iTB,
eaDrawer,
eaObjects,
NULL //
);
//
// Attach Signal ...
eaSignal = iTB.signal;
//
@@ -436,7 +510,7 @@ void OnTick()
//
XBoxZone signalZone;
X121XCatbConditions conditions;
has = DetectSignalZone1(
has = DetectSignalZone(
eaDrawer,
eaHelper,
eaBarAnalyser,
@@ -739,7 +813,7 @@ void InitRequirements()
//
// Set Validators ...
eaInputs.forceHasSwing = eaForceHasSwing;
eaInputs.forceObBarType = eaForceObBarType;
eaInputs.forceOBBarType = eaForceOBBarType;
eaInputs.forceOBFVGBarType = eaForceOBFVGBarType;
eaInputs.forceHasFLiquidity = eaForceHasFLiquidity;
eaInputs.forceHasRLiquidity = eaForceHasRLiquidity;
+24 -24
View File
@@ -105,7 +105,7 @@ struct X121XCatbInputs
//
// Validating ...
bool forceHasSwing; // Force Blocks to Have Swing
bool forceObBarType; // Force Block Has Reversal Bar
bool forceOBBarType; // Force Block Has Reversal Bar
bool forceOBFVGBarType; // Force FVG Has Same Bars
bool forceHasFLiquidity; // Force Blocks to Have Following Liquidity
bool forceHasRLiquidity; // Force Blocks to Have Reversal Liquidity
@@ -188,7 +188,7 @@ struct X121XCatbInputs
//
// Validating ...
forceHasSwing = false; // Force Blocks to Have Swing
forceObBarType = false; // Force Block Has Reversal Bar
forceOBBarType = false; // Force Block Has Reversal Bar
forceOBFVGBarType = false; // Force FVG Has Same Bars
forceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
forceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
@@ -265,7 +265,7 @@ struct X121XCatbInputs
//
// Validating ...
forceHasSwing = false; // Force Blocks to Have Swing
forceObBarType = false; // Force Block Has Reversal Bar
forceOBBarType = false; // Force Block Has Reversal Bar
forceOBFVGBarType = false; // Force FVG Has Same Bars
forceHasFLiquidity = false; // Force Blocks to Have Following Liquidity
forceHasRLiquidity = false; // Force Blocks to Have Reversal Liquidity
@@ -1588,7 +1588,7 @@ class XCX121XCatbHelper : public XCBaseHelper
mInputs.slAtrMultiplier,
"", // Validating ...
mInputs.forceHasSwing,
mInputs.forceObBarType,
mInputs.forceOBBarType,
mInputs.forceOBFVGBarType,
mInputs.forceHasFLiquidity,
mInputs.forceHasRLiquidity,
@@ -4401,9 +4401,9 @@ class XCX121XCatbHelper : public XCBaseHelper
// Calculate ...
//
double rsiOBLevel = mInputs.rsiOBLevel; // Over Bought Level
double rsiOSLevel = mInputs.rsiOSLevel; // Over Sold Level
double adxThreshold = mInputs.adxThreshold; // Big Movement Threshold
double _rsiOBLevel = mInputs.rsiOBLevel; // Over Bought Level
double _rsiOSLevel = mInputs.rsiOSLevel; // Over Sold Level
double _adxThreshold = mInputs.adxThreshold; // Big Movement Threshold
//
// Reading Values ...
@@ -4646,15 +4646,15 @@ class XCX121XCatbHelper : public XCBaseHelper
//
bool isADXOverThreshold =
cADX > adxThreshold;
cADX > _adxThreshold;
bool isADXUnderThreshold =
cADX < adxThreshold;
cADX < _adxThreshold;
//
bool isPADXOverThreshold =
pADX > adxThreshold;
pADX > _adxThreshold;
bool isPADXUnderThreshold =
pADX < adxThreshold;
pADX < _adxThreshold;
//
bool isDXPBiggerThanDXN =
@@ -4711,25 +4711,25 @@ class XCX121XCatbHelper : public XCBaseHelper
//
bool isRSIOB =
cRSI > rsiOBLevel;
cRSI > _rsiOBLevel;
bool isRSIOS =
cRSI < rsiOSLevel;
cRSI < _rsiOSLevel;
//
bool isRSICrossedOverOB =
cRSI > rsiOBLevel &&
pRSI <= rsiOBLevel;
cRSI > _rsiOBLevel &&
pRSI <= _rsiOBLevel;
bool isRSICrossedOverOS =
cRSI > rsiOSLevel &&
pRSI <= rsiOSLevel;
cRSI > _rsiOSLevel &&
pRSI <= _rsiOSLevel;
//
bool isRSICrossedUnderOB =
cRSI < rsiOBLevel &&
pRSI >= rsiOBLevel;
cRSI < _rsiOBLevel &&
pRSI >= _rsiOBLevel;
bool isRSICrossedUnderOS =
cRSI < rsiOSLevel &&
pRSI >= rsiOSLevel;
cRSI < _rsiOSLevel &&
pRSI >= _rsiOSLevel;
//
// DELTA ...
@@ -4886,11 +4886,11 @@ class XCX121XCatbHelper : public XCBaseHelper
conditions.isDeltaUp = isDeltaUp;
conditions.isATRDown = isATRDown;
conditions.isTrendUp = isTrendUp;
conditions.rsiOBLevel = rsiOBLevel;
conditions.rsiOSLevel = rsiOSLevel;
conditions.rsiOBLevel = _rsiOBLevel;
conditions.rsiOSLevel = _rsiOSLevel;
conditions.isDeltaDown = isDeltaDown;
conditions.isTrendDown = isTrendDown;
conditions.adxThreshold = adxThreshold;
conditions.adxThreshold = _adxThreshold;
conditions.isSarBullish = isSarBullish;
conditions.isSarBearish = isSarBearish;
conditions.isADXBullish = isADXBullish;
File diff suppressed because it is too large Load Diff