last ...
This commit is contained in:
@@ -4479,7 +4479,7 @@ class XCPOIDrawer : public XCBase
|
|||||||
* @return ( int )
|
* @return ( int )
|
||||||
*/
|
*/
|
||||||
int DrawFVGOrderBlock(
|
int DrawFVGOrderBlock(
|
||||||
XFVGOrderBlock &models[],
|
XFVGOrderBlock &model,
|
||||||
XCBaseObject *&drawnObjects[] //
|
XCBaseObject *&drawnObjects[] //
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -4490,115 +4490,88 @@ class XCPOIDrawer : public XCBase
|
|||||||
Clean(drawnObjects);
|
Clean(drawnObjects);
|
||||||
|
|
||||||
//
|
//
|
||||||
int count = ArraySize(models);
|
if (!model.IsValid())
|
||||||
if (!IsValidSize(count))
|
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
for (int i = 0; i < count; i++)
|
ENUM_X_DIRECTION iDir;
|
||||||
|
result = model.GetDirection(iDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(iDir);
|
||||||
|
if (isBullish)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XFVGOrderBlock iModel = models[i];
|
// Order Block ...
|
||||||
|
XCBullishOrderBlockObject *iOBObj;
|
||||||
//
|
bool isCreated = CreateBullishOrderBlock(
|
||||||
ENUM_X_DIRECTION iDir;
|
model.orderBlock,
|
||||||
bool hasDirection = iModel.GetDirection(iDir);
|
iOBObj //
|
||||||
if (!hasDirection)
|
);
|
||||||
|
if (isCreated)
|
||||||
{
|
{
|
||||||
continue;
|
//
|
||||||
|
Add(
|
||||||
|
(XCBaseObject *)iOBObj,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBullish = IsBullish(iDir);
|
// FVG ...
|
||||||
|
XCBullishFairValueGapObject *iFVGObj;
|
||||||
//
|
isCreated = CreateBullishFairValueGap(
|
||||||
if (isBullish)
|
model.fairValueGap,
|
||||||
|
iFVGObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Order Block ...
|
Add(
|
||||||
XCBullishOrderBlockObject *iOBObj;
|
(XCBaseObject *)iOBObj,
|
||||||
bool isCreated = CreateBullishOrderBlock(
|
drawnObjects //
|
||||||
iModel.orderBlock,
|
|
||||||
iOBObj //
|
|
||||||
);
|
);
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
(XCBaseObject *)iOBObj,
|
|
||||||
drawnObjects //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// FVG ...
|
|
||||||
XCBullishFairValueGapObject *iFVGObj;
|
|
||||||
isCreated = CreateBullishFairValueGap(
|
|
||||||
iModel.fairValueGap,
|
|
||||||
iFVGObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
(XCBaseObject *)iOBObj,
|
|
||||||
drawnObjects //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Order Block ...
|
||||||
|
XCBearishOrderBlockObject *iOBObj;
|
||||||
|
bool isCreated = CreateBearishOrderBlock(
|
||||||
|
model.orderBlock,
|
||||||
|
iOBObj //
|
||||||
|
);
|
||||||
|
if (isCreated)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Order Block ...
|
Add(
|
||||||
XCBearishOrderBlockObject *iOBObj;
|
(XCBaseObject *)iOBObj,
|
||||||
bool isCreated = CreateBearishOrderBlock(
|
drawnObjects //
|
||||||
iModel.orderBlock,
|
|
||||||
iOBObj //
|
|
||||||
);
|
);
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
(XCBaseObject *)iOBObj,
|
|
||||||
drawnObjects //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// FVG ...
|
|
||||||
XCBearishFairValueGapObject *iFVGObj;
|
|
||||||
isCreated = CreateBearishFairValueGap(
|
|
||||||
iModel.fairValueGap,
|
|
||||||
iFVGObj //
|
|
||||||
);
|
|
||||||
if (isCreated)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
Add(
|
|
||||||
(XCBaseObject *)iFVGObj,
|
|
||||||
drawnObjects //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Price Zone ...
|
// FVG ...
|
||||||
// XCBaseObject *stateZoneObjects[];
|
XCBearishFairValueGapObject *iFVGObj;
|
||||||
// int stateZoneObjectsCount = DrawStateZones(
|
isCreated = CreateBearishFairValueGap(
|
||||||
// iModel.stateZones,
|
model.fairValueGap,
|
||||||
// stateZoneObjects //
|
iFVGObj //
|
||||||
// );
|
);
|
||||||
// if (IsValidSize(stateZoneObjectsCount))
|
if (isCreated)
|
||||||
// {
|
{
|
||||||
// //
|
//
|
||||||
// Copy(
|
Add(
|
||||||
// stateZoneObjects,
|
(XCBaseObject *)iFVGObj,
|
||||||
// drawnObjects,
|
drawnObjects //
|
||||||
// false // Force Clean ...
|
);
|
||||||
// );
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6425,6 +6425,110 @@ struct XFVGOrderBlock
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve Boundary of Zone ...
|
||||||
|
*
|
||||||
|
* @param upper: Upper Boundary ...ّ
|
||||||
|
* @param lower: Lower Bondary ...
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool GetBoundary(
|
||||||
|
double &upper,
|
||||||
|
double &lower //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
upper = 0;
|
||||||
|
lower = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
upper = orderBlock.Upper();
|
||||||
|
upper = MathMax(upper, fairValueGap.Upper());
|
||||||
|
|
||||||
|
//
|
||||||
|
lower = orderBlock.Lower();
|
||||||
|
lower = MathMax(lower, fairValueGap.Lower());
|
||||||
|
|
||||||
|
//
|
||||||
|
result = lower > 0 &&
|
||||||
|
upper > 0 &&
|
||||||
|
upper > lower;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check Model is same as another Istance ...
|
||||||
|
*
|
||||||
|
* @param value: XFVGOrderBlock instance Reference ...
|
||||||
|
*
|
||||||
|
* @return ( bool )
|
||||||
|
*/
|
||||||
|
bool IsSameAs(XFVGOrderBlock &value)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
IsValid() &&
|
||||||
|
value.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION dir;
|
||||||
|
result = GetDirection(dir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_DIRECTION valueDir;
|
||||||
|
result = value.GetDirection(valueDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
dir = valueDir
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
orderBlock.From() == value.orderBlock.From() &&
|
||||||
|
orderBlock.Upper() == value.orderBlock.Upper() &&
|
||||||
|
orderBlock.Lower() == value.orderBlock.Lower()
|
||||||
|
//
|
||||||
|
&&
|
||||||
|
//
|
||||||
|
fairValueGap.From() == value.fairValueGap.From() &&
|
||||||
|
fairValueGap.Upper() == value.fairValueGap.Upper() &&
|
||||||
|
fairValueGap.Lower() == value.fairValueGap.Lower()
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
//
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -8819,7 +8923,7 @@ bool CalculateStateZones(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = zones.IsValid();
|
result = zones.IsValid();
|
||||||
|
|
||||||
@@ -9055,15 +9159,9 @@ bool IsPriceAboveZone(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double ask = GetAsk(bar.symbol);
|
|
||||||
double bid = GetBid(bar.symbol);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
ask > zone.Upper() &&
|
|
||||||
bid > zone.Upper() &&
|
|
||||||
bar.low > zone.Upper()
|
bar.low > zone.Upper()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -9131,16 +9229,10 @@ bool IsPriceBelowZone(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double ask = GetAsk(bar.symbol);
|
|
||||||
double bid = GetBid(bar.symbol);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
ask < zone.Lower() &&
|
bar.high < zone.Lower()
|
||||||
bid < zone.Lower() &&
|
|
||||||
bar.low < zone.Lower()
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -9207,21 +9299,13 @@ bool IsPriceInsideZone(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double ask = GetAsk(bar.symbol);
|
|
||||||
double bid = GetBid(bar.symbol);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
ask <= zone.Upper() &&
|
|
||||||
bid <= zone.Upper() &&
|
|
||||||
bar.low <= zone.Upper()
|
bar.low <= zone.Upper()
|
||||||
//
|
//
|
||||||
&&
|
&&
|
||||||
//
|
//
|
||||||
ask >= zone.Lower() &&
|
|
||||||
bid >= zone.Lower() &&
|
|
||||||
bar.low >= zone.Lower()
|
bar.low >= zone.Lower()
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
@@ -9249,21 +9333,13 @@ bool IsPriceInsideZone(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
double ask = GetAsk(bar.symbol);
|
|
||||||
double bid = GetBid(bar.symbol);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result =
|
result =
|
||||||
//
|
//
|
||||||
ask <= upper &&
|
|
||||||
bid <= upper &&
|
|
||||||
bar.low <= upper
|
bar.low <= upper
|
||||||
//
|
//
|
||||||
&&
|
&&
|
||||||
//
|
//
|
||||||
ask >= lower &&
|
|
||||||
bid >= lower &&
|
|
||||||
bar.low >= lower
|
bar.low >= lower
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1326,15 +1326,19 @@ class XC121SMCExpert : public XCBaseExpert
|
|||||||
//
|
//
|
||||||
// Check Force Close ...
|
// Check Force Close ...
|
||||||
string forceCloseTimeStr = CloseAllTradesAt();
|
string forceCloseTimeStr = CloseAllTradesAt();
|
||||||
datetime forceCloseTime = ParseDateTimeFromTimeString(forceCloseTimeStr);
|
if (IsValid(forceCloseTimeStr))
|
||||||
bool canForceClose = IsTimeInRange(
|
|
||||||
TimeCurrent(),
|
|
||||||
forceCloseTime //
|
|
||||||
) &&
|
|
||||||
!mIsForceCloseAtTime;
|
|
||||||
if (canForceClose)
|
|
||||||
{
|
{
|
||||||
mIsForceCloseAtTime = mTradeHandler.ForceClose();
|
//
|
||||||
|
datetime forceCloseTime = ParseDateTimeFromTimeString(forceCloseTimeStr);
|
||||||
|
bool canForceClose = IsTimeInRange(
|
||||||
|
TimeCurrent(),
|
||||||
|
forceCloseTime //
|
||||||
|
) &&
|
||||||
|
!mIsForceCloseAtTime;
|
||||||
|
if (canForceClose)
|
||||||
|
{
|
||||||
|
mIsForceCloseAtTime = mTradeHandler.ForceClose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
datetime triggerTime;
|
datetime triggerTime;
|
||||||
|
|
||||||
//
|
//
|
||||||
XFVGOrderBlock bullishOrderBlocks[];
|
XFVGOrderBlock fvgOB;
|
||||||
XFVGOrderBlock bearishOrderBlocks[];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constructor ...
|
// Constructor ...
|
||||||
@@ -166,40 +165,20 @@ struct X121SMCStrategyXTWPVSignalConditions
|
|||||||
*/
|
*/
|
||||||
void ExtensionClean()
|
void ExtensionClean()
|
||||||
{
|
{
|
||||||
//
|
fvgOB.Clean();
|
||||||
Clean(bullishOrderBlocks);
|
|
||||||
Clean(bearishOrderBlocks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Order Blocks Date ...
|
* Update Order Blocks Date ...
|
||||||
*/
|
*/
|
||||||
void UpdateOrderBlocks() {
|
void UpdateOrderBlocks()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
int count = 0;
|
|
||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
//
|
//
|
||||||
count = ArraySize(bullishOrderBlocks);
|
fvgOB.orderBlock.To(cTime);
|
||||||
if (IsValidSize(count)) {
|
fvgOB.fairValueGap.To(cTime);
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
//
|
|
||||||
bullishOrderBlocks[i].orderBlock.To(cTime);
|
|
||||||
bullishOrderBlocks[i].fairValueGap.To(cTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
count = ArraySize(bearishOrderBlocks);
|
|
||||||
if (IsValidSize(count)) {
|
|
||||||
//
|
|
||||||
for (int i = 0; i < count; i++) {
|
|
||||||
//
|
|
||||||
bearishOrderBlocks[i].orderBlock.To(cTime);
|
|
||||||
bearishOrderBlocks[i].fairValueGap.To(cTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -447,14 +426,14 @@ bool DetectX121SMCXTWPVSiganlSetup(
|
|||||||
|
|
||||||
//
|
//
|
||||||
conditions.dir = forDir;
|
conditions.dir = forDir;
|
||||||
Copy(
|
if (isBullish)
|
||||||
bullishOrderBlocks,
|
{
|
||||||
conditions.bullishOrderBlocks //
|
conditions.fvgOB = bullishOrderBlocks[0];
|
||||||
);
|
}
|
||||||
Copy(
|
else
|
||||||
bearishOrderBlocks,
|
{
|
||||||
conditions.bearishOrderBlocks //
|
conditions.fvgOB = bearishOrderBlocks[0];
|
||||||
);
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
conditions.setupTime = cTime;
|
conditions.setupTime = cTime;
|
||||||
@@ -483,7 +462,7 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
XC121SMCCycleHelper *consolidationCycleHelper,
|
XC121SMCCycleHelper *consolidationCycleHelper,
|
||||||
XC121SMCCycleHelper *visionCycleHelper,
|
XC121SMCCycleHelper *visionCycleHelper,
|
||||||
//
|
//
|
||||||
int maxAllowedSetupAge = 0 //
|
int maxAllowedSetupAge = 576 //
|
||||||
//
|
//
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -684,86 +663,44 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
//
|
//
|
||||||
// Trigger Conditions ...
|
// Trigger Conditions ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double decisionPeak = decisionConditions.x121Conditions.peaksBuffer[1];
|
||||||
|
double isNewDecisionPeak = decisionConditions.x121Conditions.isNewPeak;
|
||||||
|
|
||||||
|
//
|
||||||
|
double decisionVale = decisionConditions.x121Conditions.valesBuffer[1];
|
||||||
|
double isNewDecisionVale = decisionConditions.x121Conditions.isNewVale;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Waits For Price to Go Inside FVG ...
|
// Waits For Price to Go Inside FVG ...
|
||||||
XFVGOrderBlock fvgOrderBlock;
|
bool isPriceInsideOB = IsPriceInsideZone(
|
||||||
bool isPriceInsideOB = false;
|
cBar,
|
||||||
bool isPriceInsideFVG = false;
|
conditions.fvgOB.orderBlock //
|
||||||
if (isBullish)
|
);
|
||||||
{
|
|
||||||
//
|
|
||||||
int count = ArraySize(conditions.bullishOrderBlocks);
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XFVGOrderBlock iModel = conditions.bullishOrderBlocks[i];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
isPriceInsideOB = IsPriceInsideZone(
|
bool isPriceInsideFVG = IsPriceInsideZone(
|
||||||
cBar,
|
cBar,
|
||||||
iModel.orderBlock //
|
conditions.fvgOB.fairValueGap //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
isPriceInsideFVG = IsPriceInsideZone(
|
|
||||||
cBar,
|
|
||||||
iModel.fairValueGap //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isPriceInsideOB &&
|
|
||||||
isPriceInsideFVG)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
fvgOrderBlock = iModel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isPriceInsideOB = false;
|
|
||||||
isPriceInsideFVG = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
int count = ArraySize(conditions.bearishOrderBlocks);
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XFVGOrderBlock iModel = conditions.bearishOrderBlocks[i];
|
|
||||||
|
|
||||||
//
|
|
||||||
isPriceInsideOB = IsPriceInsideZone(
|
|
||||||
cBar,
|
|
||||||
iModel.orderBlock //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isPriceInsideFVG = IsPriceInsideZone(
|
|
||||||
cBar,
|
|
||||||
iModel.fairValueGap //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isPriceInsideOB &&
|
|
||||||
isPriceInsideFVG)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
fvgOrderBlock = iModel;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
isPriceInsideOB = false;
|
|
||||||
isPriceInsideFVG = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isPriceInsideOB &&
|
result = isPriceInsideOB &&
|
||||||
isPriceInsideFVG &&
|
isPriceInsideFVG &&
|
||||||
fvgOrderBlock.IsValid();
|
conditions.fvgOB.IsValid();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
double fvgOBUpper = 0;
|
||||||
|
double fvgOBLower = 0;
|
||||||
|
bool hasBoundary = conditions.fvgOB.GetBoundary(
|
||||||
|
fvgOBUpper,
|
||||||
|
fvgOBLower //
|
||||||
|
);
|
||||||
|
result = hasBoundary;
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
@@ -773,13 +710,15 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
// Detect Bullish Conditions ...
|
// Detect Bullish Conditions ...
|
||||||
isBullish =
|
isBullish =
|
||||||
isBullish &&
|
isBullish &&
|
||||||
cBar.IsBullish();
|
cBar.IsBullish() &&
|
||||||
|
isNewDecisionVale;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Bearish Conditions ...
|
// Detect Bearish Conditions ...
|
||||||
isBearish =
|
isBearish =
|
||||||
isBearish &&
|
isBearish &&
|
||||||
cBar.IsBearish();
|
cBar.IsBearish() &&
|
||||||
|
isNewDecisionPeak;
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isBullish ||
|
result = isBullish ||
|
||||||
@@ -788,13 +727,6 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Cleanup Setup Conditions ...
|
// Cleanup Setup Conditions ...
|
||||||
// int setupAge = conditions.GetSetupAge();
|
|
||||||
// if (IsValidSize(setupAge) &&
|
|
||||||
// IsValidSize(maxAllowedSetupAge) &&
|
|
||||||
// setupAge >= maxAllowedSetupAge)
|
|
||||||
// {
|
|
||||||
// conditions.Clean();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -844,6 +776,22 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
double peak = triggerConditions.x121Conditions.peaksBuffer[1];
|
||||||
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
double vale = triggerConditions.x121Conditions.valesBuffer[1];
|
||||||
|
|
||||||
|
//
|
||||||
|
if (conditions.fvgOB.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
fvgOBUpper,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
fvgOBLower,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
if (isBullish)
|
||||||
{
|
{
|
||||||
@@ -857,6 +805,12 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
sls //
|
sls //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Add(
|
||||||
|
vale,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (isBearish)
|
else if (isBearish)
|
||||||
{
|
{
|
||||||
@@ -870,11 +824,12 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
sls //
|
sls //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if (ArraySize(sls) == 0)
|
Add(
|
||||||
{
|
peak,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -927,6 +882,71 @@ bool DetectX121SMCXTWPVSiganlTrigger(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int AddX121SMCXTWPVConditionsIfNotExists(
|
||||||
|
X121SMCStrategyXTWPVSignalConditions &item,
|
||||||
|
X121SMCStrategyXTWPVSignalConditions &items[] //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isSetuped = IsValid(item.setupTime) &&
|
||||||
|
HasDirection(item.dir);
|
||||||
|
if (!isSetuped)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int count = ArraySize(items);
|
||||||
|
bool canAdd = !IsValidSize(count);
|
||||||
|
if (!canAdd)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Prese Item Data ...
|
||||||
|
bool isBullish = IsBullish(item.dir);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool hasSame = false;
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
X121SMCStrategyXTWPVSignalConditions iItem = items[i];
|
||||||
|
|
||||||
|
//
|
||||||
|
hasSame = iItem.fvgOB.IsSameAs(item.fvgOB);
|
||||||
|
if (hasSame)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
canAdd = !hasSame;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (canAdd)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
AddRef(
|
||||||
|
item,
|
||||||
|
items //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Remove Olds ...
|
||||||
|
|
||||||
|
//
|
||||||
|
result = ArraySize(items);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw Signal ...
|
// Draw Signal ...
|
||||||
int DrawX121SMCXTWPVSiganl(
|
int DrawX121SMCXTWPVSiganl(
|
||||||
|
|||||||
@@ -478,6 +478,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// XTWPV Signal ...
|
// XTWPV Signal ...
|
||||||
X121SMCStrategyXTWPVSignalConditions mXTWPVConditions;
|
X121SMCStrategyXTWPVSignalConditions mXTWPVConditions;
|
||||||
|
X121SMCStrategyXTWPVSignalConditions mXTWPVConditionsCollection[];
|
||||||
bool DetectXTWPVSignal(
|
bool DetectXTWPVSignal(
|
||||||
X121SMCStrategyConditions &conditions //
|
X121SMCStrategyConditions &conditions //
|
||||||
)
|
)
|
||||||
@@ -489,10 +490,52 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
bool isBullish = false;
|
bool isBullish = false;
|
||||||
bool isBearish = false;
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIndex = 0;
|
||||||
|
int cIndex = zIndex + 1;
|
||||||
|
int pIndex = cIndex + 1;
|
||||||
|
int ppIndex = pIndex + 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
ENUM_TIMEFRAMES period = GetPeriod();
|
ENUM_TIMEFRAMES period = GetPeriod();
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
result = zBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
zIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL cBar;
|
||||||
|
result = cBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
cIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL pBar;
|
||||||
|
result = pBar.Init(
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
pIndex //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
datetime cTime = TimeCurrent();
|
datetime cTime = TimeCurrent();
|
||||||
|
|
||||||
@@ -524,81 +567,111 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
setupDir = mXTWPVConditions.dir;
|
setupDir = mXTWPVConditions.dir;
|
||||||
setupTime = mXTWPVConditions.setupTime;
|
setupTime = mXTWPVConditions.setupTime;
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
if (isSetuped)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
mXTWPVConditions.UpdateOrderBlocks();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XCBaseObject *bullDrawnObjects[];
|
if (isSetuped)
|
||||||
int bullDrawnObjectsCount = mPOIDrawer.DrawFVGOrderBlock(
|
|
||||||
mXTWPVConditions.bullishOrderBlocks,
|
|
||||||
bullDrawnObjects //
|
|
||||||
);
|
|
||||||
if (IsValidSize(bullDrawnObjectsCount))
|
|
||||||
{
|
{
|
||||||
AddObjectsIfNotExists(bullDrawnObjects);
|
//
|
||||||
}
|
AddRef(
|
||||||
|
mXTWPVConditions,
|
||||||
|
mXTWPVConditionsCollection);
|
||||||
|
|
||||||
//
|
//
|
||||||
XCBaseObject *bearDrawnObjects[];
|
mXTWPVConditions.Clean();
|
||||||
int bearDrwanObjectsCount = mPOIDrawer.DrawFVGOrderBlock(
|
|
||||||
mXTWPVConditions.bearishOrderBlocks,
|
|
||||||
bearDrawnObjects //
|
|
||||||
);
|
|
||||||
if (IsValidSize(bearDrwanObjectsCount))
|
|
||||||
{
|
|
||||||
AddObjectsIfNotExists(bearDrawnObjects);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = isSetuped;
|
int conditionsCount = ArraySize(mXTWPVConditionsCollection);
|
||||||
|
result = IsValidSize(conditionsCount);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Detect Trigger Conditions ...
|
// Looking For Conditions ...
|
||||||
bool canTrigger = mXTWPVConditions.CanTrigger();
|
int selectedIndex = 0;
|
||||||
datetime triggerTime = mXTWPVConditions.triggerTime;
|
X121SMCStrategyXTWPVSignalConditions mConditions;
|
||||||
if (!canTrigger)
|
for (int i = 0; i < conditionsCount; i++)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Detect Signal Trigger ...
|
// Update Conditions ...
|
||||||
canTrigger = DetectX121SMCXTWPVSiganlTrigger(
|
mXTWPVConditionsCollection[i].UpdateOrderBlocks();
|
||||||
mXTWPVConditions,
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
mTriggerCycleHelper,
|
|
||||||
mDecisionCycleHelper,
|
|
||||||
mAnalyseCycleHelper,
|
|
||||||
mVerificationCycleHelper,
|
|
||||||
mConsolidationCycleHelper,
|
|
||||||
mVisionCycleHelper //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
result = canTrigger;
|
// Draw Conditions ...
|
||||||
if (!result)
|
|
||||||
|
//
|
||||||
|
XFVGOrderBlock iFVGOB = mXTWPVConditionsCollection[i].fvgOB;
|
||||||
|
XCBaseObject *drawnObjects[];
|
||||||
|
mPOIDrawer.DrawFVGOrderBlock(
|
||||||
|
iFVGOB,
|
||||||
|
drawnObjects //
|
||||||
|
);
|
||||||
|
AddObjectsIfNotExists(drawnObjects);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Triggers ...
|
||||||
|
bool canTrigger = mXTWPVConditionsCollection[i].CanTrigger();
|
||||||
|
datetime triggerTime = mXTWPVConditionsCollection[i].triggerTime;
|
||||||
|
if (!canTrigger)
|
||||||
{
|
{
|
||||||
return result;
|
//
|
||||||
|
// Detect Signal Trigger ...
|
||||||
|
canTrigger = DetectX121SMCXTWPVSiganlTrigger(
|
||||||
|
mXTWPVConditionsCollection[i],
|
||||||
|
symbol,
|
||||||
|
period,
|
||||||
|
mTriggerCycleHelper,
|
||||||
|
mDecisionCycleHelper,
|
||||||
|
mAnalyseCycleHelper,
|
||||||
|
mVerificationCycleHelper,
|
||||||
|
mConsolidationCycleHelper,
|
||||||
|
mVisionCycleHelper //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
result = canTrigger;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
triggerTime = mXTWPVConditionsCollection[i].triggerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
triggerTime = mXTWPVConditions.triggerTime;
|
if (canTrigger)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
selectedIndex = i;
|
||||||
|
mConditions = mXTWPVConditionsCollection[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Signal Direction ...
|
result = IsValid(mConditions.setupTime) &&
|
||||||
|
HasDirection(mConditions.dir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
isBullish = IsBullish(setupDir);
|
// Remove Selected Index from Main Collection ...
|
||||||
isBearish = IsBearish(setupDir);
|
ArrayRemove(
|
||||||
|
mXTWPVConditionsCollection,
|
||||||
|
selectedIndex,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Signal Direction ...
|
||||||
|
isBullish = IsBullish(mConditions.dir);
|
||||||
|
isBearish = IsBearish(mConditions.dir);
|
||||||
result = isBullish ||
|
result = isBullish ||
|
||||||
isBearish;
|
isBearish;
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -608,26 +681,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Issues Signal on Conditions ...
|
// Issues Signal on Conditions ...
|
||||||
conditions.signalDir = setupDir;
|
conditions.sl = mConditions.sl;
|
||||||
conditions.provider = providerStr;
|
conditions.provider = providerStr;
|
||||||
conditions.sl = mXTWPVConditions.sl;
|
conditions.signalDir = mConditions.dir;
|
||||||
conditions.target = mXTWPVConditions.target;
|
conditions.target = mConditions.target;
|
||||||
|
|
||||||
//
|
|
||||||
// TODO: Remove ...
|
|
||||||
// conditions.decisionZones = mXTWPVConditions.decisionZone;
|
|
||||||
// conditions.marketStructure = mXTWPVConditions.analyseMarketStructure;
|
|
||||||
// if (isBullish)
|
|
||||||
// {
|
|
||||||
// conditions.priceZones = mXTWPVConditions.valePriceZone;
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// conditions.priceZones = mXTWPVConditions.peakPriceZone;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//
|
|
||||||
mXTWPVConditions.Clean();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
@@ -685,7 +742,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
x121Inputs.Default();
|
x121Inputs.Default();
|
||||||
|
|
||||||
//
|
//
|
||||||
x121Inputs.showRSI = false;
|
x121Inputs.showRSI = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isInited = false;
|
bool isInited = false;
|
||||||
@@ -710,14 +767,14 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XATR ...
|
// XATR ...
|
||||||
x121Inputs.xatrInputs.showATRUpper = true;
|
x121Inputs.xatrInputs.showATRUpper = false;
|
||||||
x121Inputs.xatrInputs.showATRLower = true;
|
x121Inputs.xatrInputs.showATRLower = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XSTR ...
|
||||||
x121Inputs.xstrInputs.showStr = true;
|
x121Inputs.xstrInputs.showStr = true;
|
||||||
x121Inputs.xstrInputs.showStrUpper = true;
|
x121Inputs.xstrInputs.showStrUpper = false;
|
||||||
x121Inputs.xstrInputs.showStrLower = true;
|
x121Inputs.xstrInputs.showStrLower = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XDON ...
|
// XDON ...
|
||||||
@@ -729,7 +786,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// XVWAP ...
|
// XVWAP ...
|
||||||
x121Inputs.xvwapInputs.showVWapFast = false;
|
x121Inputs.xvwapInputs.showVWapFast = false;
|
||||||
x121Inputs.xvwapInputs.showVWapFast = false;
|
x121Inputs.xvwapInputs.showVWapMedium = false;
|
||||||
x121Inputs.xvwapInputs.showVWapSlow = false;
|
x121Inputs.xvwapInputs.showVWapSlow = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user