last ...
This commit is contained in:
@@ -198,6 +198,112 @@ struct XCAEATriggerBlockConfiguration
|
||||
filterBasedOnTrend = true;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarRsiAdxFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnTrend = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarRsiTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnADX = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarAdxTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnRSI = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureRsiAdxTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnSar = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarRsiFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnADX = false;
|
||||
filterBasedOnTrend = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarAdxFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnRSI = false;
|
||||
filterBasedOnTrend = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureSarTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnRSI = false;
|
||||
filterBasedOnADX = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureRsiAdxFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnSar = false;
|
||||
filterBasedOnTrend = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureRsiTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnSar = false;
|
||||
filterBasedOnADX = false;
|
||||
}
|
||||
|
||||
//
|
||||
void ConfigureAdxTrendFilter()
|
||||
{
|
||||
//
|
||||
ConfigureFullFilter();
|
||||
|
||||
//
|
||||
filterBasedOnSar = false;
|
||||
filterBasedOnRSI = false;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
@@ -359,12 +465,12 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
bool isBullish =
|
||||
has &&
|
||||
result &&
|
||||
triggerBlock.IsBullish();
|
||||
|
||||
//
|
||||
bool isBearish =
|
||||
has &&
|
||||
result &&
|
||||
triggerBlock.IsBearish();
|
||||
|
||||
//
|
||||
@@ -382,7 +488,7 @@ bool DetectTriggerBlock(
|
||||
iDir = Opposit(triggerBlock.dir);
|
||||
|
||||
//
|
||||
has =
|
||||
result =
|
||||
iDir == p3Bar.GetDirection() ||
|
||||
iDir == p4Bar.GetDirection();
|
||||
if (!result)
|
||||
@@ -693,7 +799,7 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
// Here we Ensure which have a Valid Zone using Different Applied Validations ...
|
||||
// from now we are Going to Filtered Validate Zones ...
|
||||
// from now we are Going to Filterd Validate Zones ...
|
||||
|
||||
//
|
||||
// Check Exists Filters or not ...
|
||||
@@ -778,21 +884,21 @@ bool DetectTriggerBlock(
|
||||
// Summarize Filtering ...
|
||||
|
||||
//
|
||||
bool isBullishFiltered =
|
||||
bool isBullishFilterd =
|
||||
isBullish &&
|
||||
(isCSarSwitchedToBullish ||
|
||||
isPSarSwitchedToBullish);
|
||||
|
||||
//
|
||||
bool isBearishFiltered =
|
||||
bool isBearishFilterd =
|
||||
isBearish &&
|
||||
(isCSarSwitchedToBearish ||
|
||||
isPSarSwitchedToBearish);
|
||||
|
||||
//
|
||||
result =
|
||||
isBullishFiltered ||
|
||||
isBearishFiltered;
|
||||
isBullishFilterd ||
|
||||
isBearishFilterd;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -963,7 +1069,7 @@ bool DetectTriggerBlock(
|
||||
// Summarize Filtering ...
|
||||
|
||||
//
|
||||
bool isBullishFiltered =
|
||||
bool isBullishFilterd =
|
||||
isBullish &&
|
||||
(
|
||||
//
|
||||
@@ -991,7 +1097,7 @@ bool DetectTriggerBlock(
|
||||
);
|
||||
|
||||
//
|
||||
bool isBearishFiltered =
|
||||
bool isBearishFilterd =
|
||||
isBearish &&
|
||||
(
|
||||
//
|
||||
@@ -1020,8 +1126,8 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
result =
|
||||
isBullishFiltered ||
|
||||
isBearishFiltered;
|
||||
isBullishFilterd ||
|
||||
isBearishFilterd;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -1201,7 +1307,7 @@ bool DetectTriggerBlock(
|
||||
// Summarize Filtering ...
|
||||
|
||||
//
|
||||
bool isBullishFiltered =
|
||||
bool isBullishFilterd =
|
||||
isBullish &&
|
||||
(
|
||||
//
|
||||
@@ -1223,7 +1329,7 @@ bool DetectTriggerBlock(
|
||||
);
|
||||
|
||||
//
|
||||
bool isBearishFiltered =
|
||||
bool isBearishFilterd =
|
||||
isBearish &&
|
||||
(
|
||||
//
|
||||
@@ -1246,8 +1352,8 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
result =
|
||||
isBullishFiltered ||
|
||||
isBearishFiltered;
|
||||
isBullishFilterd ||
|
||||
isBearishFilterd;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -1384,7 +1490,7 @@ bool DetectTriggerBlock(
|
||||
// Summarize Filtering ...
|
||||
|
||||
//
|
||||
bool isBullishFiltered =
|
||||
bool isBullishFilterd =
|
||||
isBullish &&
|
||||
(
|
||||
//
|
||||
@@ -1406,7 +1512,7 @@ bool DetectTriggerBlock(
|
||||
);
|
||||
|
||||
//
|
||||
bool isBearishFiltered =
|
||||
bool isBearishFilterd =
|
||||
isBearish &&
|
||||
(
|
||||
//
|
||||
@@ -1429,8 +1535,8 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
result =
|
||||
isBullishFiltered ||
|
||||
isBearishFiltered;
|
||||
isBullishFilterd ||
|
||||
isBearishFilterd;
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
@@ -1457,6 +1563,14 @@ bool DetectTriggerBlock(
|
||||
|
||||
//
|
||||
result = triggerBlock.IsValid();
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
triggerBlock.type =
|
||||
isBullish
|
||||
? ToString(XCA_TRIGGER_BULL)
|
||||
: ToString(XCA_TRIGGER_BEAR);
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
@@ -196,6 +196,7 @@ class XCXCAEASignaller : XCBase
|
||||
int zIndex = 0;
|
||||
bool has = false;
|
||||
int loopback = 10;
|
||||
int cIndex = zIndex + 1;
|
||||
bool isBullish = false;
|
||||
bool isBearish = false;
|
||||
|
||||
@@ -277,7 +278,297 @@ class XCXCAEASignaller : XCBase
|
||||
// In this Used Case we found a Tigger Block and use it
|
||||
// for Triggering ...
|
||||
if (!hasDecisionZone &&
|
||||
allowTriggerBlockDecisionZoneSignalling) {
|
||||
allowTriggerBlockDecisionZoneSignalling)
|
||||
{
|
||||
//
|
||||
int pushers = 0;
|
||||
|
||||
//
|
||||
// We Can Detect Multiple Decision Zones ...
|
||||
XBoxZone tmpZone;
|
||||
XCAEATriggerBlockConfiguration config;
|
||||
|
||||
//
|
||||
// Full Filteres ...
|
||||
config.ConfigureFullFilter();
|
||||
bool hasFullFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasFullFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarRsiAdxFilter();
|
||||
bool hasSarRsiAdxFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarRsiAdxFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarRsiTrendFilter();
|
||||
bool hasSarRsiTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarRsiTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarAdxTrendFilter();
|
||||
bool hasSarAdxTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarAdxTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureRsiAdxTrendFilter();
|
||||
bool hasRsiAdxTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasRsiAdxTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarRsiFilter();
|
||||
bool hasSarRsiFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarRsiFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarAdxFilter();
|
||||
bool hasSarAdxFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarAdxFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureSarTrendFilter();
|
||||
bool hasSarTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasSarTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureRsiAdxFilter();
|
||||
bool hasRsiAdxFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasRsiAdxFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureRsiTrendFilter();
|
||||
bool hasRsiTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasRsiTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
tmpZone.Clean();
|
||||
config.ConfigureAdxTrendFilter();
|
||||
bool hasAdxTrendFiltered = DetectTriggerBlock(
|
||||
tmpZone,
|
||||
conditions,
|
||||
helper,
|
||||
config,
|
||||
zIndex,
|
||||
loopback //
|
||||
);
|
||||
if (hasAdxTrendFiltered)
|
||||
{
|
||||
//
|
||||
pushers++;
|
||||
|
||||
//
|
||||
if (!decisionZone.IsValid())
|
||||
{
|
||||
decisionZone = tmpZone;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
hasDecisionZone =
|
||||
hasSarRsiFiltered ||
|
||||
hasSarAdxFiltered ||
|
||||
hasRsiAdxFiltered ||
|
||||
hasSarTrendFiltered ||
|
||||
hasRsiTrendFiltered ||
|
||||
hasAdxTrendFiltered ||
|
||||
hasSarRsiAdxFiltered ||
|
||||
hasSarRsiTrendFiltered ||
|
||||
hasSarAdxTrendFiltered ||
|
||||
hasRsiAdxTrendFiltered;
|
||||
|
||||
//
|
||||
if (hasDecisionZone)
|
||||
{
|
||||
//
|
||||
drawer.DrawBox(
|
||||
decisionZone,
|
||||
cTime,
|
||||
false, // Draw Middle ...
|
||||
true // Ignore Type ...
|
||||
);
|
||||
|
||||
//
|
||||
Print(ToString(decisionZone.dir) + " Trigger Block Detected (" + ToString(pushers) + ") ...");
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
@@ -285,6 +576,9 @@ class XCXCAEASignaller : XCBase
|
||||
// Make Signal Box UnAvailable ...
|
||||
if (hasDecisionZone)
|
||||
{
|
||||
//
|
||||
decisionZoneDir = decisionZone.dir;
|
||||
|
||||
//
|
||||
AddRef(
|
||||
decisionZone,
|
||||
@@ -427,6 +721,22 @@ class XCXCAEASignaller : XCBase
|
||||
int toIDX = conditions.decisionZone.ToIndex();
|
||||
int fromIDX = conditions.decisionZone.FromIndex();
|
||||
|
||||
//
|
||||
bool isAnalyseSignalled =
|
||||
conditions.decisionZone.period == analyseHelper.GetPeriod();
|
||||
|
||||
//
|
||||
ENUM_XCAEA_TIGGER_TYPE decisionZoneType = GetType(conditions.decisionZone.type);
|
||||
bool isTriggerBlockSignalled = IsValid(decisionZoneType);
|
||||
|
||||
//
|
||||
// Looking for Analyse Helper Triggers ...
|
||||
if (isAnalyseSignalled &&
|
||||
allowAnalyseDecisionZoneSignalling)
|
||||
{
|
||||
//
|
||||
// Trigger Analyse Signal ...
|
||||
|
||||
//
|
||||
// Check Box Size ...
|
||||
double maxAllowedBoxRange = 400;
|
||||
@@ -434,19 +744,6 @@ class XCXCAEASignaller : XCBase
|
||||
bool isTooLarge = range > (maxAllowedBoxRange * points);
|
||||
double decisionMiddlePrice = conditions.decisionZone.GetMid();
|
||||
|
||||
//
|
||||
// Draw Decision Zone ...
|
||||
if (allowDraws)
|
||||
{
|
||||
//
|
||||
drawer.DrawBox(
|
||||
conditions.decisionZone,
|
||||
cTime,
|
||||
true, // Draw Middle Line ...
|
||||
true // Ignore Type ...
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Detect Required Pivots ...
|
||||
XBoxZone decisionPivots[];
|
||||
@@ -573,6 +870,36 @@ class XCXCAEASignaller : XCBase
|
||||
canTriggerCond1 ||
|
||||
canTriggerCond2 ||
|
||||
canTriggerCond3;
|
||||
}
|
||||
else if (isTriggerBlockSignalled &&
|
||||
allowTriggerBlockDecisionZoneSignalling)
|
||||
{
|
||||
//
|
||||
// Trigger TRIGGER Block Signal ...
|
||||
|
||||
//
|
||||
// since we have to Trigger all TRIGGER Block's Signals
|
||||
// exactly on Setting ups ...
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
triggerDir =
|
||||
isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
sl =
|
||||
isBullish
|
||||
? conditions.decisionZone.lower
|
||||
: conditions.decisionZone.upper;
|
||||
|
||||
//
|
||||
conditions.reward = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
isBullish = result &&
|
||||
@@ -584,6 +911,19 @@ class XCXCAEASignaller : XCBase
|
||||
// Configure Conditions for Preparing Signal ...
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
// Draw Decision Zone ...
|
||||
if (allowDraws)
|
||||
{
|
||||
//
|
||||
drawer.DrawBox(
|
||||
conditions.decisionZone,
|
||||
cTime,
|
||||
true, // Draw Middle Line ...
|
||||
true // Ignore Type ...
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Reconfigure Position TP/SL Entry and etc ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user