last ...
This commit is contained in:
@@ -52,6 +52,20 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
double point;
|
||||
XPVPivot pivot;
|
||||
|
||||
//
|
||||
bool hasSupportZone;
|
||||
bool hasResistanceZone;
|
||||
bool hasSupplyZone;
|
||||
bool hasDemandZone;
|
||||
bool hasOrderBlock;
|
||||
bool hasFairValueGap;
|
||||
XCSupportZone *supportZone;
|
||||
XCResistanceZone *resistanceZone;
|
||||
XCSupplyZone *supplyZone;
|
||||
XCDemandZone *demandZone;
|
||||
XCOrderBlock *orderBlock;
|
||||
XCFVG *fairValueGap;
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
X121SMCStrategyXTWPVSignalConditions()
|
||||
@@ -169,8 +183,161 @@ struct X121SMCStrategyXTWPVSignalConditions
|
||||
//
|
||||
point = 0;
|
||||
pivot.Clean();
|
||||
|
||||
//
|
||||
CleanPriceInsideZones();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean Price Insie Zones ...
|
||||
*/
|
||||
void CleanPriceInsideZones()
|
||||
{
|
||||
//
|
||||
hasSupportZone = false;
|
||||
hasResistanceZone = false;
|
||||
hasSupplyZone = false;
|
||||
hasDemandZone = false;
|
||||
hasOrderBlock = false;
|
||||
hasFairValueGap = false;
|
||||
|
||||
//
|
||||
supportZone = NULL;
|
||||
resistanceZone = NULL;
|
||||
supplyZone = NULL;
|
||||
demandZone = NULL;
|
||||
orderBlock = NULL;
|
||||
fairValueGap = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Count Price Inside Zones ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int CountPriceInsideZones()
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
if (hasSupportZone)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasResistanceZone)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasSupplyZone)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasDemandZone)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasOrderBlock)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
if (hasFairValueGap)
|
||||
{
|
||||
result++;
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Conditions Has Price Inside Zones ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasPriceInsideZones()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = IsValidSize(CountPriceInsideZones());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Conditions Has Bullish Price Inside Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBullishPriceInsideZone()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
HasPriceInsideZones() &&
|
||||
//
|
||||
(hasDemandZone ||
|
||||
hasSupportZone ||
|
||||
(hasOrderBlock &&
|
||||
orderBlock.IsBullish()) ||
|
||||
(hasFairValueGap &&
|
||||
fairValueGap.IsBullish()))
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Conditions Has Bearish Price Inside Zone ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasBearishPriceInsideZone()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
HasPriceInsideZones() &&
|
||||
//
|
||||
(hasSupplyZone ||
|
||||
hasResistanceZone ||
|
||||
(hasOrderBlock &&
|
||||
orderBlock.IsBearish()) ||
|
||||
(hasFairValueGap &&
|
||||
fairValueGap.IsBearish()))
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check has Vald Pivot or not ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasPivot()
|
||||
{
|
||||
return pivot.IsValid();
|
||||
@@ -555,6 +722,36 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
conditions.point = conditions.pivot.lower;
|
||||
}
|
||||
|
||||
//
|
||||
// Detect a Zone Which Price Inside it ...
|
||||
conditions.CleanPriceInsideZones();
|
||||
bool hasPriceInsideZones = conditions.HasPriceInsideZones();
|
||||
int priceInsideZonesCount = conditions.CountPriceInsideZones();
|
||||
if (!hasPriceInsideZones)
|
||||
{
|
||||
//
|
||||
hasPriceInsideZones = DetectPriceInsideZones(
|
||||
verificationState,
|
||||
cBar,
|
||||
priceInsideZonesCount,
|
||||
conditions.hasSupportZone,
|
||||
conditions.supportZone,
|
||||
conditions.hasResistanceZone,
|
||||
conditions.resistanceZone,
|
||||
conditions.hasSupplyZone,
|
||||
conditions.supplyZone,
|
||||
conditions.hasDemandZone,
|
||||
conditions.demandZone,
|
||||
conditions.hasOrderBlock,
|
||||
conditions.orderBlock,
|
||||
conditions.hasFairValueGap,
|
||||
conditions.fairValueGap //
|
||||
);
|
||||
|
||||
//
|
||||
priceInsideZonesCount = conditions.CountPriceInsideZones();
|
||||
}
|
||||
|
||||
//
|
||||
double donCloseUpper = helperConditions.x121Conditions.donCloseUpperBuffer[1];
|
||||
double donCloseLower = helperConditions.x121Conditions.donCloseLowerBuffer[1];
|
||||
@@ -588,9 +785,8 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
||||
//
|
||||
isBearish =
|
||||
//
|
||||
bearishConditions1
|
||||
// ||
|
||||
// bearishConditions2
|
||||
bearishConditions1 ||
|
||||
bearishConditions2
|
||||
//
|
||||
;
|
||||
|
||||
@@ -1003,6 +1199,72 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
double peak = analyseConditions.x121Conditions.peaksBuffer[1];
|
||||
double vale = analyseConditions.x121Conditions.valesBuffer[1];
|
||||
|
||||
//
|
||||
bool isBasedOnPeak = conditions.point == peak;
|
||||
bool isBasedOnVale = conditions.point == vale;
|
||||
|
||||
//
|
||||
bool hasPriceInsideZones = conditions.HasPriceInsideZones();
|
||||
bool hasBullishPriceInsideZone = conditions.HasBullishPriceInsideZone();
|
||||
bool hasBearishPriceInsideZone = conditions.HasBearishPriceInsideZone();
|
||||
|
||||
//
|
||||
if (
|
||||
isBearish &&
|
||||
isBasedOnPeak &&
|
||||
hasPriceInsideZones &&
|
||||
hasBearishPriceInsideZone //
|
||||
)
|
||||
{
|
||||
//
|
||||
// Supply ...
|
||||
if (conditions.hasSupplyZone)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.supplyZone.Upper(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
if (conditions.hasResistanceZone)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.resistanceZone.Upper(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Order Block ...
|
||||
if (conditions.hasOrderBlock)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.orderBlock.Upper(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Fair Value Gap ...
|
||||
if (conditions.hasFairValueGap)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
conditions.fairValueGap.Upper(),
|
||||
sls //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
double slsMin = GetMin(sls);
|
||||
double slsMax = GetMax(sls);
|
||||
@@ -1035,4 +1297,204 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drw Conditions Price Inside Zones ...
|
||||
*
|
||||
* @param conditions: X121SMCStrategyXTWPVSignalConditions instance Reference ...
|
||||
* @param drawer: XCPOIDrawer pointer ...
|
||||
* @param drawnObjects: XCBaseObject instance Reference Collection ...
|
||||
*
|
||||
* @return ( int )
|
||||
*/
|
||||
int DrawPriceInsideZones(
|
||||
X121SMCStrategyXTWPVSignalConditions &conditions,
|
||||
XCPOIDrawer *drawer,
|
||||
XCBaseObject *&drawnObjects[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
int result = 0;
|
||||
|
||||
//
|
||||
Clean(drawnObjects);
|
||||
|
||||
//
|
||||
if (
|
||||
drawer == NULL ||
|
||||
!conditions.HasPriceInsideZones())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Support ...
|
||||
if (conditions.hasSupportZone)
|
||||
{
|
||||
//
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = drawer.CreateSupportZone(
|
||||
conditions.supportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Resistance ...
|
||||
if (conditions.hasResistanceZone)
|
||||
{
|
||||
//
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = drawer.CreateResistanceZone(
|
||||
conditions.resistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Supply ...
|
||||
if (conditions.hasSupplyZone)
|
||||
{
|
||||
//
|
||||
XCSupplyZoneObject *iObj;
|
||||
bool isCreated = drawer.CreateSupplyZone(
|
||||
conditions.supplyZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand ...
|
||||
if (conditions.hasDemandZone)
|
||||
{
|
||||
//
|
||||
XCDemandZoneObject *iObj;
|
||||
bool isCreated = drawer.CreateDemandZone(
|
||||
conditions.demandZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Order Block ...
|
||||
if (conditions.hasOrderBlock)
|
||||
{
|
||||
//
|
||||
bool isBullish = conditions.orderBlock.IsBullish();
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XCBullishOrderBlockObject *iObj;
|
||||
bool isCreated = drawer.CreateBullishOrderBlock(
|
||||
conditions.orderBlock,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
XCBearishOrderBlockObject *iObj;
|
||||
bool isCreated = drawer.CreateBearishOrderBlock(
|
||||
conditions.orderBlock,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FairValueGap ...
|
||||
if (conditions.hasFairValueGap)
|
||||
{
|
||||
//
|
||||
bool isBullish = conditions.fairValueGap.IsBullish();
|
||||
if (isBullish)
|
||||
{
|
||||
//
|
||||
XCBullishFairValueGapObject *iObj;
|
||||
bool isCreated = drawer.CreateBullishFairValueGap(
|
||||
conditions.fairValueGap,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
XCBearishFairValueGapObject *iObj;
|
||||
bool isCreated = drawer.CreateBearishFairValueGap(
|
||||
conditions.fairValueGap,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
(XCBaseObject *)iObj,
|
||||
drawnObjects //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
result = ArraySize(drawnObjects);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user