last ...
This commit is contained in:
@@ -173,7 +173,7 @@ void OnTick()
|
|||||||
eaConditions.Clean();
|
eaConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
double r2r = 5;
|
double r2r = 2;
|
||||||
string provider = "XCAEA";
|
string provider = "XCAEA";
|
||||||
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
ENUM_POSITION_TYPE type = POSITION_TYPE_BUY;
|
||||||
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
ENUM_X_ORDER_MODES mode = X_ORDER_MODE_MARKET;
|
||||||
|
|||||||
@@ -771,23 +771,23 @@ bool DetectXCAEAConditions(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isX3MaBullishState =
|
bool isX3MaBullishState =
|
||||||
z3MAFast > c3MAFast &&
|
//
|
||||||
isCBarValidForBullish &&
|
z3MAFast > z3MAMedium &&
|
||||||
c3MAFast > c3MAMedium &&
|
c3MAFast > c3MAMedium &&
|
||||||
isCBarBullishRejected &&
|
z3MAMedium > z3MASlow &&
|
||||||
c3MAMedium > c3MASlow &&
|
c3MAMedium > c3MASlow
|
||||||
cBar.low < x3maBullishGapLower &&
|
//
|
||||||
cBar.GetDown() > x3maBullishGapLower;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isX3MaBearishState =
|
bool isX3MaBearishState =
|
||||||
z3MAFast < c3MAFast &&
|
//
|
||||||
isCBarValidForBearish &&
|
z3MAFast < z3MAMedium &&
|
||||||
c3MAFast < c3MAMedium &&
|
c3MAFast < c3MAMedium &&
|
||||||
isCBarBearishRejected &&
|
z3MAMedium < z3MASlow &&
|
||||||
c3MAMedium < c3MASlow &&
|
c3MAMedium < c3MASlow
|
||||||
cBar.high > x3maBearishGapLower &&
|
//
|
||||||
cBar.GetUp() < x3maBearishGapLower;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isX3MaValidForBullishRejection =
|
bool isX3MaValidForBullishRejection =
|
||||||
@@ -819,6 +819,7 @@ bool DetectXCAEAConditions(
|
|||||||
XBoxZone rejectedPivot;
|
XBoxZone rejectedPivot;
|
||||||
XBoxZone insidePivots[];
|
XBoxZone insidePivots[];
|
||||||
int insidePivotsCount = 0;
|
int insidePivotsCount = 0;
|
||||||
|
bool isRejectedOnMid = false;
|
||||||
bool hasInsidePivots = false;
|
bool hasInsidePivots = false;
|
||||||
bool hasPivots = HasChild(pivots);
|
bool hasPivots = HasChild(pivots);
|
||||||
if (hasPivots)
|
if (hasPivots)
|
||||||
@@ -860,11 +861,13 @@ bool DetectXCAEAConditions(
|
|||||||
has = SelectRejectedBox(
|
has = SelectRejectedBox(
|
||||||
allowedPivots,
|
allowedPivots,
|
||||||
rejectedPivot,
|
rejectedPivot,
|
||||||
|
isRejectedOnMid,
|
||||||
pivots,
|
pivots,
|
||||||
zBar,
|
zBar,
|
||||||
cBar,
|
cBar,
|
||||||
pBar,
|
pBar,
|
||||||
p2Bar,
|
p2Bar,
|
||||||
|
true, // Ignore Mid Rejection ...
|
||||||
true,
|
true,
|
||||||
true //
|
true //
|
||||||
);
|
);
|
||||||
@@ -888,8 +891,8 @@ bool DetectXCAEAConditions(
|
|||||||
bool isCond1Bullish =
|
bool isCond1Bullish =
|
||||||
//
|
//
|
||||||
rejectedPivot.IsValid() &&
|
rejectedPivot.IsValid() &&
|
||||||
rejectedPivot.IsBullish() // &&
|
rejectedPivot.IsBullish() &&
|
||||||
// isX3MaValidForBullishRejection
|
isX3MaValidForBullishRejection
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -897,8 +900,8 @@ bool DetectXCAEAConditions(
|
|||||||
bool isCond1Bearish =
|
bool isCond1Bearish =
|
||||||
//
|
//
|
||||||
rejectedPivot.IsValid() &&
|
rejectedPivot.IsValid() &&
|
||||||
rejectedPivot.IsBearish() // &&
|
rejectedPivot.IsBearish() &&
|
||||||
// isX3MaValidForBearishRejection
|
isX3MaValidForBearishRejection
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -907,6 +910,9 @@ bool DetectXCAEAConditions(
|
|||||||
isCond1Bearish;
|
isCond1Bearish;
|
||||||
if (isCond1)
|
if (isCond1)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
pivotBox = rejectedPivot;
|
||||||
|
|
||||||
//
|
//
|
||||||
drawer.DrawBox(
|
drawer.DrawBox(
|
||||||
rejectedPivot,
|
rejectedPivot,
|
||||||
@@ -920,14 +926,22 @@ bool DetectXCAEAConditions(
|
|||||||
//
|
//
|
||||||
bool isCond2Bullish =
|
bool isCond2Bullish =
|
||||||
//
|
//
|
||||||
false
|
false &&
|
||||||
|
isX3MaBearishState &&
|
||||||
|
isCBarBullishRejected // &&
|
||||||
|
// cBar.GetDown() > pVale &&
|
||||||
|
// conditions.isValeUnderLast
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCond2Bearish =
|
bool isCond2Bearish =
|
||||||
//
|
//
|
||||||
false
|
false &&
|
||||||
|
isX3MaBullishState &&
|
||||||
|
isCBarBearishRejected // &&
|
||||||
|
// cBar.GetUp() < pPeak &&
|
||||||
|
// conditions.isPeakOverLast
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -936,6 +950,8 @@ bool DetectXCAEAConditions(
|
|||||||
isCond2Bearish;
|
isCond2Bearish;
|
||||||
if (isCond2)
|
if (isCond2)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
// Print("Cond2");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1000,11 +1016,13 @@ bool DetectXCAEAConditions(
|
|||||||
dir //
|
dir //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double sls[];
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isCond1)
|
if (isCond1)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
double sls[];
|
|
||||||
if (isCond1Bullish)
|
if (isCond1Bullish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -1014,16 +1032,16 @@ bool DetectXCAEAConditions(
|
|||||||
sls //
|
sls //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
// //
|
||||||
// X3MA Medium ...
|
// // X3MA Medium ...
|
||||||
if (c3MAMedium < entry)
|
// if (c3MAMedium < entry)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Add(
|
// Add(
|
||||||
c3MAMedium,
|
// c3MAMedium,
|
||||||
sls //
|
// sls //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1034,16 +1052,16 @@ bool DetectXCAEAConditions(
|
|||||||
sls //
|
sls //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
// //
|
||||||
// X3MA Medium ...
|
// // X3MA Medium ...
|
||||||
if (c3MAMedium > entry)
|
// if (c3MAMedium > entry)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Add(
|
// Add(
|
||||||
c3MAMedium,
|
// c3MAMedium,
|
||||||
sls //
|
// sls //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1051,72 +1069,13 @@ bool DetectXCAEAConditions(
|
|||||||
isCond1Bullish
|
isCond1Bullish
|
||||||
? GetMax(sls)
|
? GetMax(sls)
|
||||||
: GetMin(sls);
|
: GetMin(sls);
|
||||||
|
|
||||||
//
|
//
|
||||||
double supportRisk = MathAbs(entry - cSupport);
|
|
||||||
double supportRiskPoint = supportRisk / points;
|
|
||||||
|
|
||||||
//
|
|
||||||
double resistanceRisk = MathAbs(entry - cSupport);
|
|
||||||
double resistanceRiskPoint = resistanceRisk / points;
|
|
||||||
|
|
||||||
//
|
|
||||||
double rejectedPivotMid = rejectedPivot.lower +
|
|
||||||
((rejectedPivot.upper - rejectedPivot.lower) / 2);
|
|
||||||
double rejectedPivotMidRisk = MathAbs(entry - rejectedPivotMid);
|
|
||||||
double rejectedPivotMidRiskInPoint = rejectedPivotMid / points;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(sls);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Preparing Targets ...
|
|
||||||
if (isBullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (cPeak > entry)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
cPeak,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (cVale < entry)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
cVale,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double risk = MathAbs(providedSL - entry);
|
double risk = MathAbs(providedSL - entry);
|
||||||
double riskPoint = risk / points;
|
double riskPoint = risk / points;
|
||||||
|
|
||||||
//
|
|
||||||
double minAllowedSLRiskPoint = 25.0;
|
|
||||||
double minAllowedSLRisk = minAllowedSLRiskPoint * points;
|
|
||||||
double minAllowedSL =
|
|
||||||
isBullish
|
|
||||||
? entry - minAllowedSLRisk
|
|
||||||
: entry + minAllowedSLRisk;
|
|
||||||
|
|
||||||
//
|
|
||||||
double maxAllowedSLRiskPoint = 40.0;
|
|
||||||
double maxAllowedSLRisk = maxAllowedSLRiskPoint * points;
|
|
||||||
double maxAllowedSL =
|
|
||||||
isBullish
|
|
||||||
? entry + maxAllowedSLRisk
|
|
||||||
: entry - maxAllowedSLRisk;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
double sl =
|
double sl =
|
||||||
providedSL > 0
|
providedSL > 0
|
||||||
@@ -1148,6 +1107,9 @@ bool DetectXCAEAConditions(
|
|||||||
|
|
||||||
//
|
//
|
||||||
box.type = "XCASignal";
|
box.type = "XCASignal";
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(sls);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1292,11 +1254,13 @@ int SelectInsideBoxes(
|
|||||||
bool SelectRejectedBox(
|
bool SelectRejectedBox(
|
||||||
ENUM_XCA_PIVOTS &allowedTypes[],
|
ENUM_XCA_PIVOTS &allowedTypes[],
|
||||||
XBoxZone &box,
|
XBoxZone &box,
|
||||||
|
bool &rejectOnMid,
|
||||||
XBoxZone &boxes[],
|
XBoxZone &boxes[],
|
||||||
XOHCL &zBar,
|
XOHCL &zBar,
|
||||||
XOHCL &cBar,
|
XOHCL &cBar,
|
||||||
XOHCL &pBar,
|
XOHCL &pBar,
|
||||||
XOHCL &p2Bar,
|
XOHCL &p2Bar,
|
||||||
|
bool ignoreMidRejection = true,
|
||||||
bool forceBarType = false,
|
bool forceBarType = false,
|
||||||
bool forcePressure = false //
|
bool forcePressure = false //
|
||||||
)
|
)
|
||||||
@@ -1306,6 +1270,7 @@ bool SelectRejectedBox(
|
|||||||
|
|
||||||
//
|
//
|
||||||
box.Clean();
|
box.Clean();
|
||||||
|
rejectOnMid = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate ...
|
// Validate ...
|
||||||
@@ -1385,6 +1350,14 @@ bool SelectRejectedBox(
|
|||||||
forcePressure //
|
forcePressure //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (ignoreMidRejection)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isMidBullishRejected = false;
|
||||||
|
isMidBearishRejected = false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullishRejected =
|
bool isBullishRejected =
|
||||||
isBullish &&
|
isBullish &&
|
||||||
@@ -1405,6 +1378,9 @@ bool SelectRejectedBox(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
box = iBox;
|
box = iBox;
|
||||||
|
rejectOnMid = isBullishRejected
|
||||||
|
? isMidBullishRejected
|
||||||
|
: isMidBearishRejected;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
bool useGuards;
|
bool useGuards;
|
||||||
|
bool useTargets;
|
||||||
int poiLoopback;
|
int poiLoopback;
|
||||||
XCAEAInputs inputs;
|
XCAEAInputs inputs;
|
||||||
XBarTracker barTraker;
|
XBarTracker barTraker;
|
||||||
@@ -407,6 +408,9 @@ class XCXCAEASignaller : XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Targets Preparing ...
|
// Targets Preparing ...
|
||||||
|
if (useTargets)
|
||||||
|
{
|
||||||
|
//
|
||||||
Copy(
|
Copy(
|
||||||
targets,
|
targets,
|
||||||
mConditions.targets //
|
mConditions.targets //
|
||||||
@@ -545,6 +549,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resource ...
|
// Cleanup Resource ...
|
||||||
@@ -766,6 +771,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
useGuards = false;
|
useGuards = false;
|
||||||
|
useTargets = false;
|
||||||
rfOnInvalidPivots = false;
|
rfOnInvalidPivots = false;
|
||||||
continuesRFTillTarget = false;
|
continuesRFTillTarget = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user