last ...
This commit is contained in:
@@ -910,6 +910,40 @@ bool FindBoxIndex(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check a BaxHas Valid Place for Specified Bar ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance reference, Specified Bar ...
|
||||||
|
* #param box: XBoxZone instance reference, Specified Box ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsBoxPlaceValidForBar(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &box //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
box.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
box.IsBullish()
|
||||||
|
? bar.low > box.upper
|
||||||
|
: bar.high < box.upper;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Source Box is Below Dest ...
|
* Check Source Box is Below Dest ...
|
||||||
*
|
*
|
||||||
@@ -2054,6 +2088,70 @@ int GetOldest(
|
|||||||
result = i;
|
result = i;
|
||||||
selected = iBox;
|
selected = iBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int GetOldest(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!bar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBoxValidForBar = IsBoxPlaceValidForBar(bar, iBox);
|
||||||
|
if (!isBoxValidForBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.from > iBox.from;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2102,6 +2200,70 @@ int GetYoungest(
|
|||||||
result = i;
|
result = i;
|
||||||
selected = iBox;
|
selected = iBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int GetYoungest(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!bar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBoxValidForBar = IsBoxPlaceValidForBar(bar, iBox);
|
||||||
|
if (!isBoxValidForBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.from < iBox.from;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2150,6 +2312,70 @@ int GetHighest(
|
|||||||
result = i;
|
result = i;
|
||||||
selected = iBox;
|
selected = iBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int GetHighest(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!bar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBoxValidForBar = IsBoxPlaceValidForBar(bar, iBox);
|
||||||
|
if (!isBoxValidForBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.upper < iBox.upper;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2198,6 +2424,70 @@ int GetLowest(
|
|||||||
result = i;
|
result = i;
|
||||||
selected = iBox;
|
selected = iBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
selected.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
int GetLowest(
|
||||||
|
XOHCL &bar,
|
||||||
|
XBoxZone &source[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = -1;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!bar.IsValid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(source);
|
||||||
|
if (!IsValidSize(count))
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone selected;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone iBox = source[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBoxValidForBar = IsBoxPlaceValidForBar(bar, iBox);
|
||||||
|
if (!isBoxValidForBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSet =
|
||||||
|
!selected.IsValid()
|
||||||
|
? true
|
||||||
|
: selected.lower > iBox.lower;
|
||||||
|
if (canSet)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
result = i;
|
||||||
|
selected = iBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -542,7 +542,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
cPeak.to = cTime;
|
cPeak.to = cTime;
|
||||||
drawer.DrawBox(cPeak);
|
// drawer.DrawBox(cPeak);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -551,7 +551,7 @@ class XCXCATBEASignaller : XCBase
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
cVale.to = cTime;
|
cVale.to = cTime;
|
||||||
drawer.DrawBox(cVale);
|
// drawer.DrawBox(cVale);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -702,8 +702,6 @@ class XCXCATBEASignaller : XCBase
|
|||||||
//
|
//
|
||||||
// Detect Signalling Zone ...
|
// Detect Signalling Zone ...
|
||||||
result = DetectSignalZone(
|
result = DetectSignalZone(
|
||||||
cPeak,
|
|
||||||
cVale,
|
|
||||||
helper,
|
helper,
|
||||||
drawer,
|
drawer,
|
||||||
detector,
|
detector,
|
||||||
|
|||||||
@@ -180,13 +180,13 @@ class XCXCATBEAPOIDrawer : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// MT ...
|
// MT ...
|
||||||
mtBullishPivotStyle = defaultBearishStyle;
|
mtBullishPivotStyle = defaultBullishStyle;
|
||||||
mtBearishPivotStyle = defaultBullishStyle;
|
mtBearishPivotStyle = defaultBearishStyle;
|
||||||
|
|
||||||
//
|
//
|
||||||
// OB ...
|
// OB ...
|
||||||
obBullishPivotStyle = defaultBearishStyle;
|
obBullishPivotStyle = defaultBullishStyle;
|
||||||
obBearishPivotStyle = defaultBullishStyle;
|
obBearishPivotStyle = defaultBearishStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -993,12 +993,155 @@ class XCXCATBEAPOIDrawer : public XCBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Protected ...
|
// Styling Tools ...
|
||||||
protected:
|
|
||||||
|
/**
|
||||||
|
* Apply Default Bullish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyBullishStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
// Props ...
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
ApplyPivotStyle(object, defaultBullishStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply Default Bearish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyBearishStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, defaultBearishStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply Peak Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyPeakPivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, peakPivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply Vale Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyValePivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, valePivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply MT Bullish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyMTBullishPivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, mtBullishPivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply MT Bearish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyMTBearishPivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, mtBearishPivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply OB Bullish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyOBBullishPivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, obBullishPivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply OB Bearish Style ...
|
||||||
|
*
|
||||||
|
* @param object: XCBaseObject pointer, Specified Object to Apply Styling ...
|
||||||
|
*/
|
||||||
|
void ApplyOBBearishPivotStyle(XCBoxObject *&object)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (object == NULL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ApplyPivotStyle(object, obBearishPivotStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply Pivot Style to Specified Object ...
|
||||||
|
*/
|
||||||
void ApplyPivotStyle(
|
void ApplyPivotStyle(
|
||||||
XCBoxObject *&object,
|
XCBoxObject *&object,
|
||||||
XCATBPivotStyle &style //
|
XCATBPivotStyle &style //
|
||||||
@@ -1016,6 +1159,12 @@ class XCXCATBEAPOIDrawer : public XCBase
|
|||||||
object.BoxStyle(style.style);
|
object.BoxStyle(style.style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Prrivate ...
|
// Prrivate ...
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -352,8 +352,6 @@ bool ToSignal(
|
|||||||
* @return ( bool )
|
* @return ( bool )
|
||||||
*/
|
*/
|
||||||
bool DetectSignalZone(
|
bool DetectSignalZone(
|
||||||
XBoxZone &peak,
|
|
||||||
XBoxZone &vale,
|
|
||||||
XCX121XCatbHelper *helper,
|
XCX121XCatbHelper *helper,
|
||||||
XCXCATBEAPOIDrawer *drawer,
|
XCXCATBEAPOIDrawer *drawer,
|
||||||
XCXCATBEAPOIDetector *detector,
|
XCXCATBEAPOIDetector *detector,
|
||||||
@@ -377,8 +375,6 @@ bool DetectSignalZone(
|
|||||||
//
|
//
|
||||||
// Validate Args ...
|
// Validate Args ...
|
||||||
result =
|
result =
|
||||||
peak.IsValid() &&
|
|
||||||
vale.IsValid() &&
|
|
||||||
helper != NULL &&
|
helper != NULL &&
|
||||||
detector != NULL &&
|
detector != NULL &&
|
||||||
barAnalyser != NULL;
|
barAnalyser != NULL;
|
||||||
@@ -406,9 +402,13 @@ bool DetectSignalZone(
|
|||||||
int p4IDX = p3IDX + 1;
|
int p4IDX = p3IDX + 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone iOB;
|
|
||||||
XBoxZone iMT;
|
|
||||||
int idx = -1;
|
int idx = -1;
|
||||||
|
XBoxZone iPeak;
|
||||||
|
XBoxZone iVale;
|
||||||
|
XBoxZone iOBBull;
|
||||||
|
XBoxZone iOBBear;
|
||||||
|
XBoxZone iMTBull;
|
||||||
|
XBoxZone iMTBear;
|
||||||
bool has = false;
|
bool has = false;
|
||||||
bool isBullish = false;
|
bool isBullish = false;
|
||||||
bool isBearish = false;
|
bool isBearish = false;
|
||||||
@@ -425,6 +425,154 @@ bool DetectSignalZone(
|
|||||||
ENUM_TIMEFRAMES iPeriod = NULL;
|
ENUM_TIMEFRAMES iPeriod = NULL;
|
||||||
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
ENUM_X_DIRECTION iDir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select MT Block ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// New MT Pivot Detected ...
|
||||||
|
if (detector.newMTBullishPivotDetected)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetYoungest(detector.mtBullishPivots);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
iMTBull = detector.mtBullishPivots[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (detector.newMTBearishPivotDetected)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetYoungest(detector.mtBearishPivots);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
iMTBear = detector.mtBearishPivots[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw MT ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish ...
|
||||||
|
has = iMTBull.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iMTBull.to = conditions.bars[zIDX].time;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer
|
||||||
|
.drawer
|
||||||
|
.DrawBox(
|
||||||
|
iMTBull,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
drawer.ApplyMTBullishPivotStyle(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish ...
|
||||||
|
has = iMTBear.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iMTBear.to = conditions.bars[zIDX].time;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer
|
||||||
|
.drawer
|
||||||
|
.DrawBox(
|
||||||
|
iMTBear,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
drawer.ApplyMTBearishPivotStyle(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Peak and Vale ...
|
||||||
|
// this used to Signalling Better ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Select Peak ...
|
||||||
|
idx = GetLowest(
|
||||||
|
conditions.bars[cIDX],
|
||||||
|
detector.peakPivots //
|
||||||
|
);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPeak = detector.peakPivots[idx];
|
||||||
|
iPeak.to = conditions.bars[zIDX].time;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Vale ...
|
||||||
|
idx = GetHighest(
|
||||||
|
conditions.bars[cIDX],
|
||||||
|
detector.valePivots //
|
||||||
|
);
|
||||||
|
if (IsValidIndex(idx))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iVale = detector.valePivots[idx];
|
||||||
|
iVale.to = conditions.bars[zIDX].time;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checkig Result ...
|
||||||
|
result =
|
||||||
|
iPeak.IsValid() &&
|
||||||
|
iVale.IsValid();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Peak and Vales ...
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Object Definitions ...
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Peak ...
|
||||||
|
has = drawer
|
||||||
|
.drawer
|
||||||
|
.DrawBox(
|
||||||
|
iPeak,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
drawer.ApplyPeakPivotStyle(iObj);
|
||||||
|
}
|
||||||
|
ZeroMemory(iObj);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Vale ...
|
||||||
|
has = drawer
|
||||||
|
.drawer
|
||||||
|
.DrawBox(
|
||||||
|
iVale,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
drawer.ApplyValePivotStyle(iObj);
|
||||||
|
}
|
||||||
|
ZeroMemory(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Signalling ...
|
// Signalling ...
|
||||||
if (result)
|
if (result)
|
||||||
@@ -878,9 +1026,9 @@ bool DetectSignalZone(
|
|||||||
// Conditions 1:
|
// Conditions 1:
|
||||||
// --------------
|
// --------------
|
||||||
// Descriptions:
|
// Descriptions:
|
||||||
// using Parabolic Sar Trending Start Conditions
|
// - [] Detect Parabolic Sar Start ...
|
||||||
// then attached others ..
|
// - [] Convert is to Box ...
|
||||||
// ----------------------------------
|
// ------------------------------------
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isCond1Bullish =
|
bool isCond1Bullish =
|
||||||
@@ -943,52 +1091,62 @@ bool DetectSignalZone(
|
|||||||
//
|
//
|
||||||
// Validate Some Other Requirements ...
|
// Validate Some Other Requirements ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
// We Have to Detect Youngest Order Block ...
|
// // We Have to Detect Youngest Order Block ...
|
||||||
// or Mitigation Block ...
|
// // or Mitigation Block ...
|
||||||
if (isCond1Bullish)
|
// if (isCond1Bullish)
|
||||||
{
|
// {
|
||||||
//
|
// // //
|
||||||
// OB ...
|
// // // OB ...
|
||||||
idx = GetYoungest(detector.obBullishPivots);
|
// // idx = GetYoungest(detector.obBullishPivots);
|
||||||
has = IsValidIndex(idx);
|
// // has = IsValidIndex(idx);
|
||||||
if (has)
|
// // if (has)
|
||||||
{
|
// // {
|
||||||
iOB = detector.obBullishPivots[idx];
|
// // iOB = detector.obBullishPivots[idx];
|
||||||
}
|
// // }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// MT ...
|
// // MT ...
|
||||||
idx = GetYoungest(detector.mtBullishPivots);
|
// idx = GetYoungest(detector.mtBullishPivots);
|
||||||
has = IsValidIndex(idx);
|
// has = IsValidIndex(idx);
|
||||||
if (has)
|
// if (has)
|
||||||
{
|
// {
|
||||||
iOB = detector.mtBullishPivots[idx];
|
// iOB = detector.mtBullishPivots[idx];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else if (isCond1Bearish)
|
// else if (isCond1Bearish)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
// OB
|
// // OB
|
||||||
idx = GetYoungest(detector.obBearishPivots);
|
// // idx = GetYoungest(detector.obBearishPivots);
|
||||||
has = IsValidIndex(idx);
|
// // has = IsValidIndex(idx);
|
||||||
if (has)
|
// // if (has)
|
||||||
{
|
// // {
|
||||||
iOB = detector.obBearishPivots[idx];
|
// // iOB = detector.obBearishPivots[idx];
|
||||||
}
|
// // }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// MT
|
// // MT
|
||||||
idx = GetYoungest(detector.mtBearishPivots);
|
// idx = GetYoungest(detector.mtBearishPivots);
|
||||||
has = IsValidIndex(idx);
|
// has = IsValidIndex(idx);
|
||||||
if (has)
|
// if (has)
|
||||||
{
|
// {
|
||||||
iMT = detector.mtBearishPivots[idx];
|
// iMT = detector.mtBearishPivots[idx];
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Now we can Do some Verifications Using these ...
|
// // Now we can Do some Verifications Using these ...
|
||||||
|
// result =
|
||||||
|
// isCond1Bullish
|
||||||
|
// ? iMT.IsBullish()
|
||||||
|
// : iMT.IsBearish();
|
||||||
|
// if (!result)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// isCond1Bullish = false;
|
||||||
|
// isCond1Bearish = false;
|
||||||
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// All Requirements based on Cond 1 ...
|
// All Requirements based on Cond 1 ...
|
||||||
@@ -1069,29 +1227,6 @@ bool DetectSignalZone(
|
|||||||
drawer.DrawBox(signalZone);
|
drawer.DrawBox(signalZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Draw MT and OB if Exists ...
|
|
||||||
if (iOB.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
drawer.DrawBox(
|
|
||||||
iOB,
|
|
||||||
conditions.bars[zIDX].time,
|
|
||||||
false, // Draw Middle ...
|
|
||||||
true // Ignore Type ...
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (iMT.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
drawer.DrawBox(
|
|
||||||
iMT,
|
|
||||||
conditions.bars[zIDX].time,
|
|
||||||
false, // Draw Middle ...
|
|
||||||
true // Ignore Type ...
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("Conditions ...");
|
Print("Conditions ...");
|
||||||
}
|
}
|
||||||
@@ -1104,8 +1239,12 @@ bool DetectSignalZone(
|
|||||||
// Cleanup Resources ...
|
// Cleanup Resources ...
|
||||||
|
|
||||||
//
|
//
|
||||||
iOB.Clean();
|
iPeak.Clean();
|
||||||
iMT.Clean();
|
iVale.Clean();
|
||||||
|
iOBBull.Clean();
|
||||||
|
iOBBear.Clean();
|
||||||
|
iMTBull.Clean();
|
||||||
|
iMTBear.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!result)
|
if (!result)
|
||||||
|
|||||||
Reference in New Issue
Block a user