last ...
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
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();
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user