last ...
This commit is contained in:
@@ -1365,6 +1365,172 @@ class XCXCAEAPOIDetector : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int FillPivots(
|
||||||
|
XBoxZone &pivots[],
|
||||||
|
XBoxZone &unavailables[],
|
||||||
|
ENUM_XCA_PIVOTS &allowedTypes[],
|
||||||
|
datetime to = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(pivots);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canUpdateTo = IsValid(to);
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmp[];
|
||||||
|
bool has = false;
|
||||||
|
int tmpCount = FillPivots(
|
||||||
|
tmp,
|
||||||
|
X_DIRECTION_ALL //
|
||||||
|
);
|
||||||
|
has = IsValidSize(tmpCount);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox;
|
||||||
|
while (HasChild(tmp))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox = tmp[0];
|
||||||
|
ArrayRemove(
|
||||||
|
tmp,
|
||||||
|
0,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (canUpdateTo)
|
||||||
|
{
|
||||||
|
iBox.to = to;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_XCA_PIVOTS iType = GetPivotType(iBox);
|
||||||
|
bool isAllowed =
|
||||||
|
!HasChild(allowedTypes)
|
||||||
|
? true
|
||||||
|
: Contains(
|
||||||
|
iType,
|
||||||
|
allowedTypes //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
bool isUnAvailable = FindBoxIndex(
|
||||||
|
idx,
|
||||||
|
iBox,
|
||||||
|
unavailables //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isAllowed &&
|
||||||
|
!isUnAvailable)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
pivots //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(pivots);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int FillPivots(
|
||||||
|
XBoxZone &decision,
|
||||||
|
XBoxZone &pivots[],
|
||||||
|
XBoxZone &unavailables[],
|
||||||
|
ENUM_XCA_PIVOTS &allowedTypes[],
|
||||||
|
datetime to = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool has = false;
|
||||||
|
has = decision.IsValid();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmp[];
|
||||||
|
int count = FillPivots(
|
||||||
|
tmp,
|
||||||
|
pivots,
|
||||||
|
unavailables,
|
||||||
|
allowedTypes,
|
||||||
|
to //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmp[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Box ...
|
||||||
|
has =
|
||||||
|
//
|
||||||
|
// Validate Time ..
|
||||||
|
iBox.from > box.from
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
// Validate Price ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(iBox.upper < box.upper &&
|
||||||
|
iBox.upper > box.lower)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
(iBox.lower > box.lower &&
|
||||||
|
iBox.lower < box.upper)
|
||||||
|
//
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iBox,
|
||||||
|
pivots //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmp);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pivots ...
|
// Pivots ...
|
||||||
|
|
||||||
|
|||||||
@@ -1253,6 +1253,7 @@ bool CanTriggerCond0(
|
|||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
double &sl,
|
double &sl,
|
||||||
double &tp,
|
double &tp,
|
||||||
|
CArrayObj *drawns,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int loopback = 5,
|
int loopback = 5,
|
||||||
double scorePassMultiplier = 1 //
|
double scorePassMultiplier = 1 //
|
||||||
@@ -1519,6 +1520,7 @@ bool CanTriggerCond1(
|
|||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
double &sl,
|
double &sl,
|
||||||
double &tp,
|
double &tp,
|
||||||
|
CArrayObj *drawns,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int loopback = 10 //
|
int loopback = 10 //
|
||||||
)
|
)
|
||||||
@@ -1625,13 +1627,15 @@ bool CanTriggerCond1(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Detect Trigger Based On Decision Zone's
|
// Detect Trigger Based On Decision Zone's
|
||||||
// Box Starts With FVG ...
|
// Using OB inside Boxes ...
|
||||||
bool CanTriggerCond2(
|
bool CanTriggerCond2(
|
||||||
XCXCAEAHelper *helper,
|
XCXCAEAHelper *helper,
|
||||||
XBoxZone &box,
|
XBoxZone &decisionZone,
|
||||||
|
XBoxZone &decisionPivots[],
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
double &sl,
|
double &sl,
|
||||||
double &tp,
|
double &tp,
|
||||||
|
CArrayObj *drawns,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int loopback = 10 //
|
int loopback = 10 //
|
||||||
)
|
)
|
||||||
@@ -1649,7 +1653,7 @@ bool CanTriggerCond2(
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Validate Decision Box ...
|
// Validate Decision Box ...
|
||||||
result = box.IsValid() &&
|
result = decisionZone.IsValid() &&
|
||||||
helper != NULL;
|
helper != NULL;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1657,40 +1661,33 @@ bool CanTriggerCond2(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone activatedFVG;
|
bool has = false;
|
||||||
bool hasActivatedFVG = IsBoxHasActivatedFVG(
|
bool hasPivots = HasChild(decisionPivots);
|
||||||
helper,
|
int pivotsCount = ArraySize(decisionPivots);
|
||||||
box,
|
|
||||||
activatedFVG,
|
|
||||||
barIndex,
|
|
||||||
loopback //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool hasBullishActivatedFVG =
|
// Draw Decision Pivots ...
|
||||||
hasActivatedFVG &&
|
if (hasPivots)
|
||||||
activatedFVG.IsBullish();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasBearishActivatedFVG =
|
|
||||||
hasActivatedFVG &&
|
|
||||||
activatedFVG.IsBearish();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasActivatedFVG)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Preparing TP and SL ...
|
for (int i = 0; i < pivotsCount; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
|
||||||
//
|
//
|
||||||
sl = hasBullishActivatedFVG
|
has = helper.poiDrawer.DrawBox(
|
||||||
? box.lower // activatedFVG.lower
|
decisionPivots[i],
|
||||||
: box.upper; // activatedFVG.upper;
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
drawns.Add(iObj);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Since Here TP Must Calculated
|
ZeroMemory(iObj);
|
||||||
// Using R2R we Ignore Target ...
|
}
|
||||||
tp = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1698,11 +1695,11 @@ bool CanTriggerCond2(
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool canTriggerLong =
|
bool canTriggerLong =
|
||||||
hasBullishActivatedFVG;
|
false;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool canTriggerShort =
|
bool canTriggerShort =
|
||||||
hasBearishActivatedFVG;
|
false;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = canTriggerLong ||
|
result = canTriggerLong ||
|
||||||
@@ -1713,6 +1710,18 @@ bool CanTriggerCond2(
|
|||||||
dir = canTriggerLong
|
dir = canTriggerLong
|
||||||
? X_DIRECTION_BULLISH
|
? X_DIRECTION_BULLISH
|
||||||
: X_DIRECTION_BEARISH;
|
: X_DIRECTION_BEARISH;
|
||||||
|
//
|
||||||
|
// Preparing TP and SL ...
|
||||||
|
|
||||||
|
//
|
||||||
|
sl = canTriggerLong
|
||||||
|
? decisionZone.lower // activatedFVG.lower
|
||||||
|
: decisionZone.upper; // activatedFVG.upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Since Here TP Must Calculated
|
||||||
|
// Using R2R we Ignore Target ...
|
||||||
|
tp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -396,6 +396,41 @@ class XCXCAEASignaller : XCBase
|
|||||||
int toIDX = conditions.decisionZone.ToIndex();
|
int toIDX = conditions.decisionZone.ToIndex();
|
||||||
int fromIDX = conditions.decisionZone.FromIndex();
|
int fromIDX = conditions.decisionZone.FromIndex();
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// for (int i = fromIDX; i > toIDX; i--)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Initializing iBar;
|
||||||
|
// XOHCL iBar;
|
||||||
|
// has = iBar.Init(
|
||||||
|
// conditions.symbol,
|
||||||
|
// conditions.period,
|
||||||
|
// i //
|
||||||
|
// );
|
||||||
|
// if (!has)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// iBar.Clean();
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Retrieve Conditions ...
|
||||||
|
// XCAEAConditions iConditions;
|
||||||
|
// has = helper.GetConditions(
|
||||||
|
// iConditions,
|
||||||
|
// i,
|
||||||
|
// 5 //
|
||||||
|
// );
|
||||||
|
// if (!has) {
|
||||||
|
// //
|
||||||
|
// iBar.Clean();
|
||||||
|
// iConditions.Clean();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
CArrayObj *iObjects;
|
CArrayObj *iObjects;
|
||||||
iObjects = new CArrayObj();
|
iObjects = new CArrayObj();
|
||||||
@@ -426,21 +461,10 @@ class XCXCAEASignaller : XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Checking Trigger Cond 2 ...
|
// Checking Trigger Cond 2 ...
|
||||||
bool canTriggerCond2 = false;
|
bool canTriggerCond2 = CanTriggerCond2(
|
||||||
// CanTriggerCond2(
|
|
||||||
// helper,
|
|
||||||
// conditions.decisionZone,
|
|
||||||
// triggerDir,
|
|
||||||
// sl,
|
|
||||||
// tp,
|
|
||||||
// barIndex //
|
|
||||||
// );
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Trigger Cond 3 ...
|
|
||||||
bool canTriggerCond3 = CanTriggerCond3(
|
|
||||||
helper,
|
helper,
|
||||||
conditions.decisionZone,
|
conditions.decisionZone,
|
||||||
|
decisionOBs,
|
||||||
triggerDir,
|
triggerDir,
|
||||||
sl,
|
sl,
|
||||||
tp,
|
tp,
|
||||||
@@ -448,6 +472,19 @@ class XCXCAEASignaller : XCBase
|
|||||||
barIndex //
|
barIndex //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Trigger Cond 3 ...
|
||||||
|
bool canTriggerCond3 = false;
|
||||||
|
// CanTriggerCond3(
|
||||||
|
// helper,
|
||||||
|
// conditions.decisionZone,
|
||||||
|
// triggerDir,
|
||||||
|
// sl,
|
||||||
|
// tp,
|
||||||
|
// iObjects,
|
||||||
|
// barIndex //
|
||||||
|
// );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Update Signal Box To ...
|
// Update Signal Box To ...
|
||||||
conditions.decisionZone.to = cTime;
|
conditions.decisionZone.to = cTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user