add support of Consolidation Zone ibside XPOIDetector and XPOIState ...
This commit is contained in:
@@ -447,6 +447,191 @@ class XCBarAnalyser : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HasConsolidationZone(
|
||||||
|
XOHCL &bar,
|
||||||
|
XConsolidationZone &zone,
|
||||||
|
int minLoopback = 3,
|
||||||
|
double range = 50,
|
||||||
|
ENUM_APPLIED_PRICE upperAppliedTo = PRICE_HIGH,
|
||||||
|
ENUM_APPLIED_PRICE lowerAppliedTo = PRICE_LOW //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
zone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
result = bar.IsValid() &&
|
||||||
|
minLoopback > 0 &&
|
||||||
|
range > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double points = GetPoints(bar.symbol);
|
||||||
|
int index = bar.Index() + 1;
|
||||||
|
int length = minLoopback;
|
||||||
|
|
||||||
|
//
|
||||||
|
double upperPrice[];
|
||||||
|
int upperPriceCount = FillPrice(
|
||||||
|
upperPrice,
|
||||||
|
upperAppliedTo,
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
index,
|
||||||
|
length //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double lowerPrice[];
|
||||||
|
int lowerPriceCount = FillPrice(
|
||||||
|
lowerPrice,
|
||||||
|
lowerAppliedTo,
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
index,
|
||||||
|
length //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = upperPriceCount == lowerPriceCount &&
|
||||||
|
lowerPriceCount == length;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(upperPrice);
|
||||||
|
Clean(lowerPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double upper = upperPrice[ArrayMaximum(upperPrice)];
|
||||||
|
double lower = lowerPrice[ArrayMinimum(lowerPrice)];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishBreake =
|
||||||
|
bar.low > lower &&
|
||||||
|
bar.high > upper &&
|
||||||
|
bar.GetUp() > upper;
|
||||||
|
bool isBearishBreake =
|
||||||
|
bar.high < upper &&
|
||||||
|
bar.low < lower &&
|
||||||
|
bar.GetDown() < lower;
|
||||||
|
result = isBullishBreake ||
|
||||||
|
isBearishBreake;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(upperPrice);
|
||||||
|
Clean(lowerPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double delta = upper - lower;
|
||||||
|
result = delta <= range * points;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Clean(upperPrice);
|
||||||
|
Clean(lowerPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
while (delta <= range * points)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
length++;
|
||||||
|
|
||||||
|
//
|
||||||
|
upperPriceCount = FillPrice(
|
||||||
|
upperPrice,
|
||||||
|
upperAppliedTo,
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
index,
|
||||||
|
length //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
lowerPriceCount = FillPrice(
|
||||||
|
lowerPrice,
|
||||||
|
lowerAppliedTo,
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
index,
|
||||||
|
length //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isValid = upperPriceCount == lowerPriceCount &&
|
||||||
|
lowerPriceCount == length;
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double iUpper = upperPrice[ArrayMaximum(upperPrice)];
|
||||||
|
double iLower = lowerPrice[ArrayMinimum(lowerPrice)];
|
||||||
|
|
||||||
|
//
|
||||||
|
delta = iUpper - iLower;
|
||||||
|
if (delta <= range * points)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = iUpper;
|
||||||
|
lower = iLower;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(upperPrice);
|
||||||
|
Clean(lowerPrice);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Zone ...
|
||||||
|
zone.upper = upper;
|
||||||
|
zone.lower = lower;
|
||||||
|
zone.symbol = bar.symbol;
|
||||||
|
zone.period = bar.period;
|
||||||
|
zone.to = iTime(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
bar.Index() + 1 //
|
||||||
|
);
|
||||||
|
zone.from = iTime(
|
||||||
|
bar.symbol,
|
||||||
|
bar.period,
|
||||||
|
bar.Index() + length //
|
||||||
|
);
|
||||||
|
zone.dir = isBullishBreake
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = zone.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
zone.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Bar Has Bullish Trend or not ...
|
* Check Bar Has Bullish Trend or not ...
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1594,9 +1594,9 @@ class XCConsolidationZoneObject : public XCBaseObject
|
|||||||
chart_id,
|
chart_id,
|
||||||
name,
|
name,
|
||||||
window,
|
window,
|
||||||
zone.From(),
|
zone.from,
|
||||||
zone.upper,
|
zone.upper,
|
||||||
TimeCurrent(),
|
zone.to,
|
||||||
zone.lower //
|
zone.lower //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -405,6 +405,100 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
mFairValueGapSameBars = value;
|
mFairValueGapSameBars = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Minimum Length of Cnsolidation Zone ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int ConsolidationZoneMinLoopback()
|
||||||
|
{
|
||||||
|
return mConsolidationZoneMinLoopback;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Minimum Length of Cnsolidation Zone ...
|
||||||
|
*
|
||||||
|
* @param value: int ...
|
||||||
|
*/
|
||||||
|
void ConsolidationZoneMinLoopback(int value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 1)
|
||||||
|
{
|
||||||
|
value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mConsolidationZoneMinLoopback = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Consolidation Zone Range in Point ...
|
||||||
|
*
|
||||||
|
* @return ( double )
|
||||||
|
*/
|
||||||
|
double ConsolidationZoneRangeInPoint()
|
||||||
|
{
|
||||||
|
return mConsolidationZoneRangeInPoint;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Consolidation Zone Range in Point ...
|
||||||
|
*
|
||||||
|
* @param value: double
|
||||||
|
*/
|
||||||
|
void ConsolidationZoneRangeInPoint(double value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (value < 50)
|
||||||
|
{
|
||||||
|
value = 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
mConsolidationZoneRangeInPoint = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Consolidation Zone Upper Applied To ...
|
||||||
|
*
|
||||||
|
* @return ( ENUM_APPLIED_PRICE )
|
||||||
|
*/
|
||||||
|
ENUM_APPLIED_PRICE ConsolidationZonesLowerAppliedTo()
|
||||||
|
{
|
||||||
|
return mConsolidationZonesLowerAppliedTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Consolidation Zone Upper Applied To ...
|
||||||
|
*
|
||||||
|
* @param value: ENUM_APPLIED_PRICE
|
||||||
|
*/
|
||||||
|
void ConsolidationZonesLowerAppliedTo(ENUM_APPLIED_PRICE value = PRICE_LOW)
|
||||||
|
{
|
||||||
|
mConsolidationZonesLowerAppliedTo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Consolidation Zone Lower Applied To ...
|
||||||
|
*
|
||||||
|
* @return ( ENUM_APPLIED_PRICE )
|
||||||
|
*/
|
||||||
|
ENUM_APPLIED_PRICE ConsolidationZonesUpperAppliedTo()
|
||||||
|
{
|
||||||
|
return mConsolidationZonesUpperAppliedTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Consolidation Zone Lower Applied To ...
|
||||||
|
*
|
||||||
|
* @param value: ENUM_APPLIED_PRICE
|
||||||
|
*/
|
||||||
|
void ConsolidationZonesUpperAppliedTo(ENUM_APPLIED_PRICE value = PRICE_HIGH)
|
||||||
|
{
|
||||||
|
mConsolidationZonesUpperAppliedTo = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
@@ -426,6 +520,10 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
SupResRangeAsStart(true);
|
SupResRangeAsStart(true);
|
||||||
RejectionShadowPercent(70);
|
RejectionShadowPercent(70);
|
||||||
MaxAllowedLoopbackForInit(578);
|
MaxAllowedLoopbackForInit(578);
|
||||||
|
ConsolidationZoneMinLoopback(5);
|
||||||
|
ConsolidationZoneRangeInPoint(50);
|
||||||
|
ConsolidationZonesLowerAppliedTo(PRICE_LOW);
|
||||||
|
ConsolidationZonesUpperAppliedTo(PRICE_HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -560,6 +658,14 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
false //
|
false //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Consolidation Zone ...
|
||||||
|
DetectConsolidationZone(
|
||||||
|
iBar,
|
||||||
|
iEvent,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
canContinue =
|
canContinue =
|
||||||
has &&
|
has &&
|
||||||
@@ -1027,6 +1133,20 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
has = DetectConsolidationZone(
|
||||||
|
iBar,
|
||||||
|
iEvent //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
iEvent,
|
||||||
|
events //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
iBar.Clean();
|
iBar.Clean();
|
||||||
mLock = false;
|
mLock = false;
|
||||||
@@ -1169,6 +1289,24 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
state.bearishFairValueGaps //
|
state.bearishFairValueGaps //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
mConsolidationZones,
|
||||||
|
state.consolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
mBullishConsolidationZones,
|
||||||
|
state.bullishConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
mBearishConsolidationZones,
|
||||||
|
state.bearishConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1193,51 +1331,58 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
void CleanCollections()
|
void CleanCollections()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
Clean(mEventListeners);
|
|
||||||
Clean(mSwings);
|
Clean(mSwings);
|
||||||
Clean(mSwingLows);
|
Clean(mSwingLows);
|
||||||
Clean(mSwingHighs);
|
Clean(mSwingHighs);
|
||||||
Clean(mMomentumBars);
|
|
||||||
Clean(mBullishMomentumBars);
|
|
||||||
Clean(mBearishMomentumBars);
|
|
||||||
Clean(mRejectionBars);
|
|
||||||
Clean(mBullishRejectionBars);
|
|
||||||
Clean(mBearishRejectionBars);
|
|
||||||
Clean(mSupportZones);
|
|
||||||
Clean(mDemandZones);
|
Clean(mDemandZones);
|
||||||
Clean(mSupplyZones);
|
Clean(mSupplyZones);
|
||||||
Clean(mResistanceZones);
|
|
||||||
Clean(mFairValueGaps);
|
|
||||||
Clean(mBullishFairValueGaps);
|
|
||||||
Clean(mBearishFairValueGaps);
|
|
||||||
Clean(mOrderBlocks);
|
Clean(mOrderBlocks);
|
||||||
|
Clean(mMomentumBars);
|
||||||
|
Clean(mSupportZones);
|
||||||
|
Clean(mRejectionBars);
|
||||||
|
Clean(mFairValueGaps);
|
||||||
|
Clean(mEventListeners);
|
||||||
|
Clean(mResistanceZones);
|
||||||
Clean(mBullishOrderBlocks);
|
Clean(mBullishOrderBlocks);
|
||||||
Clean(mBearishOrderBlocks);
|
Clean(mBearishOrderBlocks);
|
||||||
|
Clean(mConsolidationZones);
|
||||||
|
Clean(mBullishMomentumBars);
|
||||||
|
Clean(mBearishMomentumBars);
|
||||||
|
Clean(mBullishRejectionBars);
|
||||||
|
Clean(mBearishRejectionBars);
|
||||||
|
Clean(mBullishFairValueGaps);
|
||||||
|
Clean(mBearishFairValueGaps);
|
||||||
|
Clean(mBullishConsolidationZones);
|
||||||
|
Clean(mBearishConsolidationZones);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void ReverseCollections() {
|
void ReverseCollections()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
ArrayReverse(mEventListeners);
|
|
||||||
ArrayReverse(mSwings);
|
ArrayReverse(mSwings);
|
||||||
ArrayReverse(mSwingLows);
|
ArrayReverse(mSwingLows);
|
||||||
ArrayReverse(mSwingHighs);
|
ArrayReverse(mSwingHighs);
|
||||||
ArrayReverse(mMomentumBars);
|
|
||||||
ArrayReverse(mBullishMomentumBars);
|
|
||||||
ArrayReverse(mBearishMomentumBars);
|
|
||||||
ArrayReverse(mRejectionBars);
|
|
||||||
ArrayReverse(mBullishRejectionBars);
|
|
||||||
ArrayReverse(mBearishRejectionBars);
|
|
||||||
ArrayReverse(mSupportZones);
|
|
||||||
ArrayReverse(mDemandZones);
|
ArrayReverse(mDemandZones);
|
||||||
ArrayReverse(mSupplyZones);
|
ArrayReverse(mSupplyZones);
|
||||||
ArrayReverse(mResistanceZones);
|
|
||||||
ArrayReverse(mFairValueGaps);
|
|
||||||
ArrayReverse(mBullishFairValueGaps);
|
|
||||||
ArrayReverse(mBearishFairValueGaps);
|
|
||||||
ArrayReverse(mOrderBlocks);
|
ArrayReverse(mOrderBlocks);
|
||||||
|
ArrayReverse(mMomentumBars);
|
||||||
|
ArrayReverse(mSupportZones);
|
||||||
|
ArrayReverse(mRejectionBars);
|
||||||
|
ArrayReverse(mFairValueGaps);
|
||||||
|
ArrayReverse(mEventListeners);
|
||||||
|
ArrayReverse(mResistanceZones);
|
||||||
ArrayReverse(mBullishOrderBlocks);
|
ArrayReverse(mBullishOrderBlocks);
|
||||||
ArrayReverse(mBearishOrderBlocks);
|
ArrayReverse(mBearishOrderBlocks);
|
||||||
|
ArrayReverse(mConsolidationZones);
|
||||||
|
ArrayReverse(mBullishMomentumBars);
|
||||||
|
ArrayReverse(mBearishMomentumBars);
|
||||||
|
ArrayReverse(mBullishRejectionBars);
|
||||||
|
ArrayReverse(mBearishRejectionBars);
|
||||||
|
ArrayReverse(mBullishFairValueGaps);
|
||||||
|
ArrayReverse(mBearishFairValueGaps);
|
||||||
|
ArrayReverse(mBullishConsolidationZones);
|
||||||
|
ArrayReverse(mBearishConsolidationZones);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1374,6 +1519,24 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
maxAllowed //
|
maxAllowed //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBullishConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
CleanupArray(
|
||||||
|
mBearishConsolidationZones,
|
||||||
|
maxAllowed //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2928,6 +3091,160 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detect Consolidation Zones ...
|
||||||
|
*
|
||||||
|
* @param bar: XOHCL instance ...
|
||||||
|
* @param reversal: boolean reversal add to collection ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool DetectConsolidationZone(
|
||||||
|
XOHCL &bar,
|
||||||
|
ENUM_XPOI_EVENTS &state,
|
||||||
|
bool reversal = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
state = X_POI_EVENT_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
XConsolidationZone cZone;
|
||||||
|
result = mBarAnalyser.HasConsolidationZone(
|
||||||
|
bar,
|
||||||
|
cZone,
|
||||||
|
mConsolidationZoneMinLoopback,
|
||||||
|
mConsolidationZoneRangeInPoint,
|
||||||
|
mConsolidationZonesUpperAppliedTo,
|
||||||
|
mConsolidationZonesLowerAppliedTo //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(cZone.dir);
|
||||||
|
bool isBearish = IsBearish(cZone.dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
int idx = FindIndex(
|
||||||
|
cZone,
|
||||||
|
mConsolidationZones //
|
||||||
|
);
|
||||||
|
result = !IsValidIndex(idx);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (reversal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayReverse(mConsolidationZones);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayReverse(mConsolidationZones);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mConsolidationZones //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (isBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add Swings ...
|
||||||
|
if (reversal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayReverse(mBullishConsolidationZones);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mBullishConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayReverse(mBullishConsolidationZones);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mBullishConsolidationZones //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (isBearish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add Swings ...
|
||||||
|
if (reversal)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ArrayReverse(mBearishConsolidationZones);
|
||||||
|
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mBearishConsolidationZones //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
ArrayReverse(mBearishConsolidationZones);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
cZone,
|
||||||
|
mBearishConsolidationZones //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
state =
|
||||||
|
IsBullish(cZone.dir)
|
||||||
|
? X_BULLISH_CONSOLIDATION_ZONE_DETECTED
|
||||||
|
: X_BEARISH_CONSOLIDATION_ZONE_DETECTED;
|
||||||
|
|
||||||
|
//
|
||||||
|
cZone.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
private:
|
private:
|
||||||
//
|
//
|
||||||
@@ -2991,6 +3308,15 @@ class XCPOIDetector : public XCBaseAlert
|
|||||||
XCOrderBlock *mBearishOrderBlocks[]; // Holds Founded Bearish OrderBlocks ...
|
XCOrderBlock *mBearishOrderBlocks[]; // Holds Founded Bearish OrderBlocks ...
|
||||||
int mOrderBlockSameBars; // OrderBlock Detection Same Bars ...
|
int mOrderBlockSameBars; // OrderBlock Detection Same Bars ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int mConsolidationZoneMinLoopback; // Minimum Length of Cnsolidation Zone ...
|
||||||
|
double mConsolidationZoneRangeInPoint; // Consolidation Zone Range in Point ...
|
||||||
|
XConsolidationZone mConsolidationZones[]; // Holds Founded Consolidation Zones ...
|
||||||
|
XConsolidationZone mBullishConsolidationZones[]; // Holds Founded Bullish Consolidation Zones ...
|
||||||
|
XConsolidationZone mBearishConsolidationZones[]; // Holds Founded Bearish Consolidation Zones ...
|
||||||
|
ENUM_APPLIED_PRICE mConsolidationZonesLowerAppliedTo; // Consolidation Zone Upper Applied To ...
|
||||||
|
ENUM_APPLIED_PRICE mConsolidationZonesUpperAppliedTo; // Consolidation Zone Lower Applied To ...
|
||||||
|
|
||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2964,7 +2964,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
int window = SubWindowIdentification();
|
int window = SubWindowIdentification();
|
||||||
|
|
||||||
//
|
//
|
||||||
color czColor = IsBullish(zone.breakDir)
|
color czColor = IsBullish(zone.dir)
|
||||||
? BarBullishColor()
|
? BarBullishColor()
|
||||||
: BarBearishColor();
|
: BarBearishColor();
|
||||||
|
|
||||||
@@ -3460,7 +3460,9 @@ class XCPOIDrawer : public XCBase
|
|||||||
bool ignoreBullishRejectionBars = false,
|
bool ignoreBullishRejectionBars = false,
|
||||||
bool ignoreBearishRejectionBars = false,
|
bool ignoreBearishRejectionBars = false,
|
||||||
bool ignoreBullishMomentumBars = false,
|
bool ignoreBullishMomentumBars = false,
|
||||||
bool ignoreBearishMomentumBars = false //
|
bool ignoreBearishMomentumBars = false,
|
||||||
|
bool ignoreBullishConsolidationZones = false,
|
||||||
|
bool ignoreBearishConsolidationZones = false //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3924,6 +3926,64 @@ class XCPOIDrawer : public XCBase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Consolidation Zones ...
|
||||||
|
if (!ignoreBullishConsolidationZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBullishConsolidationZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCConsolidationZoneObject *iObj;
|
||||||
|
bool isCreated = CreateConsolidationZone(
|
||||||
|
state.bullishConsolidationZones[i],
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Consolidation Zones ...
|
||||||
|
if (!ignoreBearishConsolidationZones)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int count = state.CountBearishConsolidationZones();
|
||||||
|
if (IsValidSize(count))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCConsolidationZoneObject *iObj;
|
||||||
|
bool isCreated = CreateConsolidationZone(
|
||||||
|
state.bearishConsolidationZones[i],
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = ArraySize(drawnObjects);
|
result = ArraySize(drawnObjects);
|
||||||
|
|
||||||
|
|||||||
+25
-1
@@ -212,4 +212,28 @@
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBaseObject *stateObjects[];
|
||||||
|
int stateObjectsCount = drawer.DrawState(
|
||||||
|
decisionState,
|
||||||
|
stateObjects,
|
||||||
|
false, //
|
||||||
|
true, // ignoreSwingHighs
|
||||||
|
true, // ignoreSwingLows
|
||||||
|
true, // ignoreSupportZones
|
||||||
|
true, // ignoreResistanceZones
|
||||||
|
true, // ignoreSupplyZones
|
||||||
|
true, // ignoreDemandZones
|
||||||
|
true, // ignoreBullishOrderBlocks
|
||||||
|
true, // ignoreBearishOrderBlocks
|
||||||
|
true, // ignoreBullishFairValueGaps
|
||||||
|
true, // ignoreBearishFairValueGaps
|
||||||
|
true, // ignoreBullishRejectionBars
|
||||||
|
true, // ignoreBearishRejectionBars
|
||||||
|
true, // ignoreBullishMomentumBars
|
||||||
|
true, // ignoreBearishMomentumBars
|
||||||
|
false, // ignoreBullishConsolidationZones
|
||||||
|
false // ignoreBearishConsolidationZones
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -90,6 +90,7 @@ struct X121Inputs
|
|||||||
xstrInputs.Default();
|
xstrInputs.Default();
|
||||||
xcheInputs.Default();
|
xcheInputs.Default();
|
||||||
xdonInputs.Default();
|
xdonInputs.Default();
|
||||||
|
x3maInputs.Default();
|
||||||
xvwapInputs.Default();
|
xvwapInputs.Default();
|
||||||
xtrendInputs.Default();
|
xtrendInputs.Default();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3754,6 +3754,132 @@ int ExtractSwings(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Consolidation Zone ...
|
||||||
|
struct XConsolidationZone
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
string symbol; // Symbol ...
|
||||||
|
ENUM_TIMEFRAMES period; // Period ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double upper; // Upper ...
|
||||||
|
double lower; // Lower ...
|
||||||
|
|
||||||
|
//
|
||||||
|
datetime from; // Start Date
|
||||||
|
datetime to; // Breake Date
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION dir; // Break Direction ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor ...
|
||||||
|
XConsolidationZone()
|
||||||
|
{
|
||||||
|
Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tools ...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanup ...
|
||||||
|
*/
|
||||||
|
void Clean()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
upper = 0;
|
||||||
|
lower = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
to = NULL;
|
||||||
|
from = NULL;
|
||||||
|
symbol = NULL;
|
||||||
|
period = NULL;
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
ZeroMemory(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsValid()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
upper > 0 &&
|
||||||
|
lower > 0 &&
|
||||||
|
IsValid(to) &&
|
||||||
|
IsValid(from) &&
|
||||||
|
IsValid(symbol) &&
|
||||||
|
IsValid(period) &&
|
||||||
|
HasDirection(dir)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsSameAs(
|
||||||
|
XConsolidationZone &item //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
item.IsValid() &&
|
||||||
|
dir == item.dir &&
|
||||||
|
from == item.from &&
|
||||||
|
upper == item.upper &&
|
||||||
|
lower == item.lower &&
|
||||||
|
symbol == item.symbol &&
|
||||||
|
period == item.period;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Unique Identifier ...
|
||||||
|
*
|
||||||
|
* @return ( string )
|
||||||
|
*/
|
||||||
|
string GetTag()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
string result =
|
||||||
|
//
|
||||||
|
"XCZONE" + "_" +
|
||||||
|
ToString(dir) + "_" +
|
||||||
|
symbol + "_" +
|
||||||
|
ToString(period) + "_" +
|
||||||
|
ToString(upper) + "_" +
|
||||||
|
ToString(lower)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Functions ...
|
// Functions ...
|
||||||
|
|
||||||
@@ -5255,9 +5381,9 @@ int FillPrice(
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (_mLoopback < 7)
|
if (_mLoopback < 1)
|
||||||
{
|
{
|
||||||
_mLoopback = 7;
|
_mLoopback = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -67,6 +67,9 @@ enum ENUM_XPOIS
|
|||||||
// Fair Value Gaps ...
|
// Fair Value Gaps ...
|
||||||
X_POI_BULLISH_FVG, // Bullish Order Block ...
|
X_POI_BULLISH_FVG, // Bullish Order Block ...
|
||||||
X_POI_BEARISH_FVG, // Bearish Order Block ...
|
X_POI_BEARISH_FVG, // Bearish Order Block ...
|
||||||
|
//
|
||||||
|
X_BULLISH_CONSOLIDATION_ZONE,
|
||||||
|
X_BEARISH_CONSOLIDATION_ZONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -111,6 +114,8 @@ enum ENUM_XPOI_EVENTS
|
|||||||
// Fair Value Gaps ...
|
// Fair Value Gaps ...
|
||||||
X_BULLISH_FVG_DETECTED, // Bullish Fair Value Gapّ ...
|
X_BULLISH_FVG_DETECTED, // Bullish Fair Value Gapّ ...
|
||||||
X_BEARISH_FVG_DETECTED, // Bearish Fair Value Gapّ ...
|
X_BEARISH_FVG_DETECTED, // Bearish Fair Value Gapّ ...
|
||||||
|
X_BULLISH_CONSOLIDATION_ZONE_DETECTED,
|
||||||
|
X_BEARISH_CONSOLIDATION_ZONE_DETECTED,
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -222,6 +227,16 @@ string ToString(ENUM_XPOIS value)
|
|||||||
case X_POI_TICKS_ZONES:
|
case X_POI_TICKS_ZONES:
|
||||||
result = "XTKSZ";
|
result = "XTKSZ";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_BULLISH_CONSOLIDATION_ZONE:
|
||||||
|
result = "XBULLCZ";
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X_BEARISH_CONSOLIDATION_ZONE:
|
||||||
|
result = "XBEARCZ";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -5175,427 +5190,6 @@ class XCSession : public XCFromToZone
|
|||||||
//
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
|
||||||
// Consolidation Zone ...
|
|
||||||
struct XConsolidationZone
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Props ...
|
|
||||||
|
|
||||||
//
|
|
||||||
string symbol; // Symbol ...
|
|
||||||
ENUM_TIMEFRAMES period; // Period ...
|
|
||||||
|
|
||||||
//
|
|
||||||
double upper; // Upper ...
|
|
||||||
double lower; // Lower ...
|
|
||||||
|
|
||||||
//
|
|
||||||
datetime initTime;
|
|
||||||
int loopback; // Loopback ...
|
|
||||||
|
|
||||||
//
|
|
||||||
ENUM_X_DIRECTION breakDir; // Break Direction ...
|
|
||||||
XOHCL breakerBar; // Breaker Bar ...
|
|
||||||
|
|
||||||
//
|
|
||||||
// Constructor ...
|
|
||||||
XConsolidationZone()
|
|
||||||
{
|
|
||||||
Clean();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Zone ...
|
|
||||||
*
|
|
||||||
* @param _symbol: String ...
|
|
||||||
* @param _period: ENUM_TIMEFRAMES member ...
|
|
||||||
* @param _upper: Double ...
|
|
||||||
* @param _lower: Double ...
|
|
||||||
* @param _loopback: Integer ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool Init(
|
|
||||||
string _symbol,
|
|
||||||
ENUM_TIMEFRAMES _period,
|
|
||||||
double _upper,
|
|
||||||
double _lower,
|
|
||||||
int _loopback //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
_symbol = NormalizeSymbol(_symbol);
|
|
||||||
_period = NormalizePeriod(_period);
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
_upper > 0 &&
|
|
||||||
_lower > 0 &&
|
|
||||||
_loopback > 0
|
|
||||||
//
|
|
||||||
;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
upper = _upper;
|
|
||||||
lower = _lower;
|
|
||||||
symbol = _symbol;
|
|
||||||
period = _period;
|
|
||||||
loopback = _loopback;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsValid();
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
initTime = TimeCurrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update Breaked State ...
|
|
||||||
*/
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!IsValid())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (IsBreaked())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL cBar;
|
|
||||||
bool isInited = cBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
0 //
|
|
||||||
);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL pBar;
|
|
||||||
isInited = cBar.GetPreviousBar(pBar);
|
|
||||||
if (!isInited)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Consolidation Hounts ...
|
|
||||||
bool isHountTop = cBar.high > upper &&
|
|
||||||
cBar.low < upper &&
|
|
||||||
cBar.GetUp() < upper;
|
|
||||||
bool isHountBottom = cBar.low < lower &&
|
|
||||||
cBar.high > lower &&
|
|
||||||
cBar.GetDown() > lower;
|
|
||||||
bool isHounted = isHountTop ||
|
|
||||||
isHountBottom;
|
|
||||||
if (isHounted)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (isHountTop)
|
|
||||||
{
|
|
||||||
upper = cBar.high;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isHountBottom)
|
|
||||||
{
|
|
||||||
lower = cBar.low;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Check Consolidation Breaks ...
|
|
||||||
bool isBreakTop = (cBar.GetUp() > upper &&
|
|
||||||
cBar.GetDown() < upper) ||
|
|
||||||
(cBar.low > upper &&
|
|
||||||
cBar.high > upper);
|
|
||||||
bool isBreakBottom = (cBar.GetDown() < lower &&
|
|
||||||
cBar.GetUp() > lower) ||
|
|
||||||
(cBar.high < lower &&
|
|
||||||
cBar.low < lower);
|
|
||||||
bool isBreaked = isBreakTop ||
|
|
||||||
isBreakBottom;
|
|
||||||
if (!isBreaked)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Calculate Break Direction ...
|
|
||||||
breakerBar = cBar;
|
|
||||||
breakDir = isBreakTop
|
|
||||||
? X_DIRECTION_BULLISH
|
|
||||||
: isBreakBottom
|
|
||||||
? X_DIRECTION_BEARISH
|
|
||||||
: X_DIRECTION_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cleanup ...
|
|
||||||
*/
|
|
||||||
void Clean()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
upper = 0;
|
|
||||||
lower = 0;
|
|
||||||
loopback = 0;
|
|
||||||
symbol = NULL;
|
|
||||||
period = NULL;
|
|
||||||
initTime = NULL;
|
|
||||||
breakerBar.Clean();
|
|
||||||
breakDir = X_DIRECTION_NONE;
|
|
||||||
|
|
||||||
//
|
|
||||||
ZeroMemory(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsValid()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result =
|
|
||||||
//
|
|
||||||
IsValid(symbol) &&
|
|
||||||
IsValid(period) &&
|
|
||||||
upper > 0 &&
|
|
||||||
lower > 0 &&
|
|
||||||
loopback > 0
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Zone is Breaked or not ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool IsBreaked()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = breakerBar.IsValid() &&
|
|
||||||
HasDirection(breakDir);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect Supply Zone if Exists ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasSupplyZone(
|
|
||||||
XCSupplyZone *&zone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsBreaked() &&
|
|
||||||
breakDir == X_DIRECTION_BEARISH;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Implment Zone Finding ...
|
|
||||||
int index = breakerBar.Index();
|
|
||||||
int hhIDX = iHighest(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
MODE_HIGH,
|
|
||||||
loopback,
|
|
||||||
index //
|
|
||||||
);
|
|
||||||
result = IsValidIndex(hhIDX);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL hhBar;
|
|
||||||
result = hhBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
hhIDX //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
zone = new XCSupplyZone();
|
|
||||||
result = zone.Init(
|
|
||||||
hhBar,
|
|
||||||
loopback //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detect Demand Zone if Exists ...
|
|
||||||
*
|
|
||||||
* @return ( bool )
|
|
||||||
*/
|
|
||||||
bool HasDemandZone(
|
|
||||||
XCDemandZone *&zone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
result = IsBreaked() &&
|
|
||||||
breakDir == X_DIRECTION_BULLISH;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Implment Zone Finding ...
|
|
||||||
int index = breakerBar.Index();
|
|
||||||
int llIDX = iLowest(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
MODE_LOW,
|
|
||||||
loopback,
|
|
||||||
index //
|
|
||||||
);
|
|
||||||
result = IsValidIndex(llIDX);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XOHCL llBar;
|
|
||||||
result = llBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
llIDX //
|
|
||||||
);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
zone = new XCDemandZone();
|
|
||||||
result = zone.Init(
|
|
||||||
llBar,
|
|
||||||
loopback //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve Start Time ...
|
|
||||||
*
|
|
||||||
* @return ( datetime )
|
|
||||||
*/
|
|
||||||
datetime From()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
datetime result = NULL;
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!IsValid())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int startIndex = iBarShift(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
initTime //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
result = iTime(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
loopback + startIndex //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve Unique Identifier ...
|
|
||||||
*
|
|
||||||
* @return ( string )
|
|
||||||
*/
|
|
||||||
string GetTag()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
string result =
|
|
||||||
//
|
|
||||||
"ConsolidationZone" + "_" +
|
|
||||||
symbol + "_" +
|
|
||||||
ToString(period) + "_" +
|
|
||||||
ToString(upper) + "_" +
|
|
||||||
ToString(lower)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
};
|
|
||||||
|
|
||||||
//
|
//
|
||||||
struct XBoxZone
|
struct XBoxZone
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -384,6 +384,11 @@ struct XPOIState
|
|||||||
XCFVG *bullishFairValueGaps[]; // Holds Founded Bullish Fair Value Gaps ...
|
XCFVG *bullishFairValueGaps[]; // Holds Founded Bullish Fair Value Gaps ...
|
||||||
XCFVG *bearishFairValueGaps[]; // Holds Founded Bearish Fair Value Gaps ...
|
XCFVG *bearishFairValueGaps[]; // Holds Founded Bearish Fair Value Gaps ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XConsolidationZone consolidationZones[]; // Holds Founded Consolidation Zones ...
|
||||||
|
XConsolidationZone bullishConsolidationZones[]; // Holds Founded Bullish Consolidation Zones ...
|
||||||
|
XConsolidationZone bearishConsolidationZones[]; // Holds Founded Bearih Consolidation Zones ...
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
void XPOIState()
|
void XPOIState()
|
||||||
@@ -437,6 +442,11 @@ struct XPOIState
|
|||||||
Clean(bullishFairValueGaps);
|
Clean(bullishFairValueGaps);
|
||||||
Clean(bearishFairValueGaps);
|
Clean(bearishFairValueGaps);
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(consolidationZones);
|
||||||
|
Clean(bullishConsolidationZones);
|
||||||
|
Clean(bearishConsolidationZones);
|
||||||
|
|
||||||
//
|
//
|
||||||
ZeroMemory(this);
|
ZeroMemory(this);
|
||||||
}
|
}
|
||||||
@@ -474,20 +484,22 @@ struct XPOIState
|
|||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
IsValidSize(CountSwingHighs()) ||
|
HasSwingLows() ||
|
||||||
IsValidSize(CountSwingLows()) ||
|
HasSwingHighs() ||
|
||||||
IsValidSize(CountBullishMomentumBars()) ||
|
HasSupplyZones() ||
|
||||||
IsValidSize(CountBearishMomentumBars()) ||
|
HasDemandZones() ||
|
||||||
IsValidSize(CountBullishRejectionBars()) ||
|
HasSupportZones() ||
|
||||||
IsValidSize(CountBearishRejectionBars()) ||
|
HasResistanceZones() ||
|
||||||
IsValidSize(CountSupportZones()) ||
|
HasBullishOrderBlocks() ||
|
||||||
IsValidSize(CountResistanceZones()) ||
|
HasBearishOrderBlocks() ||
|
||||||
IsValidSize(CountSupplyZones()) ||
|
HasBullishMomentumBars() ||
|
||||||
IsValidSize(CountDemandZones()) ||
|
HasBearishMomentumBars() ||
|
||||||
IsValidSize(CountBullishOrderBlocks()) ||
|
HasBullishRejectionBars() ||
|
||||||
IsValidSize(CountBearishOrderBlocks()) ||
|
HasBearishRejectionBars() ||
|
||||||
IsValidSize(CountBullishFairValueGaps()) ||
|
HasBullishFairValueGaps() ||
|
||||||
IsValidSize(CountBearishFairValueGaps())
|
HasBearishFairValueGaps() ||
|
||||||
|
HasBullishConsolidationZones() ||
|
||||||
|
HasBearishConsolidationZones()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -495,101 +507,6 @@ struct XPOIState
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill Dest State by Current State's Data ...
|
|
||||||
*
|
|
||||||
* @param dest: XPOIState instance, reference to specified dest ...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void Fill(XPOIState &dest)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (!IsValid() ||
|
|
||||||
!HasChild())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
dest.symbol = symbol;
|
|
||||||
dest.period = period;
|
|
||||||
dest.time = time;
|
|
||||||
|
|
||||||
//
|
|
||||||
Copy(
|
|
||||||
swingHighs,
|
|
||||||
dest.swingHighs,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
swingLows,
|
|
||||||
dest.swingLows,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bullishMomentumBars,
|
|
||||||
dest.bullishMomentumBars,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bearishMomentumBars,
|
|
||||||
dest.bearishMomentumBars,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bullishRejectionBars,
|
|
||||||
dest.bullishRejectionBars,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bearishRejectionBars,
|
|
||||||
dest.bearishRejectionBars,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
supportZones,
|
|
||||||
dest.supportZones,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
resistanceZones,
|
|
||||||
dest.resistanceZones,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
supplyZones,
|
|
||||||
dest.supplyZones,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
demandZones,
|
|
||||||
dest.demandZones,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bullishOrderBlocks,
|
|
||||||
dest.bullishOrderBlocks,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bearishOrderBlocks,
|
|
||||||
dest.bearishOrderBlocks,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bullishFairValueGaps,
|
|
||||||
dest.bullishFairValueGaps,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
bearishFairValueGaps,
|
|
||||||
dest.bearishFairValueGaps,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Counters ...
|
// Counters ...
|
||||||
|
|
||||||
@@ -1068,6 +985,42 @@ struct XPOIState
|
|||||||
return IsValidSize(CountBearishFairValueGaps());
|
return IsValidSize(CountBearishFairValueGaps());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasConsolidationZones()
|
||||||
|
{
|
||||||
|
return HasChild(consolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CountConsolidationZones()
|
||||||
|
{
|
||||||
|
return ArraySize(consolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasBullishConsolidationZones()
|
||||||
|
{
|
||||||
|
return HasChild(bullishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CountBullishConsolidationZones()
|
||||||
|
{
|
||||||
|
return ArraySize(bullishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasBearishConsolidationZones()
|
||||||
|
{
|
||||||
|
return HasChild(bearishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int CountBearishConsolidationZones()
|
||||||
|
{
|
||||||
|
return ArraySize(bearishConsolidationZones);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void UpdateTo(datetime value = NULL)
|
void UpdateTo(datetime value = NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,183 +106,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
//
|
//
|
||||||
// Getter/Setter(s) ...
|
// Getter/Setter(s) ...
|
||||||
|
|
||||||
//
|
|
||||||
int CountConsolidationZones()
|
|
||||||
{
|
|
||||||
return ArraySize(mConsolidationZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool HasConsolidationZones()
|
|
||||||
{
|
|
||||||
return HasChild(mConsolidationZones);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool GetConsolidationZone(
|
|
||||||
int idx,
|
|
||||||
XConsolidationZone &zone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
zone.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
result = HasConsolidationZones();
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = CountConsolidationZones();
|
|
||||||
result = idx >= 0 &&
|
|
||||||
idx < count;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
zone = mConsolidationZones[idx];
|
|
||||||
result = zone.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool GetLastDirectionalConsolidationZone(
|
|
||||||
ENUM_X_DIRECTION forDir,
|
|
||||||
XConsolidationZone &zone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
zone.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
result = HasDirection(forDir);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasZones = HasConsolidationZones();
|
|
||||||
int zonesCount = CountConsolidationZones();
|
|
||||||
result = hasZones;
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
for (int i = zonesCount - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XConsolidationZone iZone = mConsolidationZones[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!iZone.IsBreaked())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (!HasDirection(iZone.breakDir))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (iZone.breakDir != forDir)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
zone = iZone;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = zone.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
bool GetActiveConsolidationZone(
|
|
||||||
XConsolidationZone &zone //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
//
|
|
||||||
zone = mActiveConsolidationZone;
|
|
||||||
result = zone.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int FillConsolidationZones(
|
|
||||||
ENUM_X_DIRECTION forDir,
|
|
||||||
XConsolidationZone &zones[] //
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int result = 0;
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(zones);
|
|
||||||
|
|
||||||
//
|
|
||||||
bool hasZones = HasConsolidationZones();
|
|
||||||
if (!hasZones)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
int count = CountConsolidationZones();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XConsolidationZone iZone = mConsolidationZones[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isDirPassed =
|
|
||||||
(forDir == X_DIRECTION_ALL ||
|
|
||||||
forDir == X_DIRECTION_NONE)
|
|
||||||
? true
|
|
||||||
: forDir == iZone.breakDir;
|
|
||||||
if (isDirPassed)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
iZone,
|
|
||||||
zones //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = ArraySize(zones);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
@@ -618,7 +441,7 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
conditions.time = TimeCurrent();
|
conditions.time = TimeCurrent();
|
||||||
|
|
||||||
//
|
//
|
||||||
Update();
|
// Update();
|
||||||
|
|
||||||
//
|
//
|
||||||
result = conditions.IsValid();
|
result = conditions.IsValid();
|
||||||
@@ -627,87 +450,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Tools ...
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int czRange = 50; // Consolidation min Range Points ...
|
|
||||||
int czLoopback = 5;
|
|
||||||
int maxAllowed = 20;
|
|
||||||
bool isActiveConsolidationZoneBreaked = false;
|
|
||||||
bool hasActiveConsolidationZone = mActiveConsolidationZone.IsValid();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasActiveConsolidationZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
isActiveConsolidationZoneBreaked = mActiveConsolidationZone.IsBreaked();
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isActiveConsolidationZoneBreaked)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
AddRef(
|
|
||||||
mActiveConsolidationZone,
|
|
||||||
mConsolidationZones //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
CleanupArray(
|
|
||||||
mConsolidationZones,
|
|
||||||
maxAllowed //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
mActiveConsolidationZone.Clean();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mActiveConsolidationZone.Update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XOHCL mBar;
|
|
||||||
bool hasBar = GetBar(
|
|
||||||
mBar,
|
|
||||||
0 //
|
|
||||||
);
|
|
||||||
if (hasBar)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
double upper = 0;
|
|
||||||
double lower = 0;
|
|
||||||
bool hasConsolidationZone =
|
|
||||||
mBarAnalyser.IsConsolidate(
|
|
||||||
mBar,
|
|
||||||
upper,
|
|
||||||
lower,
|
|
||||||
czLoopback,
|
|
||||||
czRange //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (hasConsolidationZone)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mActiveConsolidationZone.Init(
|
|
||||||
GetSymbol(),
|
|
||||||
GetPeriod(),
|
|
||||||
upper,
|
|
||||||
lower,
|
|
||||||
czLoopback //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
mBar.Clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Virtuals ...
|
// Virtuals ...
|
||||||
|
|
||||||
@@ -729,11 +471,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
string mSymbol;
|
string mSymbol;
|
||||||
ENUM_TIMEFRAMES mPeriod;
|
ENUM_TIMEFRAMES mPeriod;
|
||||||
|
|
||||||
//
|
|
||||||
// CArrayObj mConsolidationObjects;
|
|
||||||
XConsolidationZone mActiveConsolidationZone;
|
|
||||||
XConsolidationZone mConsolidationZones[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Actions ...
|
// Actions ...
|
||||||
|
|
||||||
@@ -751,10 +488,6 @@ class XC121SMCCycleHelper : public XCBase
|
|||||||
delete mX121Helper;
|
delete mX121Helper;
|
||||||
delete mPOIDetector;
|
delete mPOIDetector;
|
||||||
delete mBarAnalyser;
|
delete mBarAnalyser;
|
||||||
|
|
||||||
//
|
|
||||||
Clean(mConsolidationZones);
|
|
||||||
mActiveConsolidationZone.Clean();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -489,172 +489,172 @@ bool DetectX121SMCGuards(
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Detect Consolidation Zone ...
|
// // Detect Consolidation Zone ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Detect Consolidation Zones ...
|
// // Detect Consolidation Zones ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
XBoxZone lastBullishBox;
|
// XBoxZone lastBullishBox;
|
||||||
XBoxZone prevLastBullishBox;
|
// XBoxZone prevLastBullishBox;
|
||||||
bool hasLastBullishBox = false;
|
// bool hasLastBullishBox = false;
|
||||||
bool hasPrevLastBullishBox = false;
|
// bool hasPrevLastBullishBox = false;
|
||||||
XConsolidationZone lastBullishZone;
|
// XConsolidationZone lastBullishZone;
|
||||||
bool isLastBullishAbovePrev = false;
|
// bool isLastBullishAbovePrev = false;
|
||||||
bool isLastBullishBelowPrev = false;
|
// bool isLastBullishBelowPrev = false;
|
||||||
XConsolidationZone prevLastBullishZone;
|
// XConsolidationZone prevLastBullishZone;
|
||||||
|
|
||||||
//
|
// //
|
||||||
XBoxZone lastBearishBox;
|
// XBoxZone lastBearishBox;
|
||||||
XBoxZone prevLastBearishBox;
|
// XBoxZone prevLastBearishBox;
|
||||||
bool hasLastBearishBox = false;
|
// bool hasLastBearishBox = false;
|
||||||
bool hasPrevLastBearishBox = false;
|
// bool hasPrevLastBearishBox = false;
|
||||||
XConsolidationZone lastBearishZone;
|
// XConsolidationZone lastBearishZone;
|
||||||
bool isLastBearishAbovePrev = false;
|
// bool isLastBearishAbovePrev = false;
|
||||||
bool isLastBearishBelowPrev = false;
|
// bool isLastBearishBelowPrev = false;
|
||||||
XConsolidationZone prevLastBearishZone;
|
// XConsolidationZone prevLastBearishZone;
|
||||||
|
|
||||||
//
|
// //
|
||||||
int bullishConsolidationZonesCount = 0;
|
// int bullishConsolidationZonesCount = 0;
|
||||||
int bearishConsolidationZonesCount = 0;
|
// int bearishConsolidationZonesCount = 0;
|
||||||
bool hasBullishConsolidationZones = false;
|
// bool hasBullishConsolidationZones = false;
|
||||||
bool hasBearishConsolidationZones = false;
|
// bool hasBearishConsolidationZones = false;
|
||||||
XConsolidationZone bullishConsolidationZones[];
|
// XConsolidationZone bullishConsolidationZones[];
|
||||||
XConsolidationZone bearishConsolidationZones[];
|
// XConsolidationZone bearishConsolidationZones[];
|
||||||
bool hasConsolidationZones = decisionCycleHelper.HasConsolidationZones();
|
// bool hasConsolidationZones = decisionCycleHelper.HasConsolidationZones();
|
||||||
int consolidationZonesCount = decisionCycleHelper.CountConsolidationZones();
|
// int consolidationZonesCount = decisionCycleHelper.CountConsolidationZones();
|
||||||
if (hasConsolidationZones)
|
// if (hasConsolidationZones)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
bullishConsolidationZonesCount = decisionCycleHelper
|
// bullishConsolidationZonesCount = decisionCycleHelper
|
||||||
.FillConsolidationZones(
|
// .FillConsolidationZones(
|
||||||
X_DIRECTION_BULLISH,
|
// X_DIRECTION_BULLISH,
|
||||||
bullishConsolidationZones //
|
// bullishConsolidationZones //
|
||||||
);
|
// );
|
||||||
hasBullishConsolidationZones = IsValidSize(bullishConsolidationZonesCount);
|
// hasBullishConsolidationZones = IsValidSize(bullishConsolidationZonesCount);
|
||||||
|
|
||||||
//
|
// //
|
||||||
bearishConsolidationZonesCount = decisionCycleHelper
|
// bearishConsolidationZonesCount = decisionCycleHelper
|
||||||
.FillConsolidationZones(
|
// .FillConsolidationZones(
|
||||||
X_DIRECTION_BEARISH,
|
// X_DIRECTION_BEARISH,
|
||||||
bearishConsolidationZones //
|
// bearishConsolidationZones //
|
||||||
);
|
// );
|
||||||
hasBearishConsolidationZones = IsValidSize(bearishConsolidationZonesCount);
|
// hasBearishConsolidationZones = IsValidSize(bearishConsolidationZonesCount);
|
||||||
|
|
||||||
//
|
// //
|
||||||
//
|
// //
|
||||||
//
|
// //
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (hasBullishConsolidationZones &&
|
// if (hasBullishConsolidationZones &&
|
||||||
bullishConsolidationZonesCount >= 2)
|
// bullishConsolidationZonesCount >= 2)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
lastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 1];
|
// lastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 1];
|
||||||
prevLastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 2];
|
// prevLastBullishZone = bullishConsolidationZones[bullishConsolidationZonesCount - 2];
|
||||||
|
|
||||||
//
|
// //
|
||||||
hasLastBullishBox = ToBox(
|
// hasLastBullishBox = ToBox(
|
||||||
lastBullishBox,
|
// lastBullishBox,
|
||||||
lastBullishZone //
|
// lastBullishZone //
|
||||||
);
|
// );
|
||||||
hasPrevLastBullishBox = ToBox(
|
// hasPrevLastBullishBox = ToBox(
|
||||||
prevLastBullishBox,
|
// prevLastBullishBox,
|
||||||
prevLastBullishZone //
|
// prevLastBullishZone //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
isLastBullishAbovePrev = hasLastBullishBox &&
|
// isLastBullishAbovePrev = hasLastBullishBox &&
|
||||||
hasPrevLastBullishBox &&
|
// hasPrevLastBullishBox &&
|
||||||
IsBoxAbove(
|
// IsBoxAbove(
|
||||||
lastBullishBox,
|
// lastBullishBox,
|
||||||
prevLastBullishBox //
|
// prevLastBullishBox //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
isLastBullishBelowPrev = hasLastBullishBox &&
|
// isLastBullishBelowPrev = hasLastBullishBox &&
|
||||||
hasPrevLastBullishBox &&
|
// hasPrevLastBullishBox &&
|
||||||
IsBoxBelow(
|
// IsBoxBelow(
|
||||||
lastBullishBox,
|
// lastBullishBox,
|
||||||
prevLastBullishBox //
|
// prevLastBullishBox //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (hasBearishConsolidationZones &&
|
// if (hasBearishConsolidationZones &&
|
||||||
bearishConsolidationZonesCount >= 2)
|
// bearishConsolidationZonesCount >= 2)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
lastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 1];
|
// lastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 1];
|
||||||
prevLastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 2];
|
// prevLastBearishZone = bearishConsolidationZones[bearishConsolidationZonesCount - 2];
|
||||||
|
|
||||||
//
|
// //
|
||||||
hasLastBearishBox = ToBox(
|
// hasLastBearishBox = ToBox(
|
||||||
lastBearishBox,
|
// lastBearishBox,
|
||||||
lastBearishZone //
|
// lastBearishZone //
|
||||||
);
|
// );
|
||||||
hasPrevLastBearishBox = ToBox(
|
// hasPrevLastBearishBox = ToBox(
|
||||||
prevLastBearishBox,
|
// prevLastBearishBox,
|
||||||
prevLastBearishZone //
|
// prevLastBearishZone //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
isLastBearishAbovePrev = hasLastBearishBox &&
|
// isLastBearishAbovePrev = hasLastBearishBox &&
|
||||||
hasPrevLastBearishBox &&
|
// hasPrevLastBearishBox &&
|
||||||
IsBoxAbove(
|
// IsBoxAbove(
|
||||||
lastBearishBox,
|
// lastBearishBox,
|
||||||
prevLastBearishBox //
|
// prevLastBearishBox //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
isLastBearishBelowPrev = hasLastBearishBox &&
|
// isLastBearishBelowPrev = hasLastBearishBox &&
|
||||||
hasPrevLastBearishBox &&
|
// hasPrevLastBearishBox &&
|
||||||
IsBoxBelow(
|
// IsBoxBelow(
|
||||||
lastBearishBox,
|
// lastBearishBox,
|
||||||
prevLastBearishBox //
|
// prevLastBearishBox //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect High Probability Swings ...
|
// Detect High Probability Swings ...
|
||||||
bool isSwingLow =
|
// bool isSwingLow =
|
||||||
//
|
// //
|
||||||
cBar.low > pBar.low &&
|
// cBar.low > pBar.low &&
|
||||||
ppBar.low > pBar.low &&
|
// ppBar.low > pBar.low &&
|
||||||
//
|
// //
|
||||||
zBar.low > pBar.low
|
// zBar.low > pBar.low
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
bool isSwingHigh =
|
// bool isSwingHigh =
|
||||||
//
|
// //
|
||||||
cBar.high < pBar.high &&
|
// cBar.high < pBar.high &&
|
||||||
ppBar.high < pBar.high &&
|
// ppBar.high < pBar.high &&
|
||||||
//
|
// //
|
||||||
zBar.high < pBar.high
|
// zBar.high < pBar.high
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
bool isStrongSwingLow =
|
// bool isStrongSwingLow =
|
||||||
pBar.IsBullish() &&
|
// pBar.IsBullish() &&
|
||||||
pBar.GetLowShadow() >= pBar.GetBody() * 2;
|
// pBar.GetLowShadow() >= pBar.GetBody() * 2;
|
||||||
bool isStrongSwingHigh =
|
// bool isStrongSwingHigh =
|
||||||
pBar.IsBearish() &&
|
// pBar.IsBearish() &&
|
||||||
pBar.GetHighShadow() >= pBar.GetBody() * 2;
|
// pBar.GetHighShadow() >= pBar.GetBody() * 2;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isStrongSwingLowAboveLastBullishBox =
|
// bool isStrongSwingLowAboveLastBullishBox =
|
||||||
isStrongSwingLow &&
|
// isStrongSwingLow &&
|
||||||
hasLastBullishBox &&
|
// hasLastBullishBox &&
|
||||||
pBar.low > lastBullishBox.upper;
|
// pBar.low > lastBullishBox.upper;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isStrongSwingHighBelowLastBearishBox =
|
// bool isStrongSwingHighBelowLastBearishBox =
|
||||||
isStrongSwingHigh &&
|
// isStrongSwingHigh &&
|
||||||
hasLastBearishBox &&
|
// hasLastBearishBox &&
|
||||||
pBar.high < lastBearishBox.lower;
|
// pBar.high < lastBearishBox.lower;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Here We Have all Requirements for Guarding Positions ...
|
// Here We Have all Requirements for Guarding Positions ...
|
||||||
@@ -822,82 +822,82 @@ bool DetectX121SMCGuards(
|
|||||||
// - occures two same type consolidation zones in order of positions type;
|
// - occures two same type consolidation zones in order of positions type;
|
||||||
// - occures a swing in order of consolidation zones ...
|
// - occures a swing in order of consolidation zones ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrailBasedOnTwoZone =
|
// bool canTrailBasedOnTwoZone =
|
||||||
isLong
|
// isLong
|
||||||
? isLastBullishAbovePrev
|
// ? isLastBullishAbovePrev
|
||||||
: isLastBearishBelowPrev;
|
// : isLastBearishBelowPrev;
|
||||||
if (canTrailBasedOnTwoZone)
|
// if (canTrailBasedOnTwoZone)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
trailedStop =
|
// trailedStop =
|
||||||
isLong
|
// isLong
|
||||||
? prevLastBullishBox.lower
|
// ? prevLastBullishBox.lower
|
||||||
: prevLastBearishBox.upper;
|
// : prevLastBearishBox.upper;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrailBasedOnZoneSwing =
|
// bool canTrailBasedOnZoneSwing =
|
||||||
trailedStop <= 0 &&
|
// trailedStop <= 0 &&
|
||||||
(isLong
|
// (isLong
|
||||||
? isStrongSwingLowAboveLastBullishBox
|
// ? isStrongSwingLowAboveLastBullishBox
|
||||||
: isStrongSwingHighBelowLastBearishBox);
|
// : isStrongSwingHighBelowLastBearishBox);
|
||||||
if (canTrailBasedOnZoneSwing)
|
// if (canTrailBasedOnZoneSwing)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
trailedStop =
|
// trailedStop =
|
||||||
isLong
|
// isLong
|
||||||
? pBar.low
|
// ? pBar.low
|
||||||
: pBar.high;
|
// : pBar.high;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canDoTrailStop =
|
// bool canDoTrailStop =
|
||||||
trailedStop > 0 &&
|
// trailedStop > 0 &&
|
||||||
(
|
// (
|
||||||
//
|
// //
|
||||||
iPosition.sl == 0
|
// iPosition.sl == 0
|
||||||
? (isLong
|
// ? (isLong
|
||||||
? trailedStop > iPosition.entry &&
|
// ? trailedStop > iPosition.entry &&
|
||||||
trailedStop < iPosition.price
|
// trailedStop < iPosition.price
|
||||||
: trailedStop < iPosition.entry &&
|
// : trailedStop < iPosition.entry &&
|
||||||
trailedStop > iPosition.price)
|
// trailedStop > iPosition.price)
|
||||||
: (isLong
|
// : (isLong
|
||||||
? trailedStop > iPosition.sl &&
|
// ? trailedStop > iPosition.sl &&
|
||||||
trailedStop > iPosition.entry &&
|
// trailedStop > iPosition.entry &&
|
||||||
trailedStop < iPosition.price
|
// trailedStop < iPosition.price
|
||||||
: trailedStop < iPosition.sl &&
|
// : trailedStop < iPosition.sl &&
|
||||||
trailedStop < iPosition.entry &&
|
// trailedStop < iPosition.entry &&
|
||||||
trailedStop > iPosition.price)
|
// trailedStop > iPosition.price)
|
||||||
//
|
// //
|
||||||
)
|
// )
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
if (canDoTrailStop)
|
// if (canDoTrailStop)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
X121SMCGuard iGuard;
|
// X121SMCGuard iGuard;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.time = cTime;
|
// iGuard.time = cTime;
|
||||||
iGuard.symbol = symbol;
|
// iGuard.symbol = symbol;
|
||||||
iGuard.provider = provider;
|
// iGuard.provider = provider;
|
||||||
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
|
// iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.ticket = iPosition.ticket;
|
// iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.sl = trailedStop;
|
// iGuard.sl = trailedStop;
|
||||||
|
|
||||||
//
|
// //
|
||||||
AddGuard(
|
// AddGuard(
|
||||||
iGuard,
|
// iGuard,
|
||||||
guards //
|
// guards //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -956,14 +956,14 @@ bool DetectX121SMCGuards(
|
|||||||
consolidationXConditions.Clean();
|
consolidationXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
lastBullishBox.Clean();
|
// lastBullishBox.Clean();
|
||||||
lastBearishBox.Clean();
|
// lastBearishBox.Clean();
|
||||||
lastBullishZone.Clean();
|
// lastBullishZone.Clean();
|
||||||
lastBearishZone.Clean();
|
// lastBearishZone.Clean();
|
||||||
prevLastBullishBox.Clean();
|
// prevLastBullishBox.Clean();
|
||||||
prevLastBearishBox.Clean();
|
// prevLastBearishBox.Clean();
|
||||||
prevLastBullishZone.Clean();
|
// prevLastBullishZone.Clean();
|
||||||
prevLastBearishZone.Clean();
|
// prevLastBearishZone.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
count = ArraySize(guards);
|
count = ArraySize(guards);
|
||||||
|
|||||||
@@ -1082,26 +1082,26 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Detect Consolidation Zone ...
|
// // Detect Consolidation Zone ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Bullish ...
|
// // Bullish ...
|
||||||
XConsolidationZone bullishConsolidationZone;
|
// XConsolidationZone bullishConsolidationZone;
|
||||||
bool hasBullishConsolidationZone = decisionCycleHelper
|
// bool hasBullishConsolidationZone = decisionCycleHelper
|
||||||
.GetLastDirectionalConsolidationZone(
|
// .GetLastDirectionalConsolidationZone(
|
||||||
X_DIRECTION_BULLISH,
|
// X_DIRECTION_BULLISH,
|
||||||
bullishConsolidationZone //
|
// bullishConsolidationZone //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Bearish ...
|
// // Bearish ...
|
||||||
XConsolidationZone bearishConsolidationZone;
|
// XConsolidationZone bearishConsolidationZone;
|
||||||
bool hasBearishConsolidationZone = decisionCycleHelper
|
// bool hasBearishConsolidationZone = decisionCycleHelper
|
||||||
.GetLastDirectionalConsolidationZone(
|
// .GetLastDirectionalConsolidationZone(
|
||||||
X_DIRECTION_BEARISH,
|
// X_DIRECTION_BEARISH,
|
||||||
bearishConsolidationZone //
|
// bearishConsolidationZone //
|
||||||
);
|
// );
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect High Probability Swings ...
|
// Detect High Probability Swings ...
|
||||||
@@ -1179,114 +1179,114 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
double sl = iPosition.sl;
|
double sl = iPosition.sl;
|
||||||
double tp = iPosition.tp;
|
double tp = iPosition.tp;
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Trail Stops Using Consolidation Zones ...
|
// // Trail Stops Using Consolidation Zones ...
|
||||||
bool canTraiLonglUsingCZone =
|
// bool canTraiLonglUsingCZone =
|
||||||
//
|
// //
|
||||||
(isLong &&
|
// (isLong &&
|
||||||
isInProfit &&
|
// isInProfit &&
|
||||||
hasBullishConsolidationZone &&
|
// hasBullishConsolidationZone &&
|
||||||
bullishConsolidationZone.lower > iPosition.sl &&
|
// bullishConsolidationZone.lower > iPosition.sl &&
|
||||||
bullishConsolidationZone.lower > iPosition.entry)
|
// bullishConsolidationZone.lower > iPosition.entry)
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
if (canTraiLonglUsingCZone)
|
// if (canTraiLonglUsingCZone)
|
||||||
{
|
// {
|
||||||
sl = bullishConsolidationZone.lower;
|
// sl = bullishConsolidationZone.lower;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTraiShortlUsingCZone =
|
// bool canTraiShortlUsingCZone =
|
||||||
//
|
// //
|
||||||
(!isLong &&
|
// (!isLong &&
|
||||||
isInProfit &&
|
// isInProfit &&
|
||||||
hasBearishConsolidationZone &&
|
// hasBearishConsolidationZone &&
|
||||||
bearishConsolidationZone.upper < iPosition.sl &&
|
// bearishConsolidationZone.upper < iPosition.sl &&
|
||||||
bearishConsolidationZone.upper < iPosition.entry)
|
// bearishConsolidationZone.upper < iPosition.entry)
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
if (canTraiShortlUsingCZone)
|
// if (canTraiShortlUsingCZone)
|
||||||
{
|
// {
|
||||||
sl = bearishConsolidationZone.upper;
|
// sl = bearishConsolidationZone.upper;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrailUsingCZone =
|
// bool canTrailUsingCZone =
|
||||||
canTraiLonglUsingCZone ||
|
// canTraiLonglUsingCZone ||
|
||||||
canTraiShortlUsingCZone;
|
// canTraiShortlUsingCZone;
|
||||||
|
|
||||||
//
|
// //
|
||||||
// Trail Stops Using Swings ...
|
// // Trail Stops Using Swings ...
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrailLongUsingSwings =
|
// bool canTrailLongUsingSwings =
|
||||||
//
|
// //
|
||||||
isLong &&
|
// isLong &&
|
||||||
isInProfit &&
|
// isInProfit &&
|
||||||
(isSwingLow ||
|
// (isSwingLow ||
|
||||||
isStrongSwingLow) &&
|
// isStrongSwingLow) &&
|
||||||
pBar.low > iPosition.sl &&
|
// pBar.low > iPosition.sl &&
|
||||||
pBar.low > iPosition.entry
|
// pBar.low > iPosition.entry
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
if (canTrailLongUsingSwings)
|
// if (canTrailLongUsingSwings)
|
||||||
{
|
// {
|
||||||
sl = pBar.low;
|
// sl = pBar.low;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTraiShortlUsingSwings =
|
// bool canTraiShortlUsingSwings =
|
||||||
//
|
// //
|
||||||
!isLong &&
|
// !isLong &&
|
||||||
isInProfit &&
|
// isInProfit &&
|
||||||
(isSwingHigh ||
|
// (isSwingHigh ||
|
||||||
isStrongSwingHigh) &&
|
// isStrongSwingHigh) &&
|
||||||
pBar.high < iPosition.sl &&
|
// pBar.high < iPosition.sl &&
|
||||||
pBar.high < iPosition.entry
|
// pBar.high < iPosition.entry
|
||||||
//
|
// //
|
||||||
;
|
// ;
|
||||||
if (canTraiShortlUsingSwings)
|
// if (canTraiShortlUsingSwings)
|
||||||
{
|
// {
|
||||||
sl = pBar.high;
|
// sl = pBar.high;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrailUsingSwings =
|
// bool canTrailUsingSwings =
|
||||||
canTrailLongUsingSwings ||
|
// canTrailLongUsingSwings ||
|
||||||
canTraiShortlUsingSwings;
|
// canTraiShortlUsingSwings;
|
||||||
|
|
||||||
//
|
// //
|
||||||
//
|
// //
|
||||||
//
|
// //
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool canTrail =
|
// bool canTrail =
|
||||||
sl != iPosition.sl &&
|
// sl != iPosition.sl &&
|
||||||
(canTrailUsingCZone ||
|
// (canTrailUsingCZone ||
|
||||||
canTrailUsingSwings);
|
// canTrailUsingSwings);
|
||||||
if (canTrail)
|
// if (canTrail)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
X121SMCGuard iGuard;
|
// X121SMCGuard iGuard;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.time = cTime;
|
// iGuard.time = cTime;
|
||||||
iGuard.symbol = symbol;
|
// iGuard.symbol = symbol;
|
||||||
iGuard.provider = provider;
|
// iGuard.provider = provider;
|
||||||
iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
|
// iGuard.action = X_121_SMC_GUARD_ACTION_TRAIL_STOP;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.ticket = iPosition.ticket;
|
// iGuard.ticket = iPosition.ticket;
|
||||||
|
|
||||||
//
|
// //
|
||||||
iGuard.sl = sl;
|
// iGuard.sl = sl;
|
||||||
|
|
||||||
//
|
// //
|
||||||
AddGuard(
|
// AddGuard(
|
||||||
iGuard,
|
// iGuard,
|
||||||
guards //
|
// guards //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -451,9 +451,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
*/
|
*/
|
||||||
void DoUnwaitedTicksWork() override
|
void DoUnwaitedTicksWork() override
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Decision ...
|
|
||||||
mDecisionCycleHelper.Update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -814,6 +811,12 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
|
x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
|
||||||
x121Inputs.xvwapInputs.showVWapSlow = showAll || true;
|
x121Inputs.xvwapInputs.showVWapSlow = showAll || true;
|
||||||
|
|
||||||
|
//
|
||||||
|
// X3MA ...
|
||||||
|
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
|
||||||
|
x121Inputs.x3maInputs.showX3MaMid = showAll || true;
|
||||||
|
x121Inputs.x3maInputs.showX3MaSlow = showAll || true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialize Cycle Helpers ...
|
// Initialize Cycle Helpers ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user