last ...
This commit is contained in:
@@ -1365,6 +1365,172 @@ class XCXCAEAPOIDetector : public XCBase
|
||||
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 ...
|
||||
|
||||
|
||||
@@ -1253,6 +1253,7 @@ bool CanTriggerCond0(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
double &sl,
|
||||
double &tp,
|
||||
CArrayObj *drawns,
|
||||
int barIndex = 0,
|
||||
int loopback = 5,
|
||||
double scorePassMultiplier = 1 //
|
||||
@@ -1519,6 +1520,7 @@ bool CanTriggerCond1(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
double &sl,
|
||||
double &tp,
|
||||
CArrayObj *drawns,
|
||||
int barIndex = 0,
|
||||
int loopback = 10 //
|
||||
)
|
||||
@@ -1625,13 +1627,15 @@ bool CanTriggerCond1(
|
||||
|
||||
//
|
||||
// Detect Trigger Based On Decision Zone's
|
||||
// Box Starts With FVG ...
|
||||
// Using OB inside Boxes ...
|
||||
bool CanTriggerCond2(
|
||||
XCXCAEAHelper *helper,
|
||||
XBoxZone &box,
|
||||
XBoxZone &decisionZone,
|
||||
XBoxZone &decisionPivots[],
|
||||
ENUM_X_DIRECTION &dir,
|
||||
double &sl,
|
||||
double &tp,
|
||||
CArrayObj *drawns,
|
||||
int barIndex = 0,
|
||||
int loopback = 10 //
|
||||
)
|
||||
@@ -1649,7 +1653,7 @@ bool CanTriggerCond2(
|
||||
|
||||
//
|
||||
// Validate Decision Box ...
|
||||
result = box.IsValid() &&
|
||||
result = decisionZone.IsValid() &&
|
||||
helper != NULL;
|
||||
if (!result)
|
||||
{
|
||||
@@ -1657,40 +1661,33 @@ bool CanTriggerCond2(
|
||||
}
|
||||
|
||||
//
|
||||
XBoxZone activatedFVG;
|
||||
bool hasActivatedFVG = IsBoxHasActivatedFVG(
|
||||
helper,
|
||||
box,
|
||||
activatedFVG,
|
||||
barIndex,
|
||||
loopback //
|
||||
);
|
||||
bool has = false;
|
||||
bool hasPivots = HasChild(decisionPivots);
|
||||
int pivotsCount = ArraySize(decisionPivots);
|
||||
|
||||
//
|
||||
bool hasBullishActivatedFVG =
|
||||
hasActivatedFVG &&
|
||||
activatedFVG.IsBullish();
|
||||
|
||||
//
|
||||
bool hasBearishActivatedFVG =
|
||||
hasActivatedFVG &&
|
||||
activatedFVG.IsBearish();
|
||||
|
||||
//
|
||||
if (hasActivatedFVG)
|
||||
// Draw Decision Pivots ...
|
||||
if (hasPivots)
|
||||
{
|
||||
//
|
||||
// Preparing TP and SL ...
|
||||
for (int i = 0; i < pivotsCount; i++)
|
||||
{
|
||||
//
|
||||
XCBoxObject *iObj;
|
||||
|
||||
//
|
||||
sl = hasBullishActivatedFVG
|
||||
? box.lower // activatedFVG.lower
|
||||
: box.upper; // activatedFVG.upper;
|
||||
//
|
||||
has = helper.poiDrawer.DrawBox(
|
||||
decisionPivots[i],
|
||||
iObj //
|
||||
);
|
||||
if (has)
|
||||
{
|
||||
drawns.Add(iObj);
|
||||
}
|
||||
|
||||
//
|
||||
// Since Here TP Must Calculated
|
||||
// Using R2R we Ignore Target ...
|
||||
tp = 0;
|
||||
//
|
||||
ZeroMemory(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1698,11 +1695,11 @@ bool CanTriggerCond2(
|
||||
|
||||
//
|
||||
bool canTriggerLong =
|
||||
hasBullishActivatedFVG;
|
||||
false;
|
||||
|
||||
//
|
||||
bool canTriggerShort =
|
||||
hasBearishActivatedFVG;
|
||||
false;
|
||||
|
||||
//
|
||||
result = canTriggerLong ||
|
||||
@@ -1713,6 +1710,18 @@ bool CanTriggerCond2(
|
||||
dir = canTriggerLong
|
||||
? X_DIRECTION_BULLISH
|
||||
: 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 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;
|
||||
iObjects = new CArrayObj();
|
||||
@@ -426,21 +461,10 @@ class XCXCAEASignaller : XCBase
|
||||
|
||||
//
|
||||
// Checking Trigger Cond 2 ...
|
||||
bool canTriggerCond2 = false;
|
||||
// CanTriggerCond2(
|
||||
// helper,
|
||||
// conditions.decisionZone,
|
||||
// triggerDir,
|
||||
// sl,
|
||||
// tp,
|
||||
// barIndex //
|
||||
// );
|
||||
|
||||
//
|
||||
// Checking Trigger Cond 3 ...
|
||||
bool canTriggerCond3 = CanTriggerCond3(
|
||||
bool canTriggerCond2 = CanTriggerCond2(
|
||||
helper,
|
||||
conditions.decisionZone,
|
||||
decisionOBs,
|
||||
triggerDir,
|
||||
sl,
|
||||
tp,
|
||||
@@ -448,6 +472,19 @@ class XCXCAEASignaller : XCBase
|
||||
barIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// Checking Trigger Cond 3 ...
|
||||
bool canTriggerCond3 = false;
|
||||
// CanTriggerCond3(
|
||||
// helper,
|
||||
// conditions.decisionZone,
|
||||
// triggerDir,
|
||||
// sl,
|
||||
// tp,
|
||||
// iObjects,
|
||||
// barIndex //
|
||||
// );
|
||||
|
||||
//
|
||||
// Update Signal Box To ...
|
||||
conditions.decisionZone.to = cTime;
|
||||
|
||||
Reference in New Issue
Block a user