last ...
This commit is contained in:
@@ -425,6 +425,7 @@ bool DetectXCAEAConditions(
|
||||
XCAEAConditions &conditions,
|
||||
XBoxZone &pivotBox,
|
||||
XBoxZone &box,
|
||||
double &additionalSL,
|
||||
ENUM_X_DIRECTION &dir,
|
||||
XCXCAEAHelper *helper,
|
||||
int barIndex = 0,
|
||||
@@ -441,6 +442,7 @@ bool DetectXCAEAConditions(
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
additionalSL = 0;
|
||||
conditions.Clean();
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
@@ -454,17 +456,28 @@ bool DetectXCAEAConditions(
|
||||
//
|
||||
string symbol = helper.GetSymbol();
|
||||
ENUM_TIMEFRAMES period = helper.GetPeriod();
|
||||
double points = GetPoints(symbol);
|
||||
|
||||
//
|
||||
XCAEAConditions pConditions;
|
||||
result = helper.GetConditions(
|
||||
conditions,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
result = result &&
|
||||
helper.GetConditions(
|
||||
pConditions,
|
||||
barIndex + 1,
|
||||
loopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
//
|
||||
conditions.Clean();
|
||||
pConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -622,6 +635,7 @@ bool DetectXCAEAConditions(
|
||||
//
|
||||
box.Clean();
|
||||
conditions.Clean();
|
||||
pConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
@@ -713,30 +727,6 @@ bool DetectXCAEAConditions(
|
||||
isCBarBearishMomentum ||
|
||||
isCBarBearishEngulfed);
|
||||
|
||||
//
|
||||
double pBarLowShadow = pBar.GetLowShadow();
|
||||
double pBarHighShadow = pBar.GetHighShadow();
|
||||
|
||||
//
|
||||
bool isPBarSwingLow =
|
||||
pBarLowShadow > 0 &&
|
||||
pBar.low < p2Bar.low &&
|
||||
pBar.low < cBar.low &&
|
||||
p2Bar.GetUp() >= pBar.low &&
|
||||
p2Bar.GetDown() <= pBar.high &&
|
||||
cBar.GetUp() >= pBar.low &&
|
||||
cBar.GetDown() <= pBar.high;
|
||||
|
||||
//
|
||||
bool isPBarSwingHigh =
|
||||
pBarHighShadow > 0 &&
|
||||
pBar.high > p2Bar.high &&
|
||||
pBar.high > cBar.high &&
|
||||
p2Bar.GetUp() >= pBar.low &&
|
||||
p2Bar.GetDown() <= pBar.high &&
|
||||
cBar.GetUp() >= pBar.low &&
|
||||
cBar.GetDown() <= pBar.high;
|
||||
|
||||
//
|
||||
// Score ...
|
||||
|
||||
@@ -761,11 +751,38 @@ bool DetectXCAEAConditions(
|
||||
conditions
|
||||
.GenerateSummary();
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
|
||||
//
|
||||
bool isRSIBullish =
|
||||
zRSI >= cRSI &&
|
||||
cRSI > pRSI;
|
||||
bool isRSIBearish =
|
||||
zRSI <= cRSI &&
|
||||
cRSI < pRSI;
|
||||
|
||||
//
|
||||
bool isCCIBullish =
|
||||
zCCI >= cCCI &&
|
||||
cCCI > pCCI &&
|
||||
(zCCI > conditions.cciOSLevel ||
|
||||
cCCI > conditions.cciOSLevel);
|
||||
bool isCCIBearish =
|
||||
zCCI >= cCCI &&
|
||||
cCCI > pCCI &&
|
||||
(zCCI < conditions.cciOBLevel ||
|
||||
cCCI < conditions.cciOBLevel);
|
||||
|
||||
//
|
||||
// Detect Selected Box ...
|
||||
double providedSL = 0;
|
||||
bool isBoxFVG = false;
|
||||
bool hasPivotBox = false;
|
||||
bool isBoxPeakVale = false;
|
||||
bool isBoxRejected = false;
|
||||
bool isBoxActivated = false;
|
||||
bool isBoxFullSifeRejected = false;
|
||||
bool hasBoxes = HasChild(boxes);
|
||||
if (hasBoxes)
|
||||
{
|
||||
@@ -797,10 +814,27 @@ bool DetectXCAEAConditions(
|
||||
|
||||
//
|
||||
// Check Selected Box not RSI or CCI ...
|
||||
has = iBox.type == ToString(XCA_PEAKSWHRES) ||
|
||||
iBox.type == ToString(XCA_VALESWLSUP);
|
||||
isBoxFVG = Contains(
|
||||
"XCA_FVG",
|
||||
iBox.type //
|
||||
);
|
||||
isBoxPeakVale =
|
||||
Contains(
|
||||
"XCA_PEAKSWHRES",
|
||||
iBox.type //
|
||||
) ||
|
||||
Contains(
|
||||
"XCA_VALESWLSUP",
|
||||
iBox.type //
|
||||
);
|
||||
has = isBoxFVG ||
|
||||
isBoxPeakVale;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
|
||||
//
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -813,6 +847,10 @@ bool DetectXCAEAConditions(
|
||||
isBullish
|
||||
? iBox.upper
|
||||
: iBox.lower;
|
||||
double rejectedFullCheckPrice =
|
||||
isBullish
|
||||
? iBox.lower
|
||||
: iBox.upper;
|
||||
|
||||
//
|
||||
// Check Box Selecting Senarios ...
|
||||
@@ -826,13 +864,21 @@ bool DetectXCAEAConditions(
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
// Selecting Rejected Boxes ...
|
||||
isBoxFullSifeRejected = cBar.IsRejected(
|
||||
rejectedFullCheckPrice,
|
||||
iBox.dir,
|
||||
false,
|
||||
false //
|
||||
);
|
||||
|
||||
//
|
||||
// Selecting Activation Boxes ...
|
||||
|
||||
//
|
||||
bool isBullishActivated =
|
||||
isBullish &&
|
||||
isPBarSwingLow &&
|
||||
cBar.IsBullish() &&
|
||||
cBar.GetUp() > rejectedCheckPrice &&
|
||||
cBar.GetDown() < rejectedCheckPrice;
|
||||
@@ -840,7 +886,6 @@ bool DetectXCAEAConditions(
|
||||
//
|
||||
bool isBearishActivated =
|
||||
isBearish &&
|
||||
isPBarSwingHigh &&
|
||||
cBar.IsBearish() &&
|
||||
cBar.GetUp() > rejectedCheckPrice &&
|
||||
cBar.GetDown() < rejectedCheckPrice;
|
||||
@@ -853,7 +898,8 @@ bool DetectXCAEAConditions(
|
||||
// Detect Box is Selected or not ...
|
||||
has =
|
||||
isBoxRejected ||
|
||||
isBoxActivated;
|
||||
isBoxActivated ||
|
||||
isBoxFullSifeRejected;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
@@ -874,79 +920,87 @@ bool DetectXCAEAConditions(
|
||||
|
||||
//
|
||||
// Force Conditions to Have Selected Box ...
|
||||
result = hasBoxes &&
|
||||
pivotBox.IsValid();
|
||||
if (!result)
|
||||
hasPivotBox = hasBoxes &&
|
||||
pivotBox.IsValid();
|
||||
if (hasPivotBox)
|
||||
{
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
pBar.Clean();
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
p4Bar.Clean();
|
||||
pivotBox.to = TimeCurrent();
|
||||
|
||||
//
|
||||
box.Clean();
|
||||
pivotBox.Clean();
|
||||
conditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
// Draw Pivot Box Here ...
|
||||
if (isBoxPeakVale)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
pivotBox,
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
iObj.BoxWidth(5);
|
||||
iObj.BoxColor(clrDodgerBlue);
|
||||
Print("Draw Pivot Box ...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Conditions ...
|
||||
// If all Conditions required Boxes ...
|
||||
// if (!result)
|
||||
// {
|
||||
// //
|
||||
// zBar.Clean();
|
||||
// cBar.Clean();
|
||||
// pBar.Clean();
|
||||
// p2Bar.Clean();
|
||||
// p3Bar.Clean();
|
||||
// p4Bar.Clean();
|
||||
|
||||
//
|
||||
bool isRSIBullish =
|
||||
zRSI >= cRSI &&
|
||||
cRSI > pRSI;
|
||||
bool isRSIBearish =
|
||||
zRSI <= cRSI &&
|
||||
cRSI < pRSI;
|
||||
// //
|
||||
// box.Clean();
|
||||
// pivotBox.Clean();
|
||||
// conditions.Clean();
|
||||
|
||||
//
|
||||
bool isCCIBullish =
|
||||
zCCI >= cCCI &&
|
||||
cCCI > pCCI &&
|
||||
(zCCI > conditions.cciOSLevel ||
|
||||
cCCI > conditions.cciOSLevel);
|
||||
bool isCCIBearish =
|
||||
zCCI >= cCCI &&
|
||||
cCCI > pCCI &&
|
||||
(zCCI < conditions.cciOBLevel ||
|
||||
cCCI < conditions.cciOBLevel);
|
||||
|
||||
//
|
||||
bool isRVIBullish = false;
|
||||
bool isRVIBearish = false;
|
||||
// //
|
||||
// return result;
|
||||
// }
|
||||
|
||||
//
|
||||
// Signaller Summarization ...
|
||||
|
||||
//
|
||||
// Cond1 Act Using Box Activation ...
|
||||
// Cond1 Act Using PEAK VALE Box Activation or Rejection ...
|
||||
|
||||
//
|
||||
bool isCond1Bullish =
|
||||
//
|
||||
false &&
|
||||
isCCIBullish &&
|
||||
isBoxActivated &&
|
||||
pivotBox.IsValid() &&
|
||||
pivotBox.IsBullish()
|
||||
hasPivotBox &&
|
||||
isBoxPeakVale &&
|
||||
isScoreBullish &&
|
||||
pivotBox.IsBullish() &&
|
||||
(conditions.isValeUnderLast ||
|
||||
(conditions.isValeSameLast &&
|
||||
pConditions.isValeUnderLast)) &&
|
||||
conditions.isRSICrossedOverOS &&
|
||||
conditions.isCCICrossedOverOS
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCond1Bearish =
|
||||
//
|
||||
false &&
|
||||
isCCIBearish &&
|
||||
isBoxActivated &&
|
||||
pivotBox.IsValid() &&
|
||||
pivotBox.IsBearish()
|
||||
hasPivotBox &&
|
||||
isBoxPeakVale &&
|
||||
isScoreBearish &&
|
||||
pivotBox.IsBearish() &&
|
||||
(conditions.isPeakOverLast ||
|
||||
(conditions.isPeakSameLast &&
|
||||
pConditions.isPeakOverLast)) &&
|
||||
conditions.isRSICrossedUnderOB &&
|
||||
conditions.isCCICrossedUnderOB
|
||||
//
|
||||
;
|
||||
|
||||
@@ -961,6 +1015,9 @@ bool DetectXCAEAConditions(
|
||||
? MathMin(pBar.low, pivotBox.lower)
|
||||
: MathMax(pBar.high, pivotBox.upper);
|
||||
|
||||
//
|
||||
additionalSL = 0.5 * conditions.atrBuffer[cIDX];
|
||||
|
||||
//
|
||||
Print("Cond1");
|
||||
}
|
||||
@@ -971,20 +1028,14 @@ bool DetectXCAEAConditions(
|
||||
//
|
||||
bool isCond2Bullish =
|
||||
//
|
||||
false &&
|
||||
isBoxRejected &&
|
||||
pivotBox.IsValid() &&
|
||||
pivotBox.IsBullish()
|
||||
false
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isCond2Bearish =
|
||||
//
|
||||
false &&
|
||||
isBoxRejected &&
|
||||
pivotBox.IsValid() &&
|
||||
pivotBox.IsBearish()
|
||||
false
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1030,7 +1081,8 @@ bool DetectXCAEAConditions(
|
||||
bool isBullish =
|
||||
//
|
||||
isCond1Bullish ||
|
||||
isCond2Bullish;
|
||||
isCond2Bullish ||
|
||||
isCond3Bullish;
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1038,7 +1090,8 @@ bool DetectXCAEAConditions(
|
||||
bool isBearish =
|
||||
//
|
||||
isCond1Bearish ||
|
||||
isCond2Bearish
|
||||
isCond2Bearish ||
|
||||
isCond3Bearish
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1115,6 +1168,7 @@ bool DetectXCAEAConditions(
|
||||
p2Bar.Clean();
|
||||
p3Bar.Clean();
|
||||
p4Bar.Clean();
|
||||
pConditions.Clean();
|
||||
|
||||
//
|
||||
return result;
|
||||
|
||||
@@ -170,6 +170,7 @@ class XCXCAEASignaller : XCBase
|
||||
XBoxZone boxes[];
|
||||
XBoxZone pivotBox;
|
||||
XBoxZone signalBox;
|
||||
double additionalSL = 0;
|
||||
XBoxZone bullishBoxes[];
|
||||
XBoxZone bearishBoxes[];
|
||||
bool hasSignalBox = false;
|
||||
@@ -275,6 +276,7 @@ class XCXCAEASignaller : XCBase
|
||||
conditions,
|
||||
pivotBox,
|
||||
signalBox,
|
||||
additionalSL,
|
||||
signalBoxDir,
|
||||
helper,
|
||||
zIndex,
|
||||
@@ -346,6 +348,14 @@ class XCXCAEASignaller : XCBase
|
||||
isBullish
|
||||
? signalBox.lower
|
||||
: signalBox.upper;
|
||||
if (additionalSL > 0)
|
||||
{
|
||||
//
|
||||
sl =
|
||||
isBullish
|
||||
? sl - additionalSL
|
||||
: sl + additionalSL;
|
||||
}
|
||||
|
||||
//
|
||||
double risk =
|
||||
@@ -421,7 +431,7 @@ class XCXCAEASignaller : XCBase
|
||||
else
|
||||
{
|
||||
//
|
||||
double rfReward = 2;
|
||||
double rfReward = 1;
|
||||
|
||||
//
|
||||
double rewardRF = risk * rfReward;
|
||||
@@ -660,7 +670,7 @@ class XCXCAEASignaller : XCBase
|
||||
{
|
||||
//
|
||||
useGuards = false;
|
||||
continuesRFTillTarget = false;
|
||||
continuesRFTillTarget = true;
|
||||
|
||||
//
|
||||
barTraker.Init(
|
||||
@@ -708,10 +718,10 @@ class XCXCAEASignaller : XCBase
|
||||
|
||||
//
|
||||
// XOSCS ...
|
||||
// inputs.oscsInputs.rsiLength = 5;
|
||||
inputs.oscsInputs.rsiLength = 5;
|
||||
inputs.oscsInputs.cciLength = 5;
|
||||
// inputs.oscsInputs.mfiLength = 5;
|
||||
// inputs.oscsInputs.rviLength = 5;
|
||||
// inputs.oscsInputs.cciLength = 5;
|
||||
|
||||
//
|
||||
// Oscillators Views ...
|
||||
@@ -719,6 +729,7 @@ class XCXCAEASignaller : XCBase
|
||||
inputs.showRSI = false;
|
||||
inputs.showMFI = false;
|
||||
inputs.showRVI = false;
|
||||
inputs.showADX = false;
|
||||
inputs.showMACD = false;
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user