last ...
This commit is contained in:
@@ -1762,6 +1762,178 @@ class XCBarAnalyser : public XCBase
|
|||||||
//
|
//
|
||||||
// Custom Logics ...
|
// Custom Logics ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a Bar is End of an OrderBlock Bar or Not ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL ...
|
||||||
|
* @param box: XBoxZone ...
|
||||||
|
* @param forceFVGBarType: bool, Force all Bars must be Same as Direction ...
|
||||||
|
* @param forceOBTwoBar: bool, Force Two Bars of OB Start must be InDirection ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsOB(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &box,
|
||||||
|
bool forceFVGBarType = false,
|
||||||
|
bool forceOBTwoBar = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Bar Must be FVG ...
|
||||||
|
result = IsFVG(
|
||||||
|
bar,
|
||||||
|
box,
|
||||||
|
forceFVGBarType //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
box.type = "XOB";
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = box.IsBullish();
|
||||||
|
bool isBearish = box.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block Includes an FVG which Starts by atleast One
|
||||||
|
// or More Indirectional Bars ...
|
||||||
|
XOHCL fvgLastBar;
|
||||||
|
XOHCL fvgLastBarPrev;
|
||||||
|
XOHCL fvgLastBarPrev2;
|
||||||
|
|
||||||
|
//
|
||||||
|
int barIndex = bar.Index();
|
||||||
|
int fvgLastBarIndex = barIndex + 3;
|
||||||
|
result = fvgLastBar.Init(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
fvgLastBarIndex //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
fvgLastBar.GetPreviousBar(fvgLastBarPrev);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
fvgLastBarPrev.GetPreviousBar(fvgLastBarPrev2);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
fvgLastBar.Clean();
|
||||||
|
fvgLastBarPrev.Clean();
|
||||||
|
fvgLastBarPrev2.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check FVG Last Bar ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishBlock =
|
||||||
|
isBullish &&
|
||||||
|
(fvgLastBar.IsBearish() ||
|
||||||
|
(fvgLastBar.IsBullish() &&
|
||||||
|
fvgLastBarPrev.IsBearish()));
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearishBlock =
|
||||||
|
isBearish &&
|
||||||
|
(fvgLastBar.IsBullish() ||
|
||||||
|
(fvgLastBar.IsBearish() &&
|
||||||
|
fvgLastBarPrev.IsBullish()));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Box ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBullishBlock ||
|
||||||
|
isBearishBlock)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.from = fvgLastBar.time;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.lower = MathMin(box.lower, fvgLastBar.low);
|
||||||
|
box.upper = MathMax(box.upper, fvgLastBar.high);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Apply Force Two Bar ...
|
||||||
|
if (forceOBTwoBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullishBlock =
|
||||||
|
isBullishBlock &&
|
||||||
|
fvgLastBarPrev.IsBearish();
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearishBlock =
|
||||||
|
isBearishBlock &&
|
||||||
|
fvgLastBarPrev.IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Update Box ...
|
||||||
|
if (isBullishBlock ||
|
||||||
|
isBearishBlock)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.from = fvgLastBarPrev.time;
|
||||||
|
box.lower = MathMin(box.lower, fvgLastBarPrev.low);
|
||||||
|
box.upper = MathMax(box.upper, fvgLastBarPrev.high);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullishBlock ||
|
||||||
|
isBearishBlock;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
fvgLastBar.Clean();
|
||||||
|
fvgLastBarPrev.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = box.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup Resources ...
|
||||||
|
|
||||||
|
//
|
||||||
|
fvgLastBar.Clean();
|
||||||
|
fvgLastBarPrev.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check a Bar is End of an FVG Bar or Not ...
|
* Check a Bar is End of an FVG Bar or Not ...
|
||||||
*
|
*
|
||||||
@@ -1868,169 +2040,6 @@ class XCBarAnalyser : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check a Bar is End of an OrderBlock Bar or Not ...
|
|
||||||
*
|
|
||||||
* @param bar: XOHCL ...
|
|
||||||
* @param box: XBoxZone ...
|
|
||||||
* @param forceFVGBarType: bool, Force all Bars must be Same as Direction ...
|
|
||||||
* @param forceOBTwoBar: bool, Force Two Bars of OB Start must be InDirection ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsOrderBlock(
|
|
||||||
XOHCL &bar,
|
|
||||||
XBoxZone &box,
|
|
||||||
bool forceFVGBarType = false,
|
|
||||||
bool forceOBTwoBar = false //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
box.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
result = bar.IsValid();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Bar Must be FVG ...
|
|
||||||
result = IsFVG(
|
|
||||||
bar,
|
|
||||||
box,
|
|
||||||
forceFVGBarType //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
box.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
box.type = "XOB";
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullish = box.IsBullish();
|
|
||||||
bool isBearish = box.IsBearish();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Order Block Includes an FVG which Starts by atleast One
|
|
||||||
// or More Indirectional Bars ...
|
|
||||||
XOHCL fvgLastBar;
|
|
||||||
XOHCL fvgLastBarPrev;
|
|
||||||
|
|
||||||
//
|
|
||||||
int barIndex = bar.Index();
|
|
||||||
int fvgLastBarIndex = barIndex + 3;
|
|
||||||
result = fvgLastBar.Init(
|
|
||||||
bar.symbol,
|
|
||||||
bar.period,
|
|
||||||
fvgLastBarIndex //
|
|
||||||
);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
fvgLastBar.GetPreviousBar(fvgLastBarPrev);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
box.Clean();
|
|
||||||
fvgLastBar.Clean();
|
|
||||||
fvgLastBarPrev.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check FVG Last Bar ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBullishBlock =
|
|
||||||
isBullish &&
|
|
||||||
fvgLastBar.IsBearish();
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isBearishBlock =
|
|
||||||
isBearish &&
|
|
||||||
fvgLastBar.IsBullish();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update Box ...
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isBullishBlock ||
|
|
||||||
isBearishBlock)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
box.from = fvgLastBar.time;
|
|
||||||
|
|
||||||
//
|
|
||||||
box.lower = MathMin(box.lower, fvgLastBar.low);
|
|
||||||
box.upper = MathMax(box.upper, fvgLastBar.high);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Apply Force Two Bar ...
|
|
||||||
if (forceOBTwoBar)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isBullishBlock =
|
|
||||||
isBullishBlock &&
|
|
||||||
fvgLastBarPrev.IsBearish();
|
|
||||||
|
|
||||||
//
|
|
||||||
isBearishBlock =
|
|
||||||
isBearishBlock &&
|
|
||||||
fvgLastBarPrev.IsBullish();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Update Box ...
|
|
||||||
if (isBullishBlock ||
|
|
||||||
isBearishBlock)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
box.from = fvgLastBarPrev.time;
|
|
||||||
box.lower = MathMin(box.lower, fvgLastBarPrev.low);
|
|
||||||
box.upper = MathMax(box.upper, fvgLastBarPrev.high);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = isBullishBlock ||
|
|
||||||
isBearishBlock;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
box.Clean();
|
|
||||||
fvgLastBar.Clean();
|
|
||||||
fvgLastBarPrev.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = box.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
// Cleanup Resources ...
|
|
||||||
|
|
||||||
//
|
|
||||||
fvgLastBar.Clean();
|
|
||||||
fvgLastBarPrev.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Candlestick ...
|
// Candlestick ...
|
||||||
|
|
||||||
@@ -2091,7 +2100,7 @@ class XCBarAnalyser : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Specified Bar is Pullback or not ...
|
* Check Specified Bar is Swing or not ...
|
||||||
*
|
*
|
||||||
* @param bar: XOHCL instance reference, Specified Bar to Check ...
|
* @param bar: XOHCL instance reference, Specified Bar to Check ...
|
||||||
* @param dir: ENUM_X_DIRECTION member, Specified Doji Direction ...
|
* @param dir: ENUM_X_DIRECTION member, Specified Doji Direction ...
|
||||||
|
|||||||
@@ -94,3 +94,125 @@
|
|||||||
swing.Clean();
|
swing.Clean();
|
||||||
breaker.Clean();
|
breaker.Clean();
|
||||||
outSide.Clean();
|
outSide.Clean();
|
||||||
|
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Specified Bar is Swing or not ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance reference, Specified Swing Bar ...
|
||||||
|
* @param forDir: ENUM_X_DIRECTION member, Specified Direction of Swing ...
|
||||||
|
* @param barIndex: int, Specified Bar Index to Check ...
|
||||||
|
* @param loopback: int, Specified Loopback for BothSide Checking ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsSwingSide(
|
||||||
|
XOHCL &bar,
|
||||||
|
ENUM_X_DIRECTION forDir,
|
||||||
|
int loopback = 7 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSwingLow = IsBullish(forDir);
|
||||||
|
bool isSwingHigh = IsBearish(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol = bar.symbol;
|
||||||
|
ENUM_TIMEFRAMES period = bar.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
int totalBars = iBars(
|
||||||
|
symbol,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
int barIndex = bar.Index();
|
||||||
|
loopback = NormalizeInt(loopback, 3);
|
||||||
|
result =
|
||||||
|
barIndex - loopback > 0 &&
|
||||||
|
barIndex + 1 + loopback <= totalBars;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < loopback; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XOHCL iPBar;
|
||||||
|
XOHCL iNBar;
|
||||||
|
result = iPBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex + i //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
iNBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex - i //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPBar.Clean();
|
||||||
|
iNBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
isSwingLow =
|
||||||
|
isSwingLow &&
|
||||||
|
bar.low < iPBar.low &&
|
||||||
|
bar.low < iNBar.low;
|
||||||
|
|
||||||
|
//
|
||||||
|
isSwingHigh =
|
||||||
|
isSwingHigh &&
|
||||||
|
bar.high > iPBar.high &&
|
||||||
|
bar.high > iNBar.high;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isSwingLow ||
|
||||||
|
isSwingHigh;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPBar.Clean();
|
||||||
|
iNBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iPBar.Clean();
|
||||||
|
iNBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
bar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ void OnTick()
|
|||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
idx = i;
|
idx = i;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4211,7 +4211,7 @@ class XCXCAEAHelper : XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Check to Find OB ...
|
// Check to Find OB ...
|
||||||
has = barAnalyser.IsOrderBlock(
|
has = barAnalyser.IsOB(
|
||||||
iBar,
|
iBar,
|
||||||
ob,
|
ob,
|
||||||
false,
|
false,
|
||||||
@@ -4289,6 +4289,9 @@ class XCXCAEAHelper : XCBase
|
|||||||
iBar,
|
iBar,
|
||||||
swingDir //
|
swingDir //
|
||||||
);
|
);
|
||||||
|
has =
|
||||||
|
has &&
|
||||||
|
iBar.GetPreviousBar(swingBar);
|
||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -4302,7 +4305,6 @@ class XCXCAEAHelper : XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Validate Founded Swing ...
|
// Validate Founded Swing ...
|
||||||
swingBar = iBar;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isValidSwingLow =
|
bool isValidSwingLow =
|
||||||
|
|||||||
@@ -433,6 +433,104 @@ int AddGuard(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
enum ENUM_XCAEA_LQ_TYPES
|
||||||
|
{
|
||||||
|
XCAEA_LQ_TYPE_NONE = 0,
|
||||||
|
XCAEA_LQ_TYPE_PEAK = 1,
|
||||||
|
XCAEA_LQ_TYPE_VALE = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct XCAEALQSweep
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
int length;
|
||||||
|
datetime to;
|
||||||
|
string symbol;
|
||||||
|
datetime from;
|
||||||
|
double sweeped;
|
||||||
|
double reverse;
|
||||||
|
ENUM_TIMEFRAMES period;
|
||||||
|
ENUM_XCAEA_LQ_TYPES type;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XCAEALQSweep()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Cleanup ...
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
to = NULL;
|
||||||
|
length = 0;
|
||||||
|
from = NULL;
|
||||||
|
sweeped = 0;
|
||||||
|
reverse = 0;
|
||||||
|
symbol = NULL;
|
||||||
|
period = NULL;
|
||||||
|
type = XCAEA_LQ_TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validation ...
|
||||||
|
bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
length > 0 &&
|
||||||
|
IsValid(to) &&
|
||||||
|
sweeped > 0 &&
|
||||||
|
reverse > 0 &&
|
||||||
|
IsValid(from) &&
|
||||||
|
IsValid(symbol) &&
|
||||||
|
IsValid(period) &&
|
||||||
|
type != XCAEA_LQ_TYPE_NONE
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string GetTag()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = symbol +
|
||||||
|
ToString(period) +
|
||||||
|
"XLQ" +
|
||||||
|
(type == XCAEA_LQ_TYPE_PEAK ? "Peak" : "Vale") +
|
||||||
|
ToString(sweeped);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Decision Zone ...
|
// Detect Decision Zone ...
|
||||||
bool DetectDecisionZone(
|
bool DetectDecisionZone(
|
||||||
@@ -583,7 +681,7 @@ bool DetectDecisionZone(
|
|||||||
XBoxZone ob;
|
XBoxZone ob;
|
||||||
bool isOB = helper
|
bool isOB = helper
|
||||||
.barAnalyser
|
.barAnalyser
|
||||||
.IsOrderBlock(
|
.IsOB(
|
||||||
cBar,
|
cBar,
|
||||||
ob,
|
ob,
|
||||||
false, // Force FVG Bar Type
|
false, // Force FVG Bar Type
|
||||||
@@ -1071,9 +1169,6 @@ bool DetectDecisionZone(
|
|||||||
);
|
);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Style Object ...
|
|
||||||
Print("Salam");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1636,6 +1731,7 @@ bool CanTriggerCond3(
|
|||||||
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 //
|
||||||
)
|
)
|
||||||
@@ -1661,54 +1757,532 @@ bool CanTriggerCond3(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect At Least one Outside Bar ...
|
bool isBullish = box.IsBullish();
|
||||||
// TODO: Complete this ...
|
bool isBearish = box.IsBearish();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Add Support for a Breaked Swing as Liquidity ...
|
bool has = false;
|
||||||
// for Improve Validations ...
|
int swingLoopback = 7;
|
||||||
// TODO: Complete this ...
|
ENUM_TIMEFRAMES period = helper.GetPeriod();
|
||||||
|
string symbol = helper.GetSymbol();
|
||||||
//
|
int toIDX = box.ToIndex(period);
|
||||||
// Detect Block Based Trigger ...
|
int fromIDX = box.FromIndex(period);
|
||||||
XBoxZone ob;
|
datetime cTime = GetBarTime(
|
||||||
XOHCL swing;
|
symbol,
|
||||||
XOHCL breaker;
|
period,
|
||||||
XOHCL outSide;
|
barIndex //
|
||||||
ENUM_X_DIRECTION passedDir;
|
|
||||||
bool isPassed = helper.IsBlockBasedTriggerBar(
|
|
||||||
ob,
|
|
||||||
swing,
|
|
||||||
breaker,
|
|
||||||
outSide,
|
|
||||||
passedDir,
|
|
||||||
barIndex + 1, // Bar Index ...
|
|
||||||
30, // Loopback ...
|
|
||||||
3 // Swing Length ...
|
|
||||||
);
|
);
|
||||||
bool isBullishPassed =
|
|
||||||
isPassed &&
|
//
|
||||||
ob.IsBullish() &&
|
// Detect Box FVG ...
|
||||||
box.IsBullish() &&
|
|
||||||
ob.upper < box.upper &&
|
//
|
||||||
ob.lower > box.lower;
|
// we Have to Detect a Broken Liquidity for Box ...
|
||||||
bool isBearishPassed =
|
|
||||||
isPassed &&
|
//
|
||||||
ob.IsBearish() &&
|
XBoxZone fvg;
|
||||||
box.IsBearish() &&
|
XBoxZone fvgs[];
|
||||||
ob.upper < box.upper &&
|
for (int i = fromIDX + loopback; i > barIndex; i--)
|
||||||
ob.lower > box.lower;
|
{
|
||||||
|
//
|
||||||
|
// Initialize iBar ...
|
||||||
|
XOHCL iBar;
|
||||||
|
has = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
i //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check iBar Has FVG ...
|
||||||
|
XBoxZone iFVG;
|
||||||
|
has = helper
|
||||||
|
.barAnalyser
|
||||||
|
.IsFVG(
|
||||||
|
iBar,
|
||||||
|
iFVG,
|
||||||
|
true //
|
||||||
|
);
|
||||||
|
has =
|
||||||
|
//
|
||||||
|
// Check FVG Exists ...
|
||||||
|
has &&
|
||||||
|
//
|
||||||
|
// Check FVG Direction ...
|
||||||
|
iFVG.dir == box.dir &&
|
||||||
|
//
|
||||||
|
// Check FVG not Breaked ...
|
||||||
|
!IsBoxBreaked(
|
||||||
|
helper,
|
||||||
|
iFVG,
|
||||||
|
barIndex //
|
||||||
|
) &&
|
||||||
|
//
|
||||||
|
// Check FVG Placement ...
|
||||||
|
(iFVG.IsBullish()
|
||||||
|
? iFVG.lower < box.upper
|
||||||
|
: iFVG.upper > box.lower);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iFVG.to = cTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iFVG,
|
||||||
|
fvgs //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
iFVG.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting Target FVG ...
|
||||||
|
int idx = isBullish
|
||||||
|
? GetHighest(fvgs)
|
||||||
|
: GetLowest(fvgs);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
fvg = fvgs[idx];
|
||||||
|
|
||||||
|
//
|
||||||
|
fvg.to = cTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ensure FVG must Exists ...
|
||||||
|
result = fvg.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
fvg.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check FVg Break ...
|
||||||
|
bool isBreaked = IsBoxBreaked(
|
||||||
|
helper,
|
||||||
|
fvg,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
result = !isBreaked;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Here We Can Cleanup Decision Zone ...
|
||||||
|
// since the Conditions Destructed ...
|
||||||
|
// box.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
fvg.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw FVG ...
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = helper.poiDrawer.DrawBox(
|
||||||
|
fvg,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
color fvgColor =
|
||||||
|
isBullish
|
||||||
|
? clrLime
|
||||||
|
: clrRed;
|
||||||
|
|
||||||
|
//
|
||||||
|
iObj.BoxWidth(2);
|
||||||
|
iObj.BoxColor(fvgColor);
|
||||||
|
iObj.Style(STYLE_SOLID);
|
||||||
|
|
||||||
|
//
|
||||||
|
drawns.Add(iObj);
|
||||||
|
}
|
||||||
|
ZeroMemory(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting Liquiidties ...
|
||||||
|
XOHCL iBar;
|
||||||
|
XCAEALQSweep iLQ;
|
||||||
|
XCAEALQSweep lqs[];
|
||||||
|
toIDX = fvg.ToIndex();
|
||||||
|
fromIDX = fvg.FromIndex();
|
||||||
|
XCAEAConditions iConditions;
|
||||||
|
double fvgPrice = isBullish
|
||||||
|
? fvg.upper
|
||||||
|
: fvg.lower;
|
||||||
|
double fvgReversePrice = isBullish
|
||||||
|
? fvg.lower
|
||||||
|
: fvg.upper;
|
||||||
|
for (int i = fromIDX; i > toIDX; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Initialize iBar ...
|
||||||
|
has = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
i //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Conditions ...
|
||||||
|
has = helper.GetConditions(
|
||||||
|
iConditions,
|
||||||
|
i,
|
||||||
|
5 //
|
||||||
|
);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double iSweep =
|
||||||
|
isBullish
|
||||||
|
? iConditions.valeBuffer[1]
|
||||||
|
: iConditions.peakBuffer[1];
|
||||||
|
double iSweepP =
|
||||||
|
isBullish
|
||||||
|
? iConditions.valeBuffer[2]
|
||||||
|
: iConditions.peakBuffer[2];
|
||||||
|
double iSweepP2 =
|
||||||
|
isBullish
|
||||||
|
? iConditions.valeBuffer[3]
|
||||||
|
: iConditions.peakBuffer[3];
|
||||||
|
double iReverse =
|
||||||
|
isBullish
|
||||||
|
? iConditions.peakBuffer[1]
|
||||||
|
: iConditions.valeBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSweepContinue =
|
||||||
|
iSweepP == iSweep &&
|
||||||
|
(isBullish
|
||||||
|
? iSweep > fvgPrice
|
||||||
|
: iSweep < fvgPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSweepContinueP =
|
||||||
|
iSweepP2 == iSweepP &&
|
||||||
|
(isBullish
|
||||||
|
? iSweepP > fvgPrice
|
||||||
|
: iSweepP < fvgPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSweepStart =
|
||||||
|
isSweepContinue &&
|
||||||
|
!isSweepContinueP;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSweepFinished =
|
||||||
|
!isSweepContinue &&
|
||||||
|
isSweepContinueP;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSweepStart)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iLQ.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
iLQ.symbol = iBar.symbol;
|
||||||
|
iLQ.period = iBar.period;
|
||||||
|
iLQ.type = isBullish
|
||||||
|
? XCAEA_LQ_TYPE_VALE
|
||||||
|
: XCAEA_LQ_TYPE_PEAK;
|
||||||
|
iLQ.to = iBar.time;
|
||||||
|
iLQ.from = iBar.time;
|
||||||
|
|
||||||
|
//
|
||||||
|
iLQ.length = 1;
|
||||||
|
iLQ.sweeped = iSweep;
|
||||||
|
iLQ.reverse = iReverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSweepContinue)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iLQ.length++;
|
||||||
|
iLQ.to = iBar.time;
|
||||||
|
iLQ.sweeped = iSweep;
|
||||||
|
iLQ.reverse = MathMin(iLQ.reverse, iReverse);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isSweepFinished)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
iLQ,
|
||||||
|
lqs //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
iLQ.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Bar and Conditions ...
|
||||||
|
has = iBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
has = has &&
|
||||||
|
helper.GetConditions(
|
||||||
|
iConditions,
|
||||||
|
barIndex,
|
||||||
|
loopback //
|
||||||
|
);
|
||||||
|
result = has;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(lqs);
|
||||||
|
fvg.Clean();
|
||||||
|
iLQ.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Peak/Vale Value Based on Box ...
|
||||||
|
double iPV = isBullish
|
||||||
|
? iConditions.valeBuffer[1]
|
||||||
|
: iConditions.peakBuffer[1];
|
||||||
|
double iPVReverse = isBullish
|
||||||
|
? iConditions.peakBuffer[1]
|
||||||
|
: iConditions.valeBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Liquidities Exists ...
|
||||||
|
result = HasChild(lqs);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(lqs);
|
||||||
|
fvg.Clean();
|
||||||
|
iLQ.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Liquidities ...
|
||||||
|
for (int i = 0; i < ArraySize(lqs); i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iLQ = lqs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
CChartObjectTrend *iTrend;
|
||||||
|
iTrend = new CChartObjectTrend();
|
||||||
|
string itName = iLQ.GetTag();
|
||||||
|
has = iTrend.Create(
|
||||||
|
0,
|
||||||
|
itName,
|
||||||
|
0,
|
||||||
|
iLQ.from,
|
||||||
|
iLQ.sweeped,
|
||||||
|
iLQ.to,
|
||||||
|
iLQ.sweeped //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
color itColor =
|
||||||
|
isBullish
|
||||||
|
? clrLime
|
||||||
|
: clrRed;
|
||||||
|
|
||||||
|
//
|
||||||
|
iTrend.Width(2);
|
||||||
|
iTrend.Color(itColor);
|
||||||
|
iTrend.Style(STYLE_SOLID);
|
||||||
|
|
||||||
|
//
|
||||||
|
drawns.Add(iTrend);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(iTrend);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// PV Must go Inside FVG ...
|
||||||
|
has =
|
||||||
|
isBullish
|
||||||
|
? iPV < fvgPrice
|
||||||
|
: iPV > fvgPrice;
|
||||||
|
result = has;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(lqs);
|
||||||
|
fvg.Clean();
|
||||||
|
iLQ.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect a Traget for SL based on Activated FVG ...
|
||||||
|
XBoxZone slTarget;
|
||||||
|
double fvgValidatorPrice =
|
||||||
|
isBullish
|
||||||
|
? fvg.lower
|
||||||
|
: fvg.upper;
|
||||||
|
for (int i = 0; i < ArraySize(fvgs); i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iFVG = fvgs[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
double iFVGPrice =
|
||||||
|
isBullish
|
||||||
|
? iFVG.upper
|
||||||
|
: iFVG.lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Placement ...
|
||||||
|
has = iFVGPrice > fvgValidatorPrice;
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iFVG.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set slTarget ...
|
||||||
|
double slTargetPrice = (isBullish
|
||||||
|
? slTarget.upper
|
||||||
|
: slTarget.lower);
|
||||||
|
has =
|
||||||
|
!slTarget.IsValid()
|
||||||
|
? true
|
||||||
|
: (isBullish
|
||||||
|
? slTargetPrice < iFVGPrice
|
||||||
|
: slTargetPrice > iFVGPrice);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
slTarget = iFVG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ensure SL Target Exists ...
|
||||||
|
result = slTarget.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(lqs);
|
||||||
|
fvg.Clean();
|
||||||
|
iLQ.Clean();
|
||||||
|
Clean(fvgs);
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Darw SL Target Zone ...
|
||||||
|
slTarget.to = cTime;
|
||||||
|
XCBoxObject *iSLObj;
|
||||||
|
has = helper.poiDrawer.DrawBox(
|
||||||
|
slTarget,
|
||||||
|
iSLObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
color slTargetColor =
|
||||||
|
isBullish
|
||||||
|
? clrAqua
|
||||||
|
: clrMagenta;
|
||||||
|
|
||||||
|
//
|
||||||
|
iSLObj.BoxWidth(1);
|
||||||
|
iSLObj.BoxColor(slTargetColor);
|
||||||
|
|
||||||
|
//
|
||||||
|
drawns.Add(iSLObj);
|
||||||
|
}
|
||||||
|
ZeroMemory(iSLObj);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Summarizing ...
|
// Summarizing ...
|
||||||
|
|
||||||
//
|
//
|
||||||
bool canTriggerLong =
|
bool canTriggerLong =
|
||||||
isBullishPassed;
|
isBullish &&
|
||||||
|
fvg.IsBullish() &&
|
||||||
|
slTarget.IsBullish();
|
||||||
|
|
||||||
//
|
//
|
||||||
bool canTriggerShort =
|
bool canTriggerShort =
|
||||||
isBearishPassed;
|
isBearish &&
|
||||||
|
fvg.IsBearish() &&
|
||||||
|
slTarget.IsBearish();
|
||||||
|
|
||||||
//
|
//
|
||||||
result = canTriggerLong ||
|
result = canTriggerLong ||
|
||||||
@@ -1724,9 +2298,9 @@ bool CanTriggerCond3(
|
|||||||
// Preparing TP and SL ...
|
// Preparing TP and SL ...
|
||||||
|
|
||||||
//
|
//
|
||||||
sl = canTriggerLong
|
sl = isBullish
|
||||||
? ob.lower
|
? slTarget.lower
|
||||||
: ob.upper;
|
: slTarget.upper;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Since Here TP Must Calculated
|
// Since Here TP Must Calculated
|
||||||
@@ -1738,10 +2312,12 @@ bool CanTriggerCond3(
|
|||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|
||||||
//
|
//
|
||||||
ob.Clean();
|
Clean(lqs);
|
||||||
swing.Clean();
|
fvg.Clean();
|
||||||
breaker.Clean();
|
iLQ.Clean();
|
||||||
outSide.Clean();
|
Clean(fvgs);
|
||||||
|
iBar.Clean();
|
||||||
|
iConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -475,6 +475,9 @@ class XCXCAEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Checking Signal's Decision Zone ...
|
// Checking Signal's Decision Zone ...
|
||||||
// On Analyse Time Frame ...
|
// On Analyse Time Frame ...
|
||||||
|
if (!HasChild(mConditionsCollection))
|
||||||
|
{
|
||||||
|
//
|
||||||
hasDecisionZone = DetectDecisionZone(
|
hasDecisionZone = DetectDecisionZone(
|
||||||
analyseHelper,
|
analyseHelper,
|
||||||
drawer,
|
drawer,
|
||||||
@@ -495,6 +498,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
unAvailableBoxes //
|
unAvailableBoxes //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullish = hasDecisionZone &&
|
isBullish = hasDecisionZone &&
|
||||||
@@ -554,7 +558,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
bool DetectSignalTrigger(
|
bool DetectSignalTrigger(
|
||||||
XCAEAStrategyConditions &conditions,
|
XCAEAStrategyConditions &conditions,
|
||||||
int barIndex = 0,
|
int barIndex = 0,
|
||||||
int maxAllowedSetupAge = 200 //
|
int maxAllowedSetupAge = 1000 //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -618,76 +622,12 @@ class XCXCAEASignaller : XCBase
|
|||||||
double sl = 0;
|
double sl = 0;
|
||||||
double tp = 0;
|
double tp = 0;
|
||||||
ENUM_X_DIRECTION triggerDir = X_DIRECTION_NONE;
|
ENUM_X_DIRECTION triggerDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
//
|
|
||||||
// Detect All Inside Directional FVGs ...
|
|
||||||
XBoxZone fvgs[];
|
|
||||||
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--)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL iBar;
|
|
||||||
XBoxZone iFVG;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize iBar ...
|
CArrayObj *iObjects;
|
||||||
has = iBar.Init(
|
iObjects = new CArrayObj();
|
||||||
conditions.symbol,
|
|
||||||
conditions.period,
|
|
||||||
i //
|
|
||||||
);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
iFVG.Clean();
|
|
||||||
iBar.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check iBar has FVG ...
|
|
||||||
has = helper
|
|
||||||
.barAnalyser
|
|
||||||
.IsFVG(
|
|
||||||
iBar,
|
|
||||||
iFVG,
|
|
||||||
true //
|
|
||||||
);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
iBar.Clean();
|
|
||||||
iFVG.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check FVG Direction and Placement ...
|
|
||||||
has =
|
|
||||||
iFVG.dir == conditions.decisionZone.dir &&
|
|
||||||
iFVG.upper < conditions.decisionZone.upper &&
|
|
||||||
iFVG.lower > conditions.decisionZone.lower;
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
iFVG.to = cTime;
|
|
||||||
AddRef(
|
|
||||||
iFVG,
|
|
||||||
fvgs //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
iBar.Clean();
|
|
||||||
iFVG.Clean();
|
|
||||||
}
|
|
||||||
bool hasFVGs = HasChild(fvgs);
|
|
||||||
int fvgsCount = ArraySize(fvgs);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Checking Trigger Cond 0 ...
|
// Checking Trigger Cond 0 ...
|
||||||
@@ -733,6 +673,7 @@ class XCXCAEASignaller : XCBase
|
|||||||
triggerDir,
|
triggerDir,
|
||||||
sl,
|
sl,
|
||||||
tp,
|
tp,
|
||||||
|
iObjects,
|
||||||
barIndex //
|
barIndex //
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -754,28 +695,12 @@ class XCXCAEASignaller : XCBase
|
|||||||
ZeroMemory(iObj);
|
ZeroMemory(iObj);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw FVGs ...
|
for (int i = 0; i < iObjects.Total(); i++)
|
||||||
if (hasFVGs)
|
|
||||||
{
|
{
|
||||||
//
|
mObjects.Add(iObjects.At(i));
|
||||||
for (int i = 0; i < fvgsCount; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
fvgs[i].to = cTime;
|
|
||||||
|
|
||||||
//
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = helper.poiDrawer.DrawBox(
|
|
||||||
fvgs[i],
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
mObjects.Add(iObj);
|
|
||||||
}
|
|
||||||
ZeroMemory(iObj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// iObjects.Clear();
|
||||||
|
// ZeroMemory(iObjects);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Summarizing Result ...
|
// Summarizing Result ...
|
||||||
@@ -879,6 +804,14 @@ class XCXCAEASignaller : XCBase
|
|||||||
conditions.Clean();
|
conditions.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking Decision Zone Validation ...
|
||||||
|
bool isValid = conditions.decisionZone.IsValid();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
conditions.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Box Price ...
|
// Check Box Price ...
|
||||||
has = IsBoxBreaked(
|
has = IsBoxBreaked(
|
||||||
|
|||||||
Reference in New Issue
Block a user