last ...
This commit is contained in:
@@ -1458,6 +1458,11 @@ class XCBarAnalyser : public XCBase
|
|||||||
//
|
//
|
||||||
// Check Body ...
|
// Check Body ...
|
||||||
double rangePercent = GetBarRangePercent(bar);
|
double rangePercent = GetBarRangePercent(bar);
|
||||||
|
result = rangePercent > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double body = bar.GetBody();
|
double body = bar.GetBody();
|
||||||
|
|||||||
@@ -234,7 +234,8 @@ class XCBarArrowObject : public XCBaseObject
|
|||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
bar.IsValid()
|
bar.IsValid() &&
|
||||||
|
IsValid(name)
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -2872,6 +2873,162 @@ class XCTrendObject : public XCBaseObject
|
|||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creator ...
|
||||||
|
*
|
||||||
|
* @param chart_id: Long, Specified Chart ID ...
|
||||||
|
* @param window: Integer, Specified Chart Window ID ...
|
||||||
|
* @param rr: XRR instance Reference ...
|
||||||
|
* @param prefix: String ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool Create(
|
||||||
|
long chart_id,
|
||||||
|
int window,
|
||||||
|
XPoint &swings[],
|
||||||
|
bool useMinAsStart = true,
|
||||||
|
string prefix = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(swings);
|
||||||
|
result =
|
||||||
|
count >= 2 &&
|
||||||
|
IsValidSize(count);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double min = 0;
|
||||||
|
datetime minAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
double max = 0;
|
||||||
|
datetime maxAt = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Etract Min/Max ...
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XPoint iPoint = swings[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!iPoint.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iPoint.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSetMin =
|
||||||
|
min == 0
|
||||||
|
? true
|
||||||
|
: min > iPoint.value;
|
||||||
|
if (canSetMin)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
minAt = iPoint.at;
|
||||||
|
min = iPoint.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool canSetMax =
|
||||||
|
max == 0
|
||||||
|
? true
|
||||||
|
: max < iPoint.value;
|
||||||
|
if (canSetMax)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
maxAt = iPoint.at;
|
||||||
|
max = iPoint.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iPoint.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double first =
|
||||||
|
useMinAsStart
|
||||||
|
? min
|
||||||
|
: max;
|
||||||
|
datetime firstTime =
|
||||||
|
useMinAsStart
|
||||||
|
? minAt
|
||||||
|
: maxAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
double second =
|
||||||
|
useMinAsStart
|
||||||
|
? max
|
||||||
|
: min;
|
||||||
|
datetime secondTime =
|
||||||
|
useMinAsStart
|
||||||
|
? maxAt
|
||||||
|
: minAt;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Points ...
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
first > 0 &&
|
||||||
|
second > 0 &&
|
||||||
|
(useMinAsStart
|
||||||
|
? first <= second
|
||||||
|
: first >= second) &&
|
||||||
|
IsSpecifiedValid(firstTime) &&
|
||||||
|
IsSpecifiedValid(secondTime)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION dir =
|
||||||
|
useMinAsStart
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
string name = "XTRND" + ToString(dir) + "_" + ToString(first) + "_" + ToString(second);
|
||||||
|
if (IsValid(prefix))
|
||||||
|
{
|
||||||
|
name = prefix + "_" + name;
|
||||||
|
}
|
||||||
|
string nameMD5 = ToMD5(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = mTrend.Create(
|
||||||
|
chart_id,
|
||||||
|
name,
|
||||||
|
window,
|
||||||
|
firstTime,
|
||||||
|
first,
|
||||||
|
secondTime,
|
||||||
|
second //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ObjName(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creator ...
|
* Creator ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Classes/x-saherelm.base.class.mq5"
|
#include "../Classes/x-saherelm.base.class.mq5"
|
||||||
#include "../Classes/x-saherelm.x-cobject.class.mq5"
|
#include "../Classes/x-saherelm.x-cobject.class.mq5"
|
||||||
|
#include "../Libraries/x-saherelm.x-poi.extensions.lib.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Definitions ...
|
// Definitions ...
|
||||||
@@ -2872,6 +2873,66 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Trend Line Object ...
|
||||||
|
*
|
||||||
|
* @param swings: XSwingPoint instance Collection ...
|
||||||
|
* @param useMinAsStart: Specified Min Value as Start ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CreateTrend(
|
||||||
|
XPoint &swings[],
|
||||||
|
XCTrendObject *&object,
|
||||||
|
bool useMinAsStart = true //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
object = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(swings) >= 2 &&
|
||||||
|
IsValidSize(ArraySize(swings));
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string prefix = Prefix();
|
||||||
|
long chartID = ChartIdentification();
|
||||||
|
int window = SubWindowIdentification();
|
||||||
|
|
||||||
|
//
|
||||||
|
object = new XCTrendObject();
|
||||||
|
result = object.Create(
|
||||||
|
chartID,
|
||||||
|
window,
|
||||||
|
swings,
|
||||||
|
useMinAsStart,
|
||||||
|
prefix //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
color clrTrend = useMinAsStart
|
||||||
|
? SwingLowColor()
|
||||||
|
: SwingHighColor();
|
||||||
|
object.TrendColor(clrTrend);
|
||||||
|
object.TrendRayRight(true);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Consolidation Zone Object ...
|
* Create Consolidation Zone Object ...
|
||||||
*
|
*
|
||||||
@@ -2929,7 +2990,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
/**
|
/**
|
||||||
* Create Bar Object ...
|
* Create Bar Object ...
|
||||||
*
|
*
|
||||||
* @param bar: XOHCL instance Reference ..
|
* @param bar: XOHCL instance Reference ...
|
||||||
* @param object: XCOHCLObject pointer Reference ..
|
* @param object: XCOHCLObject pointer Reference ..
|
||||||
* @param to: Datetime ...
|
* @param to: Datetime ...
|
||||||
*
|
*
|
||||||
@@ -3030,6 +3091,84 @@ class XCPOIDrawer : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Bar Arrow Object ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance Reference ...
|
||||||
|
* @param priceType: ENUM_X_PRICE member ...
|
||||||
|
* @param arrow: int, Arrow Code ...
|
||||||
|
* @param clr: color, Arro Color ...
|
||||||
|
* @param width: int, Arrow Width ...
|
||||||
|
* @param anchor: ENUM_ARROW_ANCHOR, anchor of Arrow ...
|
||||||
|
* @param name: string, name of Arrow ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool CreateBarArrow(
|
||||||
|
XOHCL &bar,
|
||||||
|
XCBarArrowObject *&object,
|
||||||
|
ENUM_X_PRICE priceType,
|
||||||
|
int arrow = 159,
|
||||||
|
color clr = clrYellow,
|
||||||
|
int width = 3,
|
||||||
|
ENUM_ARROW_ANCHOR anchor = ANCHOR_BOTTOM,
|
||||||
|
string name = NULL //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
object = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
string barTag = bar.GetTag(name);
|
||||||
|
|
||||||
|
//
|
||||||
|
string prefix = Prefix();
|
||||||
|
long chartID = ChartIdentification();
|
||||||
|
int window = SubWindowIdentification();
|
||||||
|
|
||||||
|
//
|
||||||
|
color mBullishColor = BarBullishColor();
|
||||||
|
color mBearishColor = BarBearishColor();
|
||||||
|
|
||||||
|
//
|
||||||
|
prefix =
|
||||||
|
(IsValid(prefix)
|
||||||
|
? prefix + "_"
|
||||||
|
: prefix) +
|
||||||
|
barTag;
|
||||||
|
|
||||||
|
//
|
||||||
|
object = new XCBarArrowObject();
|
||||||
|
result = object
|
||||||
|
.CreateByBar(
|
||||||
|
chartID,
|
||||||
|
prefix,
|
||||||
|
window,
|
||||||
|
arrow,
|
||||||
|
bar,
|
||||||
|
priceType //
|
||||||
|
);
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
object.ArrowColor(clr);
|
||||||
|
object.ArrowWidth(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Specific Box on Chart ...
|
* Create Specific Box on Chart ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,346 @@
|
|||||||
|
//
|
||||||
|
// Detect Inside Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XCFVG *insideFVG;
|
||||||
|
bool hasInsideFVG = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCOrderBlock *insideOB;
|
||||||
|
bool hasInsideOB = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSupplyZone *insideSupply;
|
||||||
|
bool hasInsideSupply = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCDemandZone *insideDemand;
|
||||||
|
bool hasInsideDemand = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCSupportZone *insideSupport;
|
||||||
|
bool hasInsideSupport = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XCResistanceZone *insideResistnce;
|
||||||
|
bool hasInsideResistance = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect PullBack ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION pullbackDir;
|
||||||
|
bool hasPullBack = mXWZBarAnalyser.HasPullBack(
|
||||||
|
pullbackDir,
|
||||||
|
iBar //
|
||||||
|
);
|
||||||
|
bool hasBullishPullBack =
|
||||||
|
hasPullBack &&
|
||||||
|
IsBullish(pullbackDir);
|
||||||
|
bool hasBearishPullBack =
|
||||||
|
hasPullBack &&
|
||||||
|
IsBearish(pullbackDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect PinBar ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION pinBarDir;
|
||||||
|
bool hasPinBar = mXWZBarAnalyser.IsPinBar(
|
||||||
|
iBar,
|
||||||
|
pinBarDir,
|
||||||
|
0 //
|
||||||
|
);
|
||||||
|
bool hasBullishPinBar =
|
||||||
|
hasPinBar &&
|
||||||
|
IsBullish(pinBarDir);
|
||||||
|
bool hasBearishPinBar =
|
||||||
|
hasPinBar &&
|
||||||
|
IsBearish(pinBarDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detect Order Block ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL obBar;
|
||||||
|
XCOrderBlock *ob;
|
||||||
|
ENUM_X_DIRECTION obDir;
|
||||||
|
bool hasOB = mXWZBarAnalyser.HasOrderBlock(
|
||||||
|
iBar,
|
||||||
|
obBar,
|
||||||
|
obDir //
|
||||||
|
);
|
||||||
|
bool hasBullishOB =
|
||||||
|
hasOB &&
|
||||||
|
IsBullish(obDir);
|
||||||
|
bool hasBearishOB =
|
||||||
|
hasOB &&
|
||||||
|
IsBearish(obDir);
|
||||||
|
if (hasOB)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ob = new XCOrderBlock();
|
||||||
|
bool isInited = ob.Init(obBar, obDir);
|
||||||
|
if (isInited)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION forDir = ob.GetDirection();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check OB Not Activated ...
|
||||||
|
XOHCL activationBar;
|
||||||
|
bool isObActivationBarBodyIn = false;
|
||||||
|
bool isActivated = ob.IsActivated(
|
||||||
|
forDir,
|
||||||
|
activationBar,
|
||||||
|
isObActivationBarBodyIn,
|
||||||
|
false,
|
||||||
|
_Period //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isActivated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
hasOB = false;
|
||||||
|
obBar.Clean();
|
||||||
|
ZeroMemory(ob);
|
||||||
|
hasBullishOB = false;
|
||||||
|
hasBearishOB = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasBullishPinBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBarArrowObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateBarArrow(
|
||||||
|
iBar,
|
||||||
|
iObj,
|
||||||
|
X_PRICE_LOW,
|
||||||
|
159,
|
||||||
|
clrAqua,
|
||||||
|
3,
|
||||||
|
ANCHOR_BOTTOM,
|
||||||
|
"BULLPULL" //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasBearishPinBar)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBarArrowObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateBarArrow(
|
||||||
|
iBar,
|
||||||
|
iObj,
|
||||||
|
X_PRICE_HIGH,
|
||||||
|
159,
|
||||||
|
clrMagenta,
|
||||||
|
3,
|
||||||
|
ANCHOR_TOP,
|
||||||
|
"BEARPULL" //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasOB)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer.CreateOrderBlock(
|
||||||
|
ob,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = -1;
|
||||||
|
int count = 0;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION trend =
|
||||||
|
IsValid(lastBullishTrend) &&
|
||||||
|
lastBullishTrend > lastBearishTrend
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: IsValid(lastBearishTrend) &&
|
||||||
|
lastBearishTrend > lastBullishTrend
|
||||||
|
? X_DIRECTION_BEARISH
|
||||||
|
: X_DIRECTION_NONE;
|
||||||
|
bool hasTrend = HasDirection(trend);
|
||||||
|
bool hasBullishTrend = hasTrend &&
|
||||||
|
IsBullish(trend);
|
||||||
|
bool hasBearishTrend = hasTrend &&
|
||||||
|
IsBearish(trend);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
has = hasBullishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
has = hasBearishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gap ...
|
||||||
|
has = hasBullishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
has = hasBearishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply Zone ...
|
||||||
|
has = hasBearishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance Zone ...
|
||||||
|
has = hasBearishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Demand Zone ...
|
||||||
|
has = hasBullishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support Zone ...
|
||||||
|
has = hasBullishTrend;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Draw Inside Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideOB)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateOrderBlock(
|
||||||
|
insideOB,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideFVG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBaseObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateFairValueGap(
|
||||||
|
insideFVG,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideSupply)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupplyZoneObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateSupplyZone(
|
||||||
|
insideSupply,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideDemand)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCDemandZoneObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateDemandZone(
|
||||||
|
insideDemand,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideSupport)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZoneObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateSupportZone(
|
||||||
|
insideSupport,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (hasInsideResistance)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZoneObject *iObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer
|
||||||
|
.CreateResistanceZone(
|
||||||
|
insideResistnce,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
//
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(iObj);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2117,3 +2117,250 @@ bool IsReject(
|
|||||||
mObjects.Add(iObj);
|
mObjects.Add(iObj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//
|
||||||
|
XPOIState state;
|
||||||
|
mXWZPOIDetector.GetState(state);
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION trend =
|
||||||
|
IsValid(lastBullishTrend) &&
|
||||||
|
lastBullishTrend > lastBearishTrend
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: IsValid(lastBearishTrend) &&
|
||||||
|
lastBearishTrend > lastBullishTrend
|
||||||
|
? X_DIRECTION_BEARISH
|
||||||
|
: X_DIRECTION_NONE;
|
||||||
|
bool hasTrend = HasDirection(trend);
|
||||||
|
bool hasBullishTrend = hasTrend &&
|
||||||
|
IsBullish(trend);
|
||||||
|
bool hasBearishTrend = hasTrend &&
|
||||||
|
IsBearish(trend);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
has = hasBullishTrend &&
|
||||||
|
state.HasBullishOrderBlocks();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.bullishOrderBlocks,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetLowest(tmps);
|
||||||
|
hasInsideOB = IsValidIndex(idx);
|
||||||
|
if (hasInsideOB)
|
||||||
|
{
|
||||||
|
insideOB = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
has = hasBearishTrend &&
|
||||||
|
state.HasBearishOrderBlocks();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCOrderBlock *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.bearishOrderBlocks,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetHighest(tmps);
|
||||||
|
hasInsideOB = IsValidIndex(idx);
|
||||||
|
if (hasInsideOB)
|
||||||
|
{
|
||||||
|
insideOB = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fair Value Gap ...
|
||||||
|
has = hasBullishTrend &&
|
||||||
|
state.HasBullishFairValueGaps();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.bullishFairValueGaps,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetLowest(tmps);
|
||||||
|
hasInsideFVG = IsValidIndex(idx);
|
||||||
|
if (hasInsideFVG)
|
||||||
|
{
|
||||||
|
insideFVG = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
has = hasBearishTrend &&
|
||||||
|
state.HasBearishFairValueGaps();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCFVG *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.bearishFairValueGaps,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetHighest(tmps);
|
||||||
|
hasInsideFVG = IsValidIndex(idx);
|
||||||
|
if (hasInsideFVG)
|
||||||
|
{
|
||||||
|
insideFVG = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Supply Zone ...
|
||||||
|
has = hasBearishTrend &&
|
||||||
|
state.HasSupplyZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupplyZone *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.supplyZones,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetHighest(tmps);
|
||||||
|
hasInsideSupply = IsValidIndex(idx);
|
||||||
|
if (hasInsideSupply)
|
||||||
|
{
|
||||||
|
insideSupply = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Resistance Zone ...
|
||||||
|
has = hasBearishTrend &&
|
||||||
|
state.HasResistanceZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCResistanceZone *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.resistanceZones,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetHighest(tmps);
|
||||||
|
hasInsideResistance = IsValidIndex(idx);
|
||||||
|
if (hasInsideResistance)
|
||||||
|
{
|
||||||
|
insideResistnce = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Demand Zone ...
|
||||||
|
has = hasBullishTrend &&
|
||||||
|
state.HasDemandZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCDemandZone *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.demandZones,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetLowest(tmps);
|
||||||
|
hasInsideDemand = IsValidIndex(idx);
|
||||||
|
if (hasInsideDemand)
|
||||||
|
{
|
||||||
|
insideDemand = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Support Zone ...
|
||||||
|
has = hasBullishTrend &&
|
||||||
|
state.HasSupportZones();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCSupportZone *tmps[];
|
||||||
|
count = ExtractInsideZones(
|
||||||
|
iBar,
|
||||||
|
state.supportZones,
|
||||||
|
tmps //
|
||||||
|
);
|
||||||
|
has = IsValidSize(count);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetLowest(tmps);
|
||||||
|
hasInsideSupport = IsValidIndex(idx);
|
||||||
|
if (hasInsideSupport)
|
||||||
|
{
|
||||||
|
insideSupport = tmps[idx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(tmps);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1149,6 +1149,83 @@ else if (isPriceRejected)
|
|||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//
|
||||||
|
XPoint llPoint;
|
||||||
|
llPoint.value = iLL;
|
||||||
|
llPoint.at = iLLTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
XPoint hhPoint;
|
||||||
|
hhPoint.value = iHH;
|
||||||
|
hhPoint.at = iHHTime;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPoint llSwings[];
|
||||||
|
AddRef(
|
||||||
|
llPoint,
|
||||||
|
llSwings //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
llPoint.at = iHHTime;
|
||||||
|
AddRef(
|
||||||
|
llPoint,
|
||||||
|
llSwings //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
XPoint hhSwings[];
|
||||||
|
|
||||||
|
//
|
||||||
|
hhPoint.at = iLLTime;
|
||||||
|
AddRef(
|
||||||
|
hhPoint,
|
||||||
|
hhSwings //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
hhPoint.at = iHHTime;
|
||||||
|
AddRef(
|
||||||
|
hhPoint,
|
||||||
|
hhSwings //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
XCTrendObject *llTrendObj;
|
||||||
|
bool isCreated = mXWZPOIDrawer.CreateTrend(
|
||||||
|
llSwings,
|
||||||
|
llTrendObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(llTrendObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XCTrendObject *hhTrendObj;
|
||||||
|
isCreated = mXWZPOIDrawer.CreateTrend(
|
||||||
|
hhSwings,
|
||||||
|
hhTrendObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
mXWZDrawnObjects.Add(hhTrendObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(llSwings);
|
||||||
|
Clean(hhSwings);
|
||||||
|
llPoint.Clean();
|
||||||
|
hhPoint.Clean();
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -3588,6 +3588,45 @@ struct XMarketParser
|
|||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
struct XPoint
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
double value;
|
||||||
|
datetime at;
|
||||||
|
|
||||||
|
//
|
||||||
|
XPoint()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
//
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
value = 0;
|
||||||
|
at = NULL;
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
return value > 0 &&
|
||||||
|
IsValid(at);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Specified Swing Point ...
|
// Specified Swing Point ...
|
||||||
struct XSwingPoint
|
struct XSwingPoint
|
||||||
|
|||||||
@@ -2006,6 +2006,77 @@ void SortZones(
|
|||||||
Clean(tmpItems);
|
Clean(tmpItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extract all Zones Which provided bar is Inside it ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
int ExtractInsideZones(
|
||||||
|
XOHCL &bar, // Bar ...
|
||||||
|
T *&zones[], // Source of Zones ...
|
||||||
|
T *&dest[] // Dest (all inside Zones) ...
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(zones);
|
||||||
|
bool isValid = bar.IsValid() &&
|
||||||
|
IsValidSize(count);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
T *iZone = zones[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isHighInside = IsInside(
|
||||||
|
bar.high,
|
||||||
|
iZone //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLowInside = IsInside(
|
||||||
|
bar.low,
|
||||||
|
iZone //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isInside =
|
||||||
|
isLowInside &&
|
||||||
|
isHighInside;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isInside)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
iZone,
|
||||||
|
dest //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(iZone);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(dest);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
template <typename T>
|
template <typename T>
|
||||||
int FilterZones(
|
int FilterZones(
|
||||||
|
|||||||
@@ -1094,9 +1094,29 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
ZeroMemory(newAnalyseFVG);
|
ZeroMemory(newAnalyseFVG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Reading Trand Line Value ...
|
||||||
|
double zValue = workingZone.GetOrderFlowTrendLinePrice(
|
||||||
|
zIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
double cValue = workingZone.GetOrderFlowTrendLinePrice(
|
||||||
|
cIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
double pValue = workingZone.GetOrderFlowTrendLinePrice(
|
||||||
|
pIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
double ppValue = workingZone.GetOrderFlowTrendLinePrice(
|
||||||
|
ppIndex,
|
||||||
|
period //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Implement Trend Line Trading Senario ...
|
// TODO: Implement Trend Line Trading Senario ...
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO: Implement Quarter Line Trading Senario ...
|
// TODO: Implement Quarter Line Trading Senario ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user