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
+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;