last ...
This commit is contained in:
@@ -1601,6 +1601,67 @@ class XCBarAnalyser : public XCBase
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Fibonacci Level 382 Pressure ...
|
||||
*
|
||||
* @param bar: XOHCL instance ...
|
||||
* @param dir: ENUM_X_DIRECTION member ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasFiboPressure(
|
||||
XOHCL &bar,
|
||||
ENUM_X_DIRECTION &dir //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
double bearishFib382 = GetFibonacciLevel(
|
||||
bar.high,
|
||||
bar.low,
|
||||
0.382,
|
||||
1 //
|
||||
);
|
||||
double bullishFib382 = GetFibonacciLevel(
|
||||
bar.high,
|
||||
bar.low,
|
||||
0.382,
|
||||
-1 //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBullish = bar.GetDown() > bearishFib382;
|
||||
bool isBearish = bar.GetUp() < bullishFib382;
|
||||
|
||||
//
|
||||
result = isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
dir = isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Support and Resistance Zones ...
|
||||
|
||||
|
||||
+426
-47
@@ -69,7 +69,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Conditions Parsing ...
|
||||
///////////////////////////////////////////////////////////////////
|
||||
@@ -168,8 +167,6 @@
|
||||
XCSwing *m1SwingHigh;
|
||||
XCSwing *m1SwingLow;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Clean Method ...
|
||||
|
||||
@@ -268,7 +265,6 @@
|
||||
// Tools Functions ...
|
||||
//
|
||||
|
||||
|
||||
//
|
||||
// Custom Tools ...
|
||||
|
||||
@@ -365,7 +361,6 @@
|
||||
//
|
||||
// Strategy Class Calling on Conditions Detections ...
|
||||
|
||||
|
||||
//
|
||||
// Detect Market Structures ...
|
||||
|
||||
@@ -811,12 +806,10 @@
|
||||
//
|
||||
// DrawState(_5MState);
|
||||
|
||||
|
||||
//
|
||||
//
|
||||
// Strategy Class Tools Functions ...
|
||||
|
||||
|
||||
/**
|
||||
* Detect Specified States Market Structure ...
|
||||
*
|
||||
@@ -1042,11 +1035,8 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Detect Order Blocks ...
|
||||
// int obsCount = 0;
|
||||
@@ -1247,11 +1237,8 @@
|
||||
// // Find an Order Block ...
|
||||
// bool isBearishOrderBlockRejected = false;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//
|
||||
RedrawOrderFlow();
|
||||
|
||||
@@ -1271,8 +1258,6 @@
|
||||
hasPullBack &&
|
||||
pullBackDir == X_DIRECTION_BEARISH;
|
||||
|
||||
|
||||
|
||||
//
|
||||
bool isInDiscount =
|
||||
bid < pivotMid &&
|
||||
@@ -1317,8 +1302,6 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Check 3MA and 3VWAP State ...
|
||||
|
||||
@@ -1513,8 +1496,6 @@
|
||||
//
|
||||
;
|
||||
|
||||
|
||||
|
||||
// //
|
||||
// hasLong =
|
||||
// //
|
||||
@@ -1537,9 +1518,6 @@
|
||||
// //
|
||||
// ;
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////
|
||||
|
||||
//
|
||||
@@ -1572,7 +1550,6 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
// //
|
||||
@@ -1673,7 +1650,6 @@
|
||||
// //
|
||||
// m1MPOI.Init();
|
||||
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
// delete m1DPOI;
|
||||
@@ -1684,10 +1660,8 @@
|
||||
// delete m5MPOI;
|
||||
// delete m1MPOI;
|
||||
|
||||
|
||||
///////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// Point Of Interests ...
|
||||
XCPOIDetector *mTriggerPOIDetector;
|
||||
@@ -1717,8 +1691,6 @@
|
||||
// XPOIState _1MState;
|
||||
// XPOIState _CombineState;
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////
|
||||
|
||||
//
|
||||
@@ -1803,7 +1775,6 @@
|
||||
// _States //
|
||||
// );
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
@@ -1840,7 +1811,6 @@
|
||||
selectedSL = conditions.xpvConditions.peaks[cIndex];
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// mOrderFlow[pivotIDX].state.ticksZone =
|
||||
@@ -2077,7 +2047,6 @@
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
|
||||
/**
|
||||
@@ -2149,10 +2118,8 @@
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
|
||||
|
||||
bool canContinue = true;
|
||||
while (canContinue)
|
||||
{
|
||||
@@ -2262,11 +2229,8 @@
|
||||
bearOB = mBearOB;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// Detect an Order Block in Vision ...
|
||||
if (conditions.visionBullOB == NULL ||
|
||||
@@ -2592,10 +2556,8 @@
|
||||
// conditions.sl = conditions.triggerConditions.xchsarConditions.cSars[0];
|
||||
// }
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
bool isSamePeaks =
|
||||
//
|
||||
@@ -2607,7 +2569,8 @@
|
||||
// conditions.consolidationConditions.x121Conditions.peaksBuffer[0] == conditions.visionConditions.x121Conditions.peaksBuffer[0]
|
||||
//
|
||||
;
|
||||
if (isSamePeaks) {
|
||||
if (isSamePeaks)
|
||||
{
|
||||
Print("isSamePeaks");
|
||||
}
|
||||
|
||||
@@ -2622,14 +2585,13 @@
|
||||
// conditions.consolidationConditions.x121Conditions.valesBuffer[0] == conditions.visionConditions.x121Conditions.valesBuffer[0]
|
||||
//
|
||||
;
|
||||
if (isSameVales) {
|
||||
if (isSameVales)
|
||||
{
|
||||
Print("isSameVales");
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
// Detect Valid Supply and Demand Zones ...
|
||||
XCSupplyZone *supplyZone;
|
||||
@@ -2678,10 +2640,8 @@
|
||||
//
|
||||
Print("Supply and Demand Zone Created ...");
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//
|
||||
int consolidationsCount = mTriggerCycleHelper.CountConsolidationZones();
|
||||
result = IsValidSize(consolidationsCount);
|
||||
@@ -2787,10 +2747,8 @@
|
||||
//
|
||||
Print("BID Inside Zone ...");
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
bool DetectCandlestic(
|
||||
ENUM_X_DIRECTION &dir,
|
||||
X121SMCStrategyConditions &conditions //
|
||||
@@ -2976,6 +2934,427 @@
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Detect Nearest Supply/Demand Zones ...
|
||||
*
|
||||
* @param bar: XOHCL instance, Start Bar ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectValisSupplyZone(
|
||||
XOHCL &bar,
|
||||
XCSupplyZone *&supplyZone,
|
||||
XCDemandZone *&demandZone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int index = bar.Index();
|
||||
|
||||
//
|
||||
double bid = GetBid(bar.symbol);
|
||||
double ask = GetAsk(bar.symbol);
|
||||
|
||||
//
|
||||
// Retrieve X121 Cnditions ...
|
||||
int conditionsLoopback = 10;
|
||||
X121Conditions x121Conditions;
|
||||
result = mX121Helper.GetConditions(
|
||||
x121Conditions,
|
||||
index,
|
||||
conditionsLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
int validPeaksCount = ArraySize(x121Conditions.validPeaksBuffer);
|
||||
int validValesCount = ArraySize(x121Conditions.validValesBuffer);
|
||||
|
||||
//
|
||||
XPOIState state;
|
||||
ENUM_XPOI_EVENTS events[];
|
||||
mPOIDetector.Update(events);
|
||||
mPOIDetector.GetState(state);
|
||||
result = state.IsValid() &&
|
||||
state.HasChild();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
XCSupplyZone *supplies[];
|
||||
int suppliesCount = state.CountSupplyZones();
|
||||
|
||||
//
|
||||
// Select Bar Validated Supply Zones ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = state.supplyZones[i];
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.high < iZone.Lower() &&
|
||||
ask < iZone.Lower() &&
|
||||
bid < iZone.Lower();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
supplies //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
suppliesCount = ArraySize(supplies);
|
||||
|
||||
//
|
||||
// Select Valid Peaks Filtered Supplies ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
// Check Valid Peaks ...
|
||||
XCSupplyZone *tmp[];
|
||||
if (IsValidSize(validPeaksCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = supplies[i];
|
||||
|
||||
//
|
||||
for (int j = 0; j < validPeaksCount; j++)
|
||||
{
|
||||
//
|
||||
double value = x121Conditions.validPeaksBuffer[j];
|
||||
|
||||
//
|
||||
// Check Valid Peaks in Zone ...
|
||||
bool isZoneContainsValidValue =
|
||||
value >= iZone.Lower() &&
|
||||
value <= iZone.Upper();
|
||||
if (isZoneContainsValidValue)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
tmp //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(supplies);
|
||||
Copy(
|
||||
tmp,
|
||||
supplies //
|
||||
);
|
||||
}
|
||||
suppliesCount = ArraySize(supplies);
|
||||
|
||||
//
|
||||
// Select Nearest Supply Zone ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
// Check Nearest Supplies ...
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = supplies[i];
|
||||
if (supplyZone == NULL)
|
||||
{
|
||||
supplyZone = iZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bool canChange =
|
||||
iZone.Lower() < supplyZone.Lower();
|
||||
if (canChange)
|
||||
{
|
||||
supplyZone = iZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
XCDemandZone *demands[];
|
||||
int demandsCount = state.CountDemandZones();
|
||||
|
||||
//
|
||||
// Select Bar Validated Demand Zones ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = state.demandZones[i];
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.low > iZone.Upper() &&
|
||||
ask > iZone.Upper() &&
|
||||
bid > iZone.Upper();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
demands //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
demandsCount = ArraySize(demands);
|
||||
|
||||
//
|
||||
// Select Valid Vales Filtered Demands ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
// Check Valid Vales ...
|
||||
XCDemandZone *tmp[];
|
||||
if (IsValidSize(validValesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = demands[i];
|
||||
|
||||
//
|
||||
for (int j = 0; j < validValesCount; j++)
|
||||
{
|
||||
//
|
||||
double value = x121Conditions.validValesBuffer[j];
|
||||
|
||||
//
|
||||
// Check Valid Peaks in Zone ...
|
||||
bool isZoneContainsValidValue =
|
||||
value >= iZone.Lower() &&
|
||||
value <= iZone.Upper();
|
||||
if (isZoneContainsValidValue)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
tmp //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(demands);
|
||||
Copy(
|
||||
tmp,
|
||||
demands //
|
||||
);
|
||||
}
|
||||
demandsCount = ArraySize(demands);
|
||||
|
||||
//
|
||||
// Select Nearest Demand Zone ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
// Check Nearest Demands ...
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = demands[i];
|
||||
if (demandZone == NULL)
|
||||
{
|
||||
demandZone = iZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bool canChange =
|
||||
iZone.Upper() > demandZone.Upper();
|
||||
if (canChange)
|
||||
{
|
||||
demandZone = iZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Founded Zones ...
|
||||
result = (supplyZone != NULL &&
|
||||
supplyZone.IsValid()) &&
|
||||
(demandZone != NULL &&
|
||||
demandZone.IsValid());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
CustomStateDrawing(
|
||||
conditions.consolidationConditions.state,
|
||||
false, //
|
||||
X_DIRECTION_NONE,
|
||||
false, // ignoreSwingHighs
|
||||
false, // ignoreSwingLows
|
||||
false, // ignoreSupportZones
|
||||
false, // ignoreResistanceZones
|
||||
false, // ignoreSupplyZones
|
||||
false, // ignoreDemandZones
|
||||
true, // ignoreBullishOrderBlocks
|
||||
true, // ignoreBearishOrderBlocks
|
||||
true, // ignoreBullishFairValueGaps
|
||||
true, // ignoreBearishFairValueGaps
|
||||
true, // ignoreBullishRejectionBars
|
||||
true, // ignoreBearishRejectionBars
|
||||
true, // ignoreBullishMomentumBars
|
||||
true // ignoreBearishMomentumBars
|
||||
);
|
||||
|
||||
//
|
||||
// TODO: Remove ...
|
||||
// Draw ...
|
||||
if (hasVisionSupplyZone && visionSupplyZone != NULL)
|
||||
{
|
||||
//
|
||||
visionSupplyZone.To(TimeCurrent());
|
||||
XCSupplyZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSupplyZone(
|
||||
visionSupplyZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.ZoneWidth(4);
|
||||
iObj.ZoneColor(clrMagenta);
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Remove ...
|
||||
// Draw ...
|
||||
if (hasVisionDemandZone && visionDemandZone != NULL)
|
||||
{
|
||||
//
|
||||
visionDemandZone.To(TimeCurrent());
|
||||
XCDemandZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateDemandZone(
|
||||
visionDemandZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
//
|
||||
iObj.ZoneWidth(4);
|
||||
iObj.ZoneColor(clrAqua);
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (result)
|
||||
{
|
||||
ClearDraws();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
// Draw ...
|
||||
if (hasConsolidationSupportZone &&
|
||||
consolidationSupportZone != NULL)
|
||||
{
|
||||
//
|
||||
consolidationSupportZone.To(TimeCurrent());
|
||||
XCSupportZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateSupportZone(
|
||||
consolidationSupportZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// TODO: Remove this ...
|
||||
// Draw ...
|
||||
if (hasConsolidationResistanceZone &&
|
||||
consolidationResistanceZone != NULL)
|
||||
{
|
||||
//
|
||||
consolidationResistanceZone.To(TimeCurrent());
|
||||
XCResistanceZoneObject *iObj;
|
||||
bool isCreated = mPOIDrawer.CreateResistanceZone(
|
||||
consolidationResistanceZone,
|
||||
iObj //
|
||||
);
|
||||
if (isCreated)
|
||||
{
|
||||
AddObjectIfNotExists(iObj);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
XCSwing *swingLow = NULL;
|
||||
XCSwing *swingHigh = NULL;
|
||||
bool isSwingLowRejected = false;
|
||||
bool isSwingHighRejected = false;
|
||||
int swingLowsCount = decisionConditions.state.CountSwingLows();
|
||||
int swingHighsCount = decisionConditions.state.CountSwingHighs();
|
||||
if (IsValidSize(swingLowsCount))
|
||||
{
|
||||
swingLow = decisionConditions.state.swingLows[swingLowsCount - 1];
|
||||
}
|
||||
if (IsValidSize(swingHighsCount))
|
||||
{
|
||||
swingHigh = decisionConditions.state.swingHighs[swingHighsCount - 1];
|
||||
}
|
||||
|
||||
//
|
||||
isSwingLowRejected = swingLow != NULL &&
|
||||
swingLow.IsValid() &&
|
||||
decisionCBar.low > swingLow.GetValue();
|
||||
|
||||
//
|
||||
isSwingHighRejected = swingHigh != NULL &&
|
||||
swingHigh.IsValid() &&
|
||||
decisionCBar.high < swingHigh.GetValue();
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -463,287 +463,6 @@ class XC121SMCCycleHelper : public XCBase
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Detect Nearest Supply/Demand Zones ...
|
||||
*
|
||||
* @param bar: XOHCL instance, Start Bar ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectValisSupplyZone(
|
||||
XOHCL &bar,
|
||||
XCSupplyZone *&supplyZone,
|
||||
XCDemandZone *&demandZone //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = bar.IsValid();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
int index = bar.Index();
|
||||
|
||||
//
|
||||
double bid = GetBid(bar.symbol);
|
||||
double ask = GetAsk(bar.symbol);
|
||||
|
||||
//
|
||||
// Retrieve X121 Cnditions ...
|
||||
int conditionsLoopback = 10;
|
||||
X121Conditions x121Conditions;
|
||||
result = mX121Helper.GetConditions(
|
||||
x121Conditions,
|
||||
index,
|
||||
conditionsLoopback //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
int validPeaksCount = ArraySize(x121Conditions.validPeaksBuffer);
|
||||
int validValesCount = ArraySize(x121Conditions.validValesBuffer);
|
||||
|
||||
//
|
||||
XPOIState state;
|
||||
ENUM_XPOI_EVENTS events[];
|
||||
mPOIDetector.Update(events);
|
||||
mPOIDetector.GetState(state);
|
||||
result = state.IsValid() &&
|
||||
state.HasChild();
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
XCSupplyZone *supplies[];
|
||||
int suppliesCount = state.CountSupplyZones();
|
||||
|
||||
//
|
||||
// Select Bar Validated Supply Zones ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = state.supplyZones[i];
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.high < iZone.Lower() &&
|
||||
ask < iZone.Lower() &&
|
||||
bid < iZone.Lower();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
supplies //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
suppliesCount = ArraySize(supplies);
|
||||
|
||||
//
|
||||
// Select Valid Peaks Filtered Supplies ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
// Check Valid Peaks ...
|
||||
XCSupplyZone *tmp[];
|
||||
if (IsValidSize(validPeaksCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = supplies[i];
|
||||
|
||||
//
|
||||
for (int j = 0; j < validPeaksCount; j++)
|
||||
{
|
||||
//
|
||||
double value = x121Conditions.validPeaksBuffer[j];
|
||||
|
||||
//
|
||||
// Check Valid Peaks in Zone ...
|
||||
bool isZoneContainsValidValue =
|
||||
value >= iZone.Lower() &&
|
||||
value <= iZone.Upper();
|
||||
if (isZoneContainsValidValue)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
tmp //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(supplies);
|
||||
Copy(
|
||||
tmp,
|
||||
supplies //
|
||||
);
|
||||
}
|
||||
suppliesCount = ArraySize(supplies);
|
||||
|
||||
//
|
||||
// Select Nearest Supply Zone ...
|
||||
if (IsValidSize(suppliesCount))
|
||||
{
|
||||
//
|
||||
// Check Nearest Supplies ...
|
||||
for (int i = 0; i < suppliesCount; i++)
|
||||
{
|
||||
//
|
||||
XCSupplyZone *iZone = supplies[i];
|
||||
if (supplyZone == NULL)
|
||||
{
|
||||
supplyZone = iZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bool canChange =
|
||||
iZone.Lower() < supplyZone.Lower();
|
||||
if (canChange)
|
||||
{
|
||||
supplyZone = iZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
XCDemandZone *demands[];
|
||||
int demandsCount = state.CountDemandZones();
|
||||
|
||||
//
|
||||
// Select Bar Validated Demand Zones ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = state.demandZones[i];
|
||||
|
||||
//
|
||||
// Check Zone is Valid For Bar ...
|
||||
bool isValid = bar.low > iZone.Upper() &&
|
||||
ask > iZone.Upper() &&
|
||||
bid > iZone.Upper();
|
||||
if (isValid)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
demands //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
demandsCount = ArraySize(demands);
|
||||
|
||||
//
|
||||
// Select Valid Vales Filtered Demands ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
// Check Valid Vales ...
|
||||
XCDemandZone *tmp[];
|
||||
if (IsValidSize(validValesCount))
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = demands[i];
|
||||
|
||||
//
|
||||
for (int j = 0; j < validValesCount; j++)
|
||||
{
|
||||
//
|
||||
double value = x121Conditions.validValesBuffer[j];
|
||||
|
||||
//
|
||||
// Check Valid Peaks in Zone ...
|
||||
bool isZoneContainsValidValue =
|
||||
value >= iZone.Lower() &&
|
||||
value <= iZone.Upper();
|
||||
if (isZoneContainsValidValue)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
iZone,
|
||||
tmp //
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(demands);
|
||||
Copy(
|
||||
tmp,
|
||||
demands //
|
||||
);
|
||||
}
|
||||
demandsCount = ArraySize(demands);
|
||||
|
||||
//
|
||||
// Select Nearest Demand Zone ...
|
||||
if (IsValidSize(demandsCount))
|
||||
{
|
||||
//
|
||||
// Check Nearest Demands ...
|
||||
for (int i = 0; i < demandsCount; i++)
|
||||
{
|
||||
//
|
||||
XCDemandZone *iZone = demands[i];
|
||||
if (demandZone == NULL)
|
||||
{
|
||||
demandZone = iZone;
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bool canChange =
|
||||
iZone.Upper() > demandZone.Upper();
|
||||
if (canChange)
|
||||
{
|
||||
demandZone = iZone;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Validate Founded Zones ...
|
||||
result = (supplyZone != NULL &&
|
||||
supplyZone.IsValid()) &&
|
||||
(demandZone != NULL &&
|
||||
demandZone.IsValid());
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect XPV Based POI(s) ...
|
||||
*
|
||||
|
||||
@@ -470,7 +470,8 @@ struct XPVPivotPoint
|
||||
/**
|
||||
* Cleanup ...
|
||||
*/
|
||||
void Clean() {
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
value = 0;
|
||||
repetition = 0;
|
||||
@@ -482,7 +483,8 @@ struct XPVPivotPoint
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsValid() {
|
||||
bool IsValid()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
@@ -1965,5 +1967,195 @@ ENUM_X_121_SMC_PROVIDERS ParseProvider(string value)
|
||||
|
||||
//
|
||||
// Custom Providers Conditions ...
|
||||
struct XTestProiderConditions
|
||||
{
|
||||
//
|
||||
// Props ...
|
||||
|
||||
//
|
||||
string symbol;
|
||||
ENUM_TIMEFRAMES period;
|
||||
|
||||
//
|
||||
double sl;
|
||||
ENUM_X_POSITION_TYPES type;
|
||||
|
||||
//
|
||||
// Setup Props ...
|
||||
|
||||
//
|
||||
bool isNewPeak;
|
||||
bool isNewVale;
|
||||
|
||||
//
|
||||
bool hasVisionSupplyZone;
|
||||
XCSupplyZone *visionSupplyZone;
|
||||
|
||||
//
|
||||
bool hasVisionDemandZone;
|
||||
XCDemandZone *visionDemandZone;
|
||||
|
||||
//
|
||||
bool hasConsolidationSupportZone;
|
||||
XCSupportZone *consolidationSupportZone;
|
||||
|
||||
//
|
||||
bool hasConsolidationResistanceZone;
|
||||
XCResistanceZone *consolidationResistanceZone;
|
||||
|
||||
//
|
||||
double peak;
|
||||
double vale;
|
||||
|
||||
//
|
||||
bool hasSamePeaks;
|
||||
bool hasSameVales;
|
||||
|
||||
//
|
||||
datetime setupTime;
|
||||
datetime triggerTime;
|
||||
|
||||
//
|
||||
// Trigger Props ...
|
||||
|
||||
//
|
||||
// Constructor ...
|
||||
XTestProiderConditions()
|
||||
{
|
||||
Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Tools ...
|
||||
|
||||
/**
|
||||
* Cleaning Up ...
|
||||
*/
|
||||
void Clean()
|
||||
{
|
||||
//
|
||||
sl = 0;
|
||||
peak = 0;
|
||||
vale = 0;
|
||||
|
||||
//
|
||||
isNewPeak = false;
|
||||
isNewVale = false;
|
||||
hasSamePeaks = false;
|
||||
hasSameVales = false;
|
||||
hasVisionSupplyZone = false;
|
||||
hasVisionDemandZone = false;
|
||||
hasConsolidationSupportZone = false;
|
||||
hasConsolidationResistanceZone = false;
|
||||
|
||||
//
|
||||
type = X_POSITION_TYPE_NONE;
|
||||
|
||||
//
|
||||
symbol = NULL;
|
||||
period = NULL;
|
||||
triggerTime = NULL;
|
||||
setupTime = NULL;
|
||||
visionSupplyZone = NULL;
|
||||
visionDemandZone = NULL;
|
||||
consolidationSupportZone = NULL;
|
||||
consolidationResistanceZone = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Condition is Setting Up ...
|
||||
*
|
||||
* @param dir: ENUM_X_DIRECTION member, Setting Up Direction ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool IsSetuped(
|
||||
ENUM_X_DIRECTION &dir //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
dir = X_DIRECTION_NONE;
|
||||
|
||||
//
|
||||
result = IsValid(setupTime);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
bool isBullish =
|
||||
//
|
||||
isNewVale &&
|
||||
hasSamePeaks &&
|
||||
hasSameVales &&
|
||||
hasVisionDemandZone &&
|
||||
visionDemandZone != NULL &&
|
||||
visionDemandZone.IsValid()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isBearish =
|
||||
//
|
||||
isNewPeak &&
|
||||
hasSamePeaks &&
|
||||
hasSameVales &&
|
||||
hasVisionSupplyZone &&
|
||||
visionSupplyZone != NULL &&
|
||||
visionSupplyZone.IsValid()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
result =
|
||||
isBullish ||
|
||||
isBearish;
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
dir =
|
||||
isBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: X_DIRECTION_BEARISH;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect How we Can Trigger Signal ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool CanTrigger()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result =
|
||||
//
|
||||
sl > 0 &&
|
||||
IsValid(symbol) &&
|
||||
IsValid(period) &&
|
||||
IsValid(triggerTime) &&
|
||||
type != X_POSITION_TYPE_ALL &&
|
||||
type != X_POSITION_TYPE_NONE
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
};
|
||||
|
||||
//
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user