last ...
This commit is contained in:
+768
-184
@@ -1,214 +1,798 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Checking Bar Based on Positions State ...
|
||||||
|
ENUM_X_DIRECTION iBarPosDir;
|
||||||
|
bool isBarValidForDir = cHelper
|
||||||
|
.mBarAnalyser
|
||||||
|
.IsValidForPosition(
|
||||||
|
cBar,
|
||||||
|
iBarPosDir //
|
||||||
|
);
|
||||||
|
bool isBarValidForBullish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBullish(iBarPosDir);
|
||||||
|
bool isBarValidForBearish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBearish(iBarPosDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Bar Place Based on Golden Zones ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBarInPeaksGoldenZone =
|
||||||
|
cBar.high <= cXConditions.peaksBuffer[cIDX] &&
|
||||||
|
cBar.low >= cXConditions.peaksGoldenBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBarInValesGoldenZone =
|
||||||
|
cBar.high >= cXConditions.valesBuffer[cIDX] &&
|
||||||
|
cBar.low <= cXConditions.valesGoldenBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||||
|
|
||||||
|
//
|
||||||
|
// X3MA ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaFastMidOverPeaksGoldeZone =
|
||||||
|
isX3MaFastOverPeaksGoldenZone &&
|
||||||
|
isX3MaMidOverPeaksGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaFastMidUnderValesGoldeZone =
|
||||||
|
isX3MaFastUnderValesGoldenZone &&
|
||||||
|
isX3MaMidUnderValesGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XVWAP ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapFastMidOverPeaksGoldeZone =
|
||||||
|
isVWapFastOverPeaksGoldenZone &&
|
||||||
|
isVWapMidOverPeaksGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVWapFastMidUnderValesGoldeZone =
|
||||||
|
isVWapFastUnderValesGoldenZone &&
|
||||||
|
isVWapMidUnderValesGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaVWapFastUnderValuesGoldenZone =
|
||||||
|
isX3MaFastUnderValesGoldenZone &&
|
||||||
|
isVWapFastUnderValesGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaVWapFastOverPeaksGoldenZone =
|
||||||
|
isX3MaFastOverPeaksGoldenZone &&
|
||||||
|
isVWapFastOverPeaksGoldenZone;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3MaFastMidMax = MathMax(
|
||||||
|
cXConditions.x3maFastBuffer[cIDX],
|
||||||
|
cXConditions.x3maMidBuffer[cIDX] //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3MaFastMidMin = MathMin(
|
||||||
|
cXConditions.x3maFastBuffer[cIDX],
|
||||||
|
cXConditions.x3maMidBuffer[cIDX] //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double vwapFastMidMax = MathMax(
|
||||||
|
cXConditions.vwapFastBuffer[cIDX],
|
||||||
|
cXConditions.vwapMidBuffer[cIDX] //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double vwapFastMidMin = MathMin(
|
||||||
|
cXConditions.vwapFastBuffer[cIDX],
|
||||||
|
cXConditions.vwapMidBuffer[cIDX] //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3maVWapFastMidMax = MathMax(x3MaFastMidMax, vwapFastMidMax);
|
||||||
|
double x3maVWapFastMidMin = MathMin(x3MaFastMidMin, vwapFastMidMin);
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3maVWapMax = MathMax(cXConditions.x3maMax, cXConditions.vwapMax);
|
||||||
|
double x3maVWapMin = MathMin(cXConditions.x3maMin, cXConditions.vwapMin);
|
||||||
|
|
||||||
|
//
|
||||||
|
double x3maVWapDiff = x3maVWapMax - x3maVWapMin;
|
||||||
|
|
||||||
|
//
|
||||||
|
double atr = cXConditions.atrBuffer[cIDX];
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isConsolidate = x3maVWapDiff <= (3 * atr);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaVWapSwitchedToBullish =
|
||||||
|
//
|
||||||
|
// VWap ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(cXConditions.isVWapBullishOrdered &&
|
||||||
|
cXConditions.isVWapSwitchedToBullishState) ||
|
||||||
|
(cXConditions.isVWapBullishState &&
|
||||||
|
cXConditions.isVWapSwitchedToBullishOrdered)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
// X3Ma ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(cXConditions.isX3MaBullishOrdered &&
|
||||||
|
cXConditions.isX3MaSwitchedToBullishState) ||
|
||||||
|
(cXConditions.isX3MaBullishState &&
|
||||||
|
cXConditions.isX3MaSwitchedToBullishOrdered)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isX3MaVWapSwitchedToBearish =
|
||||||
|
//
|
||||||
|
// VWap ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(cXConditions.isVWapBearishOrdered &&
|
||||||
|
cXConditions.isVWapSwitchedToBearishState) ||
|
||||||
|
(cXConditions.isVWapBearishState &&
|
||||||
|
cXConditions.isVWapSwitchedToBearishOrdered)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
||
|
||||||
|
//
|
||||||
|
// X3Ma ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
(cXConditions.isX3MaBearishOrdered &&
|
||||||
|
cXConditions.isX3MaSwitchedToBearishState) ||
|
||||||
|
(cXConditions.isX3MaBearishState &&
|
||||||
|
cXConditions.isX3MaSwitchedToBearishOrdered)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Conditions ...
|
||||||
|
isBullish =
|
||||||
|
//
|
||||||
|
// Base Condition ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
// isConsolidate &&
|
||||||
|
// isBarValidForBullish &&
|
||||||
|
// cXConditions.isSarBullish &&
|
||||||
|
// isX3MaVWapSwitchedToBullish &&
|
||||||
|
// cXConditions.isNewPeakOverLast // &&
|
||||||
|
// isVWapFastMidUnderValesGoldeZone // &&
|
||||||
|
// cXConditions.isAtrLowerSlopeBullish
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Conditions ...
|
||||||
|
isBearish =
|
||||||
|
//
|
||||||
|
// Base Condition ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
false
|
||||||
|
//
|
||||||
|
// isConsolidate &&
|
||||||
|
// isBarValidForBearish &&
|
||||||
|
// cXConditions.isSarBearish &&
|
||||||
|
// isX3MaVWapSwitchedToBearish &&
|
||||||
|
// cXConditions.isNewValeUnderLast // &&
|
||||||
|
// isVWapFastMidOverPeaksGoldeZone // &&
|
||||||
|
// cXConditions.isAtrUpperSlopeBearish
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//
|
||||||
|
// XWPVZ ...
|
||||||
|
bool HasXWPVZConditions(
|
||||||
|
ENUM_X_CYCLES cycle,
|
||||||
|
XSignalBox &box,
|
||||||
|
ENUM_X_DIRECTION &dir,
|
||||||
|
X121SMCStrategySignalProviderData &provider,
|
||||||
|
int barIndex = 0 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
box.Clean();
|
||||||
|
dir = X_DIRECTION_NONE;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fil Selected Data ...
|
||||||
|
XPOIState cState;
|
||||||
|
X121Conditions cXConditions;
|
||||||
|
XPOIStateEvents cStateEvents;
|
||||||
|
XC121SMCCycleHelper *cHelper;
|
||||||
|
X121SMCCycleConditions cConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
cycle,
|
||||||
|
cState,
|
||||||
|
cStateEvents,
|
||||||
|
cXConditions,
|
||||||
|
cHelper,
|
||||||
|
cConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Checking Bar Based on Positions State ...
|
return result;
|
||||||
ENUM_X_DIRECTION iBarPosDir;
|
}
|
||||||
bool isBarValidForDir = cHelper
|
Parse(cXConditions);
|
||||||
.mBarAnalyser
|
|
||||||
.IsValidForPosition(
|
//
|
||||||
cBar,
|
// Normalize Args ...
|
||||||
iBarPosDir //
|
|
||||||
);
|
//
|
||||||
bool isBarValidForBullish =
|
if (barIndex < 0)
|
||||||
isBarValidForDir &&
|
{
|
||||||
IsBullish(iBarPosDir);
|
barIndex = 0;
|
||||||
bool isBarValidForBearish =
|
}
|
||||||
isBarValidForDir &&
|
|
||||||
IsBearish(iBarPosDir);
|
//
|
||||||
|
int idx = -1;
|
||||||
|
int count = 0;
|
||||||
|
bool has = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
int zIDX = barIndex;
|
||||||
|
int cIDX = zIDX + 1;
|
||||||
|
int pIDX = cIDX + 1;
|
||||||
|
int ppIDX = pIDX + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = false;
|
||||||
|
bool isBearish = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
XOHCL zBar;
|
||||||
|
XOHCL cBar;
|
||||||
|
XOHCL pBar;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initial Bars ...
|
||||||
|
result = zBar.Init(
|
||||||
|
cState.symbol,
|
||||||
|
cState.period,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
zBar.GetPreviousBar(cBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
cBar.GetPreviousBar(pBar);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check Bar Place Based on Golden Zones ...
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBarInPeaksGoldenZone =
|
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
||||||
cBar.high <= cXConditions.peaksBuffer[cIDX] &&
|
|
||||||
cBar.low >= cXConditions.peaksGoldenBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isBarInValesGoldenZone =
|
// Checking Other Conditions ...
|
||||||
cBar.high >= cXConditions.valesBuffer[cIDX] &&
|
|
||||||
cBar.low <= cXConditions.valesGoldenBuffer[cIDX];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XCPOIDrawer *drawer = provider.visionCycleHelper.mPOIDrawer;
|
// Checking Bar Based on Positions State ...
|
||||||
|
ENUM_X_DIRECTION iBarPosDir;
|
||||||
|
bool isBarValidForDir = cHelper
|
||||||
|
.mBarAnalyser
|
||||||
|
.IsValidForPosition(
|
||||||
|
cBar,
|
||||||
|
iBarPosDir //
|
||||||
|
);
|
||||||
|
bool isBarValidForBullish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBullish(iBarPosDir);
|
||||||
|
bool isBarValidForBearish =
|
||||||
|
isBarValidForDir &&
|
||||||
|
IsBearish(iBarPosDir);
|
||||||
|
|
||||||
//
|
// //
|
||||||
// X3MA ...
|
// // Continuation Bullish ...
|
||||||
|
// bool isContinuationBullish =
|
||||||
|
// //
|
||||||
|
// isBarValidForBullish &&
|
||||||
|
// cXConditions.isSarBullish &&
|
||||||
|
// cXConditions.isStrBullish &&
|
||||||
|
// cXConditions.isNewPeakOverLast
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
|
||||||
//
|
// //
|
||||||
bool isX3MaFastMidOverPeaksGoldeZone =
|
// // Continuation Bearish ...
|
||||||
isX3MaFastOverPeaksGoldenZone &&
|
// bool isContinuationBearish =
|
||||||
isX3MaMidOverPeaksGoldenZone;
|
// //
|
||||||
|
// isBarValidForBearish &&
|
||||||
|
// cXConditions.isSarBearish &&
|
||||||
|
// cXConditions.isStrBearish &&
|
||||||
|
// cXConditions.isNewValeUnderLast
|
||||||
|
// //
|
||||||
|
// ;
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone obBox;
|
||||||
|
XBoxZone fvgBox;
|
||||||
|
XBoxZone supResBox;
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
bool isBullishFVGRejected = false;
|
||||||
|
bool isBearishFVGRejected = false;
|
||||||
|
bool isFVGLowerBullishRejected = false;
|
||||||
|
bool isFVGUpperBullishRejected = false;
|
||||||
|
bool isFVGLowerBearishRejected = false;
|
||||||
|
bool isFVGUpperBearishRejected = false;
|
||||||
|
has = cState.HasFairValueGaps();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
bool isX3MaFastMidUnderValesGoldeZone =
|
// Converts FairValueGaps to Box ...
|
||||||
isX3MaFastUnderValesGoldenZone &&
|
ToBox(
|
||||||
isX3MaMidUnderValesGoldenZone;
|
cState.fairValueGaps,
|
||||||
|
tmpBoxes //
|
||||||
//
|
|
||||||
// XVWAP ...
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isVWapFastMidOverPeaksGoldeZone =
|
|
||||||
isVWapFastOverPeaksGoldenZone &&
|
|
||||||
isVWapMidOverPeaksGoldenZone;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isVWapFastMidUnderValesGoldeZone =
|
|
||||||
isVWapFastUnderValesGoldenZone &&
|
|
||||||
isVWapMidUnderValesGoldenZone;
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isX3MaVWapFastUnderValuesGoldenZone =
|
|
||||||
isX3MaFastUnderValesGoldenZone &&
|
|
||||||
isVWapFastUnderValesGoldenZone;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isX3MaVWapFastOverPeaksGoldenZone =
|
|
||||||
isX3MaFastOverPeaksGoldenZone &&
|
|
||||||
isVWapFastOverPeaksGoldenZone;
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
double x3MaFastMidMax = MathMax(
|
|
||||||
cXConditions.x3maFastBuffer[cIDX],
|
|
||||||
cXConditions.x3maMidBuffer[cIDX] //
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
double x3MaFastMidMin = MathMin(
|
// Select FVG ...
|
||||||
cXConditions.x3maFastBuffer[cIDX],
|
while (HasChild(tmpBoxes))
|
||||||
cXConditions.x3maMidBuffer[cIDX] //
|
{
|
||||||
);
|
//
|
||||||
|
idx = GetYoungest(tmpBoxes);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isFVGLowerBullishRejected =
|
||||||
|
//
|
||||||
|
cBar.low < iBox.lower &&
|
||||||
|
cBar.GetDown() > iBox.lower
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isFVGUpperBullishRejected =
|
||||||
|
//
|
||||||
|
cBar.low < iBox.upper &&
|
||||||
|
cBar.GetDown() > iBox.upper
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isFVGLowerBearishRejected =
|
||||||
|
//
|
||||||
|
cBar.high > iBox.lower &&
|
||||||
|
cBar.GetUp() < iBox.lower
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isFVGUpperBearishRejected =
|
||||||
|
//
|
||||||
|
cBar.high > iBox.upper &&
|
||||||
|
cBar.GetUp() < iBox.upper
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullishFVGRejected =
|
||||||
|
//
|
||||||
|
iBox.IsBullish() &&
|
||||||
|
cBar.IsBullish() &&
|
||||||
|
(isFVGLowerBullishRejected
|
||||||
|
// || isFVGUpperBullishRejected
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearishFVGRejected =
|
||||||
|
//
|
||||||
|
iBox.IsBearish() &&
|
||||||
|
cBar.IsBearish() &&
|
||||||
|
( // isFVGLowerBearishRejected ||
|
||||||
|
isFVGUpperBearishRejected)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
has = isBullishFVGRejected ||
|
||||||
|
isBearishFVGRejected;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.to = TimeCurrent();
|
||||||
|
fvgBox = iBox;
|
||||||
|
iBox.Clean();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
//
|
//
|
||||||
double vwapFastMidMax = MathMax(
|
// Select Order Block which FVG is Inside it ...
|
||||||
cXConditions.vwapFastBuffer[cIDX],
|
has = fvgBox.IsValid();
|
||||||
cXConditions.vwapMidBuffer[cIDX] //
|
if (has)
|
||||||
);
|
{
|
||||||
|
//
|
||||||
|
// Converts Order Blocks to Box ...
|
||||||
|
ToBox(
|
||||||
|
cState.orderBlocks,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Select Order Blocks ...
|
||||||
|
has = HasChild(tmpBoxes);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
while (HasChild(tmpBoxes))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetYoungest(tmpBoxes);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Order Blocks ...
|
||||||
|
bool isSameDir = iBox.dir == fvgBox.dir;
|
||||||
|
bool isFVGInsideOB = IsBoxInsideOr(
|
||||||
|
fvgBox,
|
||||||
|
iBox //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
has =
|
||||||
|
isSameDir &&
|
||||||
|
isFVGInsideOB;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.to = TimeCurrent();
|
||||||
|
obBox = iBox;
|
||||||
|
iBox.Clean();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double vwapFastMidMin = MathMin(
|
has = obBox.IsValid();
|
||||||
cXConditions.vwapFastBuffer[cIDX],
|
if (!has)
|
||||||
cXConditions.vwapMidBuffer[cIDX] //
|
{
|
||||||
);
|
//
|
||||||
|
obBox.Clean();
|
||||||
|
fvgBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullishFVGRejected = false;
|
||||||
|
isBearishFVGRejected = false;
|
||||||
|
isFVGLowerBullishRejected = false;
|
||||||
|
isFVGUpperBullishRejected = false;
|
||||||
|
isFVGLowerBearishRejected = false;
|
||||||
|
isFVGUpperBearishRejected = false;
|
||||||
|
}
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
// Checking Support nad Resistance ...
|
||||||
|
bool isDirBullish =
|
||||||
|
obBox.IsBullish() &&
|
||||||
|
fvgBox.IsBullish();
|
||||||
|
has =
|
||||||
|
obBox.IsValid() &&
|
||||||
|
fvgBox.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Converts Support or Resistance to Boxes ...
|
||||||
|
if (isDirBullish)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
cState.supportZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
cState.resistanceZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Selecting Support nad Resistance ...
|
||||||
|
has = HasChild(tmpBoxes);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
while (HasChild(tmpBoxes))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
idx = GetYoungest(tmpBoxes);
|
||||||
|
has = IsValidIndex(idx);
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone iBox = tmpBoxes[idx];
|
||||||
|
ArrayRemove(
|
||||||
|
tmpBoxes,
|
||||||
|
idx,
|
||||||
|
1 //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Validate Support and Resistane ...
|
||||||
|
bool isDirPassed = iBox.dir == obBox.dir;
|
||||||
|
bool isPlacePassed =
|
||||||
|
IsBoxAbove(
|
||||||
|
iBox,
|
||||||
|
fvgBox //
|
||||||
|
) ||
|
||||||
|
IsBoxAbove(
|
||||||
|
fvgBox,
|
||||||
|
iBox //
|
||||||
|
) ||
|
||||||
|
IsBoxInside(
|
||||||
|
iBox,
|
||||||
|
fvgBox //
|
||||||
|
) ||
|
||||||
|
IsBoxInside(
|
||||||
|
fvgBox,
|
||||||
|
iBox //
|
||||||
|
);
|
||||||
|
|
||||||
|
has =
|
||||||
|
isDirPassed &&
|
||||||
|
isPlacePassed;
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBox.to = TimeCurrent();
|
||||||
|
supResBox = iBox;
|
||||||
|
iBox.Clean();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBox.Clean();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
has = obBox.IsValid() &&
|
||||||
|
fvgBox.IsValid() &&
|
||||||
|
supResBox.IsValid();
|
||||||
|
if (!has)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
obBox.Clean();
|
||||||
|
fvgBox.Clean();
|
||||||
|
supResBox.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullishFVGRejected = false;
|
||||||
|
isBearishFVGRejected = false;
|
||||||
|
isFVGLowerBullishRejected = false;
|
||||||
|
isFVGUpperBullishRejected = false;
|
||||||
|
isFVGLowerBearishRejected = false;
|
||||||
|
isFVGUpperBearishRejected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Checking OB and FVG Validation ...
|
||||||
|
has = obBox.IsValid() &&
|
||||||
|
fvgBox.IsValid() &&
|
||||||
|
supResBox.IsValid();
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
|
// Draw OB ...
|
||||||
|
if (obBox.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
obBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
iObj.BoxStyle(STYLE_DASH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double x3maVWapFastMidMax = MathMax(x3MaFastMidMax, vwapFastMidMax);
|
// Draw FVG ...
|
||||||
double x3maVWapFastMidMin = MathMin(x3MaFastMidMin, vwapFastMidMin);
|
if (fvgBox.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
fvgBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
iObj.BoxStyle(STYLE_SOLID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double x3maVWapMax = MathMax(cXConditions.x3maMax, cXConditions.vwapMax);
|
// Draw Sup/Res Box ...
|
||||||
double x3maVWapMin = MathMin(cXConditions.x3maMin, cXConditions.vwapMin);
|
if (supResBox.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
supResBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
iObj.BoxStyle(STYLE_DOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Conditions ...
|
||||||
|
isBullish =
|
||||||
|
//
|
||||||
|
// Base Condition ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
// false
|
||||||
|
isBullishFVGRejected
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Conditions ...
|
||||||
|
isBearish =
|
||||||
|
//
|
||||||
|
// Base Condition ...
|
||||||
|
(
|
||||||
|
//
|
||||||
|
// false
|
||||||
|
isBearishFVGRejected
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Filling Requirements ...
|
||||||
|
result =
|
||||||
|
isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
|
||||||
//
|
//
|
||||||
double x3maVWapDiff = x3maVWapMax - x3maVWapMin;
|
box.ob = obBox;
|
||||||
|
box.fvg = fvgBox;
|
||||||
|
box.sharp = supResBox;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
double atr = cXConditions.atrBuffer[cIDX];
|
// Check All Conditions ...
|
||||||
|
result =
|
||||||
|
box.IsValid() &&
|
||||||
|
HasDirection(dir) &&
|
||||||
|
(isBullish ||
|
||||||
|
isBearish);
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isConsolidate = x3maVWapDiff <= (3 * atr);
|
// Cleanup Resources ...
|
||||||
|
zBar.Clean();
|
||||||
|
cBar.Clean();
|
||||||
|
pBar.Clean();
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isX3MaVWapSwitchedToBullish =
|
return result;
|
||||||
//
|
}
|
||||||
// VWap ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
(cXConditions.isVWapBullishOrdered &&
|
|
||||||
cXConditions.isVWapSwitchedToBullishState) ||
|
|
||||||
(cXConditions.isVWapBullishState &&
|
|
||||||
cXConditions.isVWapSwitchedToBullishOrdered)
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// X3Ma ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
(cXConditions.isX3MaBullishOrdered &&
|
|
||||||
cXConditions.isX3MaSwitchedToBullishState) ||
|
|
||||||
(cXConditions.isX3MaBullishState &&
|
|
||||||
cXConditions.isX3MaSwitchedToBullishOrdered)
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
bool isX3MaVWapSwitchedToBearish =
|
|
||||||
//
|
|
||||||
// VWap ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
(cXConditions.isVWapBearishOrdered &&
|
|
||||||
cXConditions.isVWapSwitchedToBearishState) ||
|
|
||||||
(cXConditions.isVWapBearishState &&
|
|
||||||
cXConditions.isVWapSwitchedToBearishOrdered)
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
// X3Ma ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
(cXConditions.isX3MaBearishOrdered &&
|
|
||||||
cXConditions.isX3MaSwitchedToBearishState) ||
|
|
||||||
(cXConditions.isX3MaBearishState &&
|
|
||||||
cXConditions.isX3MaSwitchedToBearishOrdered)
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Conditions ...
|
|
||||||
isBullish =
|
|
||||||
//
|
|
||||||
// Base Condition ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
// isConsolidate &&
|
|
||||||
// isBarValidForBullish &&
|
|
||||||
// cXConditions.isSarBullish &&
|
|
||||||
// isX3MaVWapSwitchedToBullish &&
|
|
||||||
// cXConditions.isNewPeakOverLast // &&
|
|
||||||
// isVWapFastMidUnderValesGoldeZone // &&
|
|
||||||
// cXConditions.isAtrLowerSlopeBullish
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Conditions ...
|
|
||||||
isBearish =
|
|
||||||
//
|
|
||||||
// Base Condition ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
false
|
|
||||||
//
|
|
||||||
// isConsolidate &&
|
|
||||||
// isBarValidForBearish &&
|
|
||||||
// cXConditions.isSarBearish &&
|
|
||||||
// isX3MaVWapSwitchedToBearish &&
|
|
||||||
// cXConditions.isNewValeUnderLast // &&
|
|
||||||
// isVWapFastMidOverPeaksGoldeZone // &&
|
|
||||||
// cXConditions.isAtrUpperSlopeBearish
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|||||||
@@ -440,6 +440,10 @@ struct X121Conditions
|
|||||||
double x3maMax;
|
double x3maMax;
|
||||||
double vwapMin;
|
double vwapMin;
|
||||||
double vwapMax;
|
double vwapMax;
|
||||||
|
double senkouMax;
|
||||||
|
double senkouMin;
|
||||||
|
double tenKijMax;
|
||||||
|
double tenKijMin;
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSarIncreased;
|
bool isSarIncreased;
|
||||||
@@ -723,7 +727,10 @@ struct X121Conditions
|
|||||||
vwapMax = 0;
|
vwapMax = 0;
|
||||||
x3maMin = 0;
|
x3maMin = 0;
|
||||||
x3maMax = 0;
|
x3maMax = 0;
|
||||||
|
senkouMax = 0;
|
||||||
|
senkouMin = 0;
|
||||||
|
tenKijMax = 0;
|
||||||
|
tenKijMin = 0;
|
||||||
//
|
//
|
||||||
// Slopes ...
|
// Slopes ...
|
||||||
|
|
||||||
@@ -3626,6 +3633,12 @@ class XCX121Helper : public XCBase
|
|||||||
conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB;
|
conditions.isSenkouSpanACrossedOverB = xichConditions.isSenkouSpanACrossedOverB;
|
||||||
conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB;
|
conditions.isSenkouSpanACrossedUnderB = xichConditions.isSenkouSpanACrossedUnderB;
|
||||||
|
|
||||||
|
//
|
||||||
|
conditions.tenKijMax = MathMax(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]);
|
||||||
|
conditions.tenKijMin = MathMin(xichConditions.tenkanSenBuffer[cIDX], xichConditions.kijunSenBuffer[cIDX]);
|
||||||
|
conditions.senkouMax = MathMax(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]);
|
||||||
|
conditions.senkouMin = MathMin(xichConditions.senkouSpanABuffer[cIDX], xichConditions.senkouSpanBBuffer[cIDX]);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Slopes ...
|
// Slopes ...
|
||||||
|
|
||||||
|
|||||||
@@ -901,15 +901,15 @@ class XCX121XICHHelper : public XCBaseHelper
|
|||||||
|
|
||||||
//
|
//
|
||||||
bool isSenkouSpanAOverB =
|
bool isSenkouSpanAOverB =
|
||||||
conditions.senkouSpanABuffer[cIDX] > conditions.senkouSpanABuffer[cIDX];
|
conditions.senkouSpanABuffer[cIDX] > conditions.senkouSpanBBuffer[cIDX];
|
||||||
bool isSenkouSpanAOverBPrev =
|
bool isSenkouSpanAOverBPrev =
|
||||||
conditions.senkouSpanABuffer[pIDX] > conditions.senkouSpanABuffer[pIDX];
|
conditions.senkouSpanABuffer[pIDX] > conditions.senkouSpanBBuffer[pIDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSenkouSpanAUnderB =
|
bool isSenkouSpanAUnderB =
|
||||||
conditions.senkouSpanABuffer[cIDX] < conditions.senkouSpanABuffer[cIDX];
|
conditions.senkouSpanABuffer[cIDX] < conditions.senkouSpanBBuffer[cIDX];
|
||||||
bool isSenkouSpanAUnderBPrev =
|
bool isSenkouSpanAUnderBPrev =
|
||||||
conditions.senkouSpanABuffer[pIDX] < conditions.senkouSpanABuffer[pIDX];
|
conditions.senkouSpanABuffer[pIDX] < conditions.senkouSpanBBuffer[pIDX];
|
||||||
|
|
||||||
//
|
//
|
||||||
bool isSenkouSpanACrossedOverB = isSenkouSpanAOverB &&
|
bool isSenkouSpanACrossedOverB = isSenkouSpanAOverB &&
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ double tenkanSenBuffer[];
|
|||||||
#property indicator_type1 DRAW_LINE
|
#property indicator_type1 DRAW_LINE
|
||||||
#property indicator_color1 clrBrown
|
#property indicator_color1 clrBrown
|
||||||
#property indicator_style1 STYLE_SOLID
|
#property indicator_style1 STYLE_SOLID
|
||||||
#property indicator_width1 1
|
#property indicator_width1 2
|
||||||
|
|
||||||
//
|
//
|
||||||
#define kijunSenBufferIndex 1
|
#define kijunSenBufferIndex 1
|
||||||
@@ -96,7 +96,7 @@ double kijunSenBuffer[];
|
|||||||
#property indicator_type2 DRAW_LINE
|
#property indicator_type2 DRAW_LINE
|
||||||
#property indicator_color2 clrDodgerBlue
|
#property indicator_color2 clrDodgerBlue
|
||||||
#property indicator_style2 STYLE_SOLID
|
#property indicator_style2 STYLE_SOLID
|
||||||
#property indicator_width2 1
|
#property indicator_width2 2
|
||||||
|
|
||||||
//
|
//
|
||||||
#define chikouSpanBufferIndex 2
|
#define chikouSpanBufferIndex 2
|
||||||
@@ -107,7 +107,7 @@ double chikouSpanBuffer[];
|
|||||||
#property indicator_type3 DRAW_LINE
|
#property indicator_type3 DRAW_LINE
|
||||||
#property indicator_color3 clrDarkGreen
|
#property indicator_color3 clrDarkGreen
|
||||||
#property indicator_style3 STYLE_SOLID
|
#property indicator_style3 STYLE_SOLID
|
||||||
#property indicator_width3 1
|
#property indicator_width3 2
|
||||||
|
|
||||||
//
|
//
|
||||||
#define senkouSpanABufferIndex 3
|
#define senkouSpanABufferIndex 3
|
||||||
@@ -118,7 +118,7 @@ double senkouSpanABuffer[];
|
|||||||
#property indicator_type4 DRAW_LINE
|
#property indicator_type4 DRAW_LINE
|
||||||
#property indicator_color4 clrLightGray
|
#property indicator_color4 clrLightGray
|
||||||
#property indicator_style4 STYLE_DASHDOTDOT
|
#property indicator_style4 STYLE_DASHDOTDOT
|
||||||
#property indicator_width4 1
|
#property indicator_width4 2
|
||||||
|
|
||||||
//
|
//
|
||||||
#define senkouSpanBBufferIndex 4
|
#define senkouSpanBBufferIndex 4
|
||||||
@@ -129,7 +129,7 @@ double senkouSpanBBuffer[];
|
|||||||
#property indicator_type5 DRAW_LINE
|
#property indicator_type5 DRAW_LINE
|
||||||
#property indicator_color5 clrLightGray
|
#property indicator_color5 clrLightGray
|
||||||
#property indicator_style5 STYLE_DASHDOTDOT
|
#property indicator_style5 STYLE_DASHDOTDOT
|
||||||
#property indicator_width5 1
|
#property indicator_width5 2
|
||||||
|
|
||||||
//
|
//
|
||||||
#define senkouABufferIndex 5
|
#define senkouABufferIndex 5
|
||||||
@@ -147,7 +147,7 @@ double senkouBBuffer[];
|
|||||||
#property indicator_type6 DRAW_FILLING
|
#property indicator_type6 DRAW_FILLING
|
||||||
#property indicator_color6 clrAqua, clrMagenta
|
#property indicator_color6 clrAqua, clrMagenta
|
||||||
#property indicator_style6 STYLE_SOLID
|
#property indicator_style6 STYLE_SOLID
|
||||||
#property indicator_width6 1
|
#property indicator_width6 2
|
||||||
|
|
||||||
//
|
//
|
||||||
// Data Buffers ...
|
// Data Buffers ...
|
||||||
|
|||||||
@@ -960,6 +960,119 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool HasFiboPressure(
|
||||||
|
ENUM_X_DIRECTION forDir,
|
||||||
|
ENUM_X_FIBO_LEVELS level = X_FIBO_LEVEL_382 //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish = IsBullish(forDir);
|
||||||
|
bool isBearish = IsBearish(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
double fiboLevelValue = GetFibonacciLevel(
|
||||||
|
high,
|
||||||
|
low,
|
||||||
|
level,
|
||||||
|
forDir //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
GetDown() > fiboLevelValue;
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
GetUp() < fiboLevelValue;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool IsRejected(
|
||||||
|
double price,
|
||||||
|
ENUM_X_DIRECTION forDir,
|
||||||
|
bool forceType = false,
|
||||||
|
bool forcePressure = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() &&
|
||||||
|
price > 0 &&
|
||||||
|
HasDirection(forDir);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullish =
|
||||||
|
IsBullish(forDir) &&
|
||||||
|
low < price &&
|
||||||
|
GetDown() > price;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearish =
|
||||||
|
IsBearish(forDir) &&
|
||||||
|
high > price &&
|
||||||
|
GetUp() < price;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (forceType)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
IsBullish();
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
IsBearish();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (forcePressure)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
isBullish =
|
||||||
|
isBullish &&
|
||||||
|
HasFiboPressure(forDir);
|
||||||
|
|
||||||
|
//
|
||||||
|
isBearish =
|
||||||
|
isBearish &&
|
||||||
|
HasFiboPressure(forDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find Highest Bar Index ...
|
// Find Highest Bar Index ...
|
||||||
int FindHighestIndex(
|
int FindHighestIndex(
|
||||||
|
|||||||
@@ -3240,4 +3240,139 @@ bool DetectBoxNearestPriceOut(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Count number of Box Retests ...
|
||||||
|
*
|
||||||
|
* @param box: XBoxZone instance Reference ...
|
||||||
|
* @param forDir: ENUM_X_DIRECTION member, Specified Retesting Direction ...
|
||||||
|
* @param forPeriod: ENUM_TIMEFRAMES member, Specified Retesting Period ...
|
||||||
|
* @param forceType: bool, Specified Retest Bar Direction is Same as Retesting Direction ...
|
||||||
|
* @param forcePressure: bool, Specified Retest Bar must Has Fibo Pressure or not ...
|
||||||
|
*
|
||||||
|
* @return ( int )
|
||||||
|
*/
|
||||||
|
int CountBoxRetest(
|
||||||
|
XBoxZone &box,
|
||||||
|
ENUM_X_DIRECTION forDir = NULL,
|
||||||
|
ENUM_TIMEFRAMES forPeriod = NULL,
|
||||||
|
bool forceType = false,
|
||||||
|
bool forcePressure = false //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid(forPeriod))
|
||||||
|
{
|
||||||
|
forPeriod = box.period;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!IsValid(forDir))
|
||||||
|
{
|
||||||
|
forDir = box.dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isValid =
|
||||||
|
box.IsValid() &&
|
||||||
|
IsValid(forDir);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int fromIDX = GetBarIndex(
|
||||||
|
box.symbol,
|
||||||
|
forPeriod,
|
||||||
|
box.from //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int toIDX = GetBarIndex(
|
||||||
|
box.symbol,
|
||||||
|
forPeriod,
|
||||||
|
box.to //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
for (int i = fromIDX; i >= toIDX; i--)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Initialize Indexed Bar ...
|
||||||
|
XOHCL iBar;
|
||||||
|
isValid = iBar.Init(
|
||||||
|
box.symbol,
|
||||||
|
forPeriod,
|
||||||
|
i //
|
||||||
|
);
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isUpperBullishRejected = iBar.IsRejected(
|
||||||
|
box.upper,
|
||||||
|
X_DIRECTION_BULLISH,
|
||||||
|
forceType,
|
||||||
|
forcePressure //
|
||||||
|
);
|
||||||
|
bool isUpperBearishRejected = iBar.IsRejected(
|
||||||
|
box.upper,
|
||||||
|
X_DIRECTION_BEARISH,
|
||||||
|
forceType,
|
||||||
|
forcePressure //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isLowerBullishRejected = iBar.IsRejected(
|
||||||
|
box.lower,
|
||||||
|
X_DIRECTION_BULLISH,
|
||||||
|
forceType,
|
||||||
|
forcePressure //
|
||||||
|
);
|
||||||
|
bool isLowerBearishRejected = iBar.IsRejected(
|
||||||
|
box.lower,
|
||||||
|
X_DIRECTION_BEARISH,
|
||||||
|
forceType,
|
||||||
|
forcePressure //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (forDir == X_DIRECTION_ALL ||
|
||||||
|
forDir == X_DIRECTION_BULLISH)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (isUpperBullishRejected ||
|
||||||
|
isLowerBullishRejected)
|
||||||
|
{
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (forDir == X_DIRECTION_ALL ||
|
||||||
|
forDir == X_DIRECTION_BEARISH)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (isUpperBearishRejected ||
|
||||||
|
isLowerBearishRejected)
|
||||||
|
{
|
||||||
|
result++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
iBar.Clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1052,6 +1052,205 @@ struct XPOIState
|
|||||||
return ArraySize(bearishConsolidationZones);
|
return ArraySize(bearishConsolidationZones);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Box Retrievers ...
|
||||||
|
|
||||||
|
//
|
||||||
|
int SupportResistancesAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
supportZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
resistanceZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int SupplyDemandsAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
supplyZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
demandZones,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int OrderBlocksAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
bullishOrderBlocks,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
bearishOrderBlocks,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int FairValueGapsAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
bullishFairValueGaps,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
ToBox(
|
||||||
|
bearishFairValueGaps,
|
||||||
|
tmpBoxes //
|
||||||
|
);
|
||||||
|
Copy(
|
||||||
|
tmpBoxes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
Clean(tmpBoxes);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int SpikesAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
bullishSpikes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
bearishSpikes,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
int SharpsAsBox(XBoxZone &items[])
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
bullishSharps,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
Copy(
|
||||||
|
bearishSharps,
|
||||||
|
items,
|
||||||
|
false //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
int result = ArraySize(items);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Tools ...
|
// Tools ...
|
||||||
|
|
||||||
|
|||||||
@@ -3499,6 +3499,7 @@ struct X121SMCStrategyConditionParser
|
|||||||
// XWPVZ ...
|
// XWPVZ ...
|
||||||
bool HasXWPVZConditions(
|
bool HasXWPVZConditions(
|
||||||
ENUM_X_CYCLES cycle,
|
ENUM_X_CYCLES cycle,
|
||||||
|
ENUM_X_CYCLES vCycle,
|
||||||
XSignalBox &box,
|
XSignalBox &box,
|
||||||
ENUM_X_DIRECTION &dir,
|
ENUM_X_DIRECTION &dir,
|
||||||
X121SMCStrategySignalProviderData &provider,
|
X121SMCStrategySignalProviderData &provider,
|
||||||
@@ -3541,6 +3542,42 @@ struct X121SMCStrategyConditionParser
|
|||||||
}
|
}
|
||||||
Parse(cXConditions);
|
Parse(cXConditions);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fil Selected Data ...
|
||||||
|
XPOIState vState;
|
||||||
|
X121Conditions vXConditions;
|
||||||
|
XPOIStateEvents vStateEvents;
|
||||||
|
XC121SMCCycleHelper *vHelper;
|
||||||
|
X121SMCCycleConditions vConditions;
|
||||||
|
result = provider.SelectCycle(
|
||||||
|
vCycle,
|
||||||
|
vState,
|
||||||
|
vStateEvents,
|
||||||
|
vXConditions,
|
||||||
|
vHelper,
|
||||||
|
vConditions //
|
||||||
|
);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
cState.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
cXConditions.Clean();
|
||||||
|
cStateEvents.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
vState.Clean();
|
||||||
|
ZeroMemory(vHelper);
|
||||||
|
cConditions.Clean();
|
||||||
|
vXConditions.Clean();
|
||||||
|
vStateEvents.Clean();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
Parse(vXConditions);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Normalize Args ...
|
// Normalize Args ...
|
||||||
|
|
||||||
@@ -3569,6 +3606,7 @@ struct X121SMCStrategyConditionParser
|
|||||||
XOHCL zBar;
|
XOHCL zBar;
|
||||||
XOHCL cBar;
|
XOHCL cBar;
|
||||||
XOHCL pBar;
|
XOHCL pBar;
|
||||||
|
XOHCL pPBar;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initial Bars ...
|
// Initial Bars ...
|
||||||
@@ -3583,6 +3621,9 @@ struct X121SMCStrategyConditionParser
|
|||||||
result =
|
result =
|
||||||
result &&
|
result &&
|
||||||
cBar.GetPreviousBar(pBar);
|
cBar.GetPreviousBar(pBar);
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
pBar.GetPreviousBar(pPBar);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -3620,156 +3661,156 @@ struct X121SMCStrategyConditionParser
|
|||||||
isBarValidForDir &&
|
isBarValidForDir &&
|
||||||
IsBearish(iBarPosDir);
|
IsBearish(iBarPosDir);
|
||||||
|
|
||||||
// //
|
//
|
||||||
// // Continuation Bullish ...
|
// Senkou Span A/B Rejections ...
|
||||||
// bool isContinuationBullish =
|
|
||||||
// //
|
|
||||||
// isBarValidForBullish &&
|
|
||||||
// cXConditions.isSarBullish &&
|
|
||||||
// cXConditions.isStrBullish &&
|
|
||||||
// cXConditions.isNewPeakOverLast
|
|
||||||
// //
|
|
||||||
// ;
|
|
||||||
|
|
||||||
// //
|
//
|
||||||
// // Continuation Bearish ...
|
bool forceType = false;
|
||||||
// bool isContinuationBearish =
|
bool forcePressure = true;
|
||||||
// //
|
|
||||||
// isBarValidForBearish &&
|
//
|
||||||
// cXConditions.isSarBearish &&
|
bool isBullishRejectSenkouAB = cBar.IsRejected(
|
||||||
// cXConditions.isStrBearish &&
|
cXConditions.senkouMax,
|
||||||
// cXConditions.isNewValeUnderLast
|
X_DIRECTION_BULLISH,
|
||||||
// //
|
forceType, // Force Type ...
|
||||||
// ;
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearishRejectSenkouAB = cBar.IsRejected(
|
||||||
|
cXConditions.senkouMin,
|
||||||
|
X_DIRECTION_BEARISH,
|
||||||
|
forceType, // Force Type ...
|
||||||
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// TenkanSen/KijunSen Rejections ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishRejectTenKij = cBar.IsRejected(
|
||||||
|
cXConditions.tenKijMax,
|
||||||
|
X_DIRECTION_BULLISH,
|
||||||
|
forceType, // Force Type ...
|
||||||
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearishRejectTenKij = cBar.IsRejected(
|
||||||
|
cXConditions.tenKijMin,
|
||||||
|
X_DIRECTION_BEARISH,
|
||||||
|
forceType, // Force Type ...
|
||||||
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// X3MaFast Rejections ...
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBullishRejectedFastMa = cBar.IsRejected(
|
||||||
|
cXConditions.x3maFastBuffer[cIDX],
|
||||||
|
X_DIRECTION_BULLISH,
|
||||||
|
forceType, // Force Type ...
|
||||||
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isBearishRejectedFastMa = cBar.IsRejected(
|
||||||
|
cXConditions.x3maFastBuffer[cIDX],
|
||||||
|
X_DIRECTION_BEARISH,
|
||||||
|
forceType, // Force Type ...
|
||||||
|
forcePressure // Force Pressure ...
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isValidBullishRejectedFastMa =
|
||||||
|
isBullishRejectedFastMa &&
|
||||||
|
cBar.low > cXConditions.senkouMax;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isValidBearishRejectedFastMa =
|
||||||
|
isBearishRejectedFastMa &&
|
||||||
|
cBar.high < cXConditions.senkouMin;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bigger Cycle Verification ...
|
||||||
|
|
||||||
|
//
|
||||||
|
double vBullishScore = 0;
|
||||||
|
double vBearishScore = 0;
|
||||||
|
vXConditions.GenerateScore(
|
||||||
|
vBullishScore,
|
||||||
|
vBearishScore //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVBUllishPassed =
|
||||||
|
cBar.low > vXConditions.senkouMax &&
|
||||||
|
vBullishScore > (vBearishScore * 1.5);
|
||||||
|
|
||||||
|
//
|
||||||
|
bool isVBearishPassed =
|
||||||
|
cBar.high < vXConditions.senkouMin &&
|
||||||
|
vBearishScore > (vBullishScore * 1.5);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Conditions ...
|
||||||
|
isBullish =
|
||||||
|
//
|
||||||
|
isVBUllishPassed &&
|
||||||
|
isBullishRejectSenkouAB
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Conditions ...
|
||||||
|
isBearish =
|
||||||
|
//
|
||||||
|
isVBearishPassed &&
|
||||||
|
isBearishRejectSenkouAB
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = isBullish ||
|
||||||
|
isBearish;
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
dir =
|
||||||
|
isBullish
|
||||||
|
? X_DIRECTION_BULLISH
|
||||||
|
: X_DIRECTION_BEARISH;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Detecting a Zone and Validate it ...
|
||||||
|
|
||||||
|
//
|
||||||
|
XBoxZone tmpBoxes[];
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone obBox;
|
XBoxZone obBox;
|
||||||
XBoxZone fvgBox;
|
XBoxZone fvgBox;
|
||||||
XBoxZone supResBox;
|
XBoxZone supResBox;
|
||||||
XBoxZone tmpBoxes[];
|
bool hasOB = false;
|
||||||
bool isBullishFVGRejected = false;
|
bool hasFVG = false;
|
||||||
bool isBearishFVGRejected = false;
|
bool hasSupRes = false;
|
||||||
bool isFVGLowerBullishRejected = false;
|
|
||||||
bool isFVGUpperBullishRejected = false;
|
//
|
||||||
bool isFVGLowerBearishRejected = false;
|
// Select Support and Resistance ...
|
||||||
bool isFVGUpperBearishRejected = false;
|
if (result)
|
||||||
has = cState.HasFairValueGaps();
|
|
||||||
if (has)
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Converts FairValueGaps to Box ...
|
if (!hasSupRes)
|
||||||
ToBox(
|
|
||||||
cState.fairValueGaps,
|
|
||||||
tmpBoxes //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select FVG ...
|
|
||||||
while (HasChild(tmpBoxes))
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
idx = GetYoungest(tmpBoxes);
|
cState.OrderBlocksAsBox(tmpBoxes);
|
||||||
has = IsValidIndex(idx);
|
cState.FairValueGapsAsBox(tmpBoxes);
|
||||||
if (!has)
|
cState.SupplyDemandsAsBox(tmpBoxes);
|
||||||
{
|
cState.SupportResistancesAsBox(tmpBoxes);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
XBoxZone iBox = tmpBoxes[idx];
|
|
||||||
ArrayRemove(
|
|
||||||
tmpBoxes,
|
|
||||||
idx,
|
|
||||||
1 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
isFVGLowerBullishRejected =
|
|
||||||
//
|
|
||||||
cBar.low < iBox.lower &&
|
|
||||||
cBar.GetDown() > iBox.lower
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isFVGUpperBullishRejected =
|
|
||||||
//
|
|
||||||
cBar.low < iBox.upper &&
|
|
||||||
cBar.GetDown() > iBox.upper
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isFVGLowerBearishRejected =
|
|
||||||
//
|
|
||||||
cBar.high > iBox.lower &&
|
|
||||||
cBar.GetUp() < iBox.lower
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isFVGUpperBearishRejected =
|
|
||||||
//
|
|
||||||
cBar.high > iBox.upper &&
|
|
||||||
cBar.GetUp() < iBox.upper
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
|
||||||
isBullishFVGRejected =
|
|
||||||
//
|
|
||||||
iBox.IsBullish() &&
|
|
||||||
cBar.IsBullish() &&
|
|
||||||
(isFVGLowerBullishRejected
|
|
||||||
// || isFVGUpperBullishRejected
|
|
||||||
)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
isBearishFVGRejected =
|
|
||||||
//
|
|
||||||
iBox.IsBearish() &&
|
|
||||||
cBar.IsBearish() &&
|
|
||||||
( // isFVGLowerBearishRejected ||
|
|
||||||
isFVGUpperBearishRejected)
|
|
||||||
//
|
|
||||||
;
|
|
||||||
|
|
||||||
//
|
|
||||||
has = isBullishFVGRejected ||
|
|
||||||
isBearishFVGRejected;
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
iBox.to = TimeCurrent();
|
|
||||||
fvgBox = iBox;
|
|
||||||
iBox.Clean();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
iBox.Clean();
|
|
||||||
}
|
|
||||||
Clean(tmpBoxes);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Order Block which FVG is Inside it ...
|
|
||||||
has = fvgBox.IsValid();
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Converts Order Blocks to Box ...
|
|
||||||
ToBox(
|
|
||||||
cState.orderBlocks,
|
|
||||||
tmpBoxes //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Select Order Blocks ...
|
|
||||||
has = HasChild(tmpBoxes);
|
has = HasChild(tmpBoxes);
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
@@ -3777,7 +3818,7 @@ struct X121SMCStrategyConditionParser
|
|||||||
while (HasChild(tmpBoxes))
|
while (HasChild(tmpBoxes))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
idx = GetYoungest(tmpBoxes);
|
idx = GetOldest(tmpBoxes);
|
||||||
has = IsValidIndex(idx);
|
has = IsValidIndex(idx);
|
||||||
if (!has)
|
if (!has)
|
||||||
{
|
{
|
||||||
@@ -3791,133 +3832,43 @@ struct X121SMCStrategyConditionParser
|
|||||||
idx,
|
idx,
|
||||||
1 //
|
1 //
|
||||||
);
|
);
|
||||||
|
iBox.to = TimeCurrent();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Validate Order Blocks ...
|
// Try to Validate Support and Resistance ...
|
||||||
bool isSameDir = iBox.dir == fvgBox.dir;
|
int retests = CountBoxRetest(
|
||||||
bool isFVGInsideOB = IsBoxInsideOr(
|
iBox,
|
||||||
fvgBox,
|
dir,
|
||||||
iBox //
|
cBar.period //
|
||||||
);
|
);
|
||||||
|
bool isTyped =
|
||||||
|
isBullish
|
||||||
|
? iBox.IsBullish()
|
||||||
|
: iBox.IsBearish();
|
||||||
|
bool isRetested = retests >= 1;
|
||||||
|
bool isPlaced =
|
||||||
|
isBullish
|
||||||
|
? (
|
||||||
|
//
|
||||||
|
(cBar.low < iBox.upper &&
|
||||||
|
cBar.low > iBox.lower)
|
||||||
|
//
|
||||||
|
)
|
||||||
|
: (
|
||||||
|
//
|
||||||
|
(cBar.high < iBox.upper &&
|
||||||
|
cBar.high > iBox.lower)
|
||||||
|
//
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
has =
|
has =
|
||||||
isSameDir &&
|
isTyped &&
|
||||||
isFVGInsideOB;
|
isPlaced &&
|
||||||
|
isRetested;
|
||||||
if (has)
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
iBox.to = TimeCurrent();
|
|
||||||
obBox = iBox;
|
|
||||||
iBox.Clean();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
iBox.Clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
has = obBox.IsValid();
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
obBox.Clean();
|
|
||||||
fvgBox.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
isBullishFVGRejected = false;
|
|
||||||
isBearishFVGRejected = false;
|
|
||||||
isFVGLowerBullishRejected = false;
|
|
||||||
isFVGUpperBullishRejected = false;
|
|
||||||
isFVGLowerBearishRejected = false;
|
|
||||||
isFVGUpperBearishRejected = false;
|
|
||||||
}
|
|
||||||
Clean(tmpBoxes);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Checking Support nad Resistance ...
|
|
||||||
bool isDirBullish =
|
|
||||||
obBox.IsBullish() &&
|
|
||||||
fvgBox.IsBullish();
|
|
||||||
has =
|
|
||||||
obBox.IsValid() &&
|
|
||||||
fvgBox.IsValid();
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Converts Support or Resistance to Boxes ...
|
|
||||||
if (isDirBullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
ToBox(
|
|
||||||
cState.supportZones,
|
|
||||||
tmpBoxes //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
ToBox(
|
|
||||||
cState.resistanceZones,
|
|
||||||
tmpBoxes //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Selecting Support nad Resistance ...
|
|
||||||
has = HasChild(tmpBoxes);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
while (HasChild(tmpBoxes))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
idx = GetYoungest(tmpBoxes);
|
|
||||||
has = IsValidIndex(idx);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XBoxZone iBox = tmpBoxes[idx];
|
|
||||||
ArrayRemove(
|
|
||||||
tmpBoxes,
|
|
||||||
idx,
|
|
||||||
1 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate Support and Resistane ...
|
|
||||||
bool isDirPassed = iBox.dir == obBox.dir;
|
|
||||||
bool isPlacePassed =
|
|
||||||
IsBoxAbove(
|
|
||||||
iBox,
|
|
||||||
fvgBox //
|
|
||||||
) ||
|
|
||||||
IsBoxAbove(
|
|
||||||
fvgBox,
|
|
||||||
iBox //
|
|
||||||
) ||
|
|
||||||
IsBoxInside(
|
|
||||||
iBox,
|
|
||||||
fvgBox //
|
|
||||||
) ||
|
|
||||||
IsBoxInside(
|
|
||||||
fvgBox,
|
|
||||||
iBox //
|
|
||||||
);
|
|
||||||
|
|
||||||
has =
|
|
||||||
isDirPassed &&
|
|
||||||
isPlacePassed;
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
iBox.to = TimeCurrent();
|
|
||||||
supResBox = iBox;
|
supResBox = iBox;
|
||||||
iBox.Clean();
|
iBox.Clean();
|
||||||
break;
|
break;
|
||||||
@@ -3929,95 +3880,20 @@ struct X121SMCStrategyConditionParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
has = obBox.IsValid() &&
|
hasSupRes = supResBox.IsValid();
|
||||||
fvgBox.IsValid() &&
|
Clean(tmpBoxes);
|
||||||
supResBox.IsValid();
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
obBox.Clean();
|
|
||||||
fvgBox.Clean();
|
|
||||||
supResBox.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
isBullishFVGRejected = false;
|
|
||||||
isBearishFVGRejected = false;
|
|
||||||
isFVGLowerBullishRejected = false;
|
|
||||||
isFVGUpperBullishRejected = false;
|
|
||||||
isFVGLowerBearishRejected = false;
|
|
||||||
isFVGUpperBearishRejected = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Clean(tmpBoxes);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Checking OB and FVG Validation ...
|
Clean(tmpBoxes);
|
||||||
has = obBox.IsValid() &&
|
|
||||||
fvgBox.IsValid() &&
|
|
||||||
supResBox.IsValid();
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Draw OB ...
|
|
||||||
if (obBox.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = drawer.DrawBox(
|
|
||||||
obBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
iObj.BoxStyle(STYLE_DASH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Draw FVG ...
|
|
||||||
if (fvgBox.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = drawer.DrawBox(
|
|
||||||
fvgBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
iObj.BoxStyle(STYLE_SOLID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Draw Sup/Res Box ...
|
|
||||||
if (supResBox.IsValid())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XCBoxObject *iObj;
|
|
||||||
has = drawer.DrawBox(
|
|
||||||
supResBox,
|
|
||||||
iObj //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
iObj.BoxStyle(STYLE_DOT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bullish Conditions ...
|
// Bullish Conditions ...
|
||||||
isBullish =
|
isBullish =
|
||||||
//
|
//
|
||||||
// Base Condition ...
|
isBullish &&
|
||||||
(
|
hasSupRes
|
||||||
//
|
|
||||||
// false
|
|
||||||
isBullishFVGRejected
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -4025,13 +3901,8 @@ struct X121SMCStrategyConditionParser
|
|||||||
// Bearish Conditions ...
|
// Bearish Conditions ...
|
||||||
isBearish =
|
isBearish =
|
||||||
//
|
//
|
||||||
// Base Condition ...
|
isBearish &&
|
||||||
(
|
hasSupRes
|
||||||
//
|
|
||||||
// false
|
|
||||||
isBearishFVGRejected
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
//
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -4043,14 +3914,36 @@ struct X121SMCStrategyConditionParser
|
|||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
dir =
|
bool drawBoxes = true;
|
||||||
isBullish
|
if (drawBoxes)
|
||||||
? X_DIRECTION_BULLISH
|
{
|
||||||
: X_DIRECTION_BEARISH;
|
//
|
||||||
|
if (hasSupRes)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
supResBox.to = TimeCurrent();
|
||||||
|
|
||||||
|
//
|
||||||
|
XCBoxObject *iObj;
|
||||||
|
has = drawer.DrawBox(
|
||||||
|
supResBox,
|
||||||
|
iObj //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
if (has)
|
||||||
|
{
|
||||||
|
iObj.BoxWidth(2);
|
||||||
|
iObj.BoxStyle(STYLE_DOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = false;
|
|
||||||
Print("Signal ...");
|
Print("Signal ...");
|
||||||
|
result = false;
|
||||||
|
isBearish = false;
|
||||||
|
isBullish = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -4066,11 +3959,17 @@ struct X121SMCStrategyConditionParser
|
|||||||
zBar.Clean();
|
zBar.Clean();
|
||||||
cBar.Clean();
|
cBar.Clean();
|
||||||
pBar.Clean();
|
pBar.Clean();
|
||||||
|
pPBar.Clean();
|
||||||
cState.Clean();
|
cState.Clean();
|
||||||
ZeroMemory(cHelper);
|
vState.Clean();
|
||||||
cConditions.Clean();
|
cConditions.Clean();
|
||||||
|
cConditions.Clean();
|
||||||
|
ZeroMemory(cHelper);
|
||||||
|
ZeroMemory(vHelper);
|
||||||
cStateEvents.Clean();
|
cStateEvents.Clean();
|
||||||
cXConditions.Clean();
|
cXConditions.Clean();
|
||||||
|
vXConditions.Clean();
|
||||||
|
vStateEvents.Clean();
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -118,12 +118,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
result = provider.Prepare(
|
result = provider.Prepare(
|
||||||
zIndex,
|
zIndex,
|
||||||
loopback,
|
loopback,
|
||||||
false, // Trigger ...
|
true, // Trigger ...
|
||||||
true, // Decision ...
|
true, // Decision ...
|
||||||
true, // Analyse ...
|
true, // Analyse ...
|
||||||
true, // Verification ...
|
true, // Verification ...
|
||||||
true, // Consolidation ...
|
true, // Consolidation ...
|
||||||
true // Vision ...
|
true // Vision ...
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -516,6 +516,33 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
// Fix rf Reward ...
|
// Fix rf Reward ...
|
||||||
rfRewar = 2;
|
rfRewar = 2;
|
||||||
}
|
}
|
||||||
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_XWPVZ)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
iAtr = provider.decisionXConditions.atrBuffer[1];
|
||||||
|
iAtr *= 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
Clean(sls);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Prepare Box fro SL ...
|
||||||
|
double risk = pivot - point;
|
||||||
|
|
||||||
|
iSL = risk <= (100 * points)
|
||||||
|
? pivot
|
||||||
|
: isBullish
|
||||||
|
? NormalizePrice(entry - (50 * points), signalBox.ob.symbol)
|
||||||
|
: NormalizePrice(entry + (50 * points), signalBox.ob.symbol);
|
||||||
|
Add(
|
||||||
|
iSL,
|
||||||
|
sls //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Fix rf Reward ...
|
||||||
|
rfRewar = 2;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Print("XWZ ", ToString(signalBoxDir), " Signal Provided: ", EnumToString(signalProvider));
|
Print("XWZ ", ToString(signalBoxDir), " Signal Provided: ", EnumToString(signalProvider));
|
||||||
|
|||||||
@@ -2102,6 +2102,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
//
|
//
|
||||||
isSenario5Happend = cParser.HasXWPVZConditions(
|
isSenario5Happend = cParser.HasXWPVZConditions(
|
||||||
X_CYCLE_DECISION,
|
X_CYCLE_DECISION,
|
||||||
|
X_CYCLE_CONSOLIDATION,
|
||||||
box,
|
box,
|
||||||
dir,
|
dir,
|
||||||
provider,
|
provider,
|
||||||
|
|||||||
@@ -734,9 +734,6 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
bool showAll = false;
|
bool showAll = false;
|
||||||
|
|
||||||
//
|
|
||||||
x121Inputs.showRSI = showAll || false;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
|
|
||||||
@@ -769,7 +766,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
x121Inputs.x3maInputs.x3maSlowMALength = 200;
|
x121Inputs.x3maInputs.x3maSlowMALength = 200;
|
||||||
|
|
||||||
//
|
//
|
||||||
x121Inputs.xichInputs.shiftKumo = false;
|
x121Inputs.xichInputs.shiftKumo = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
x121Inputs.showRSI = showAll || false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// x121Inputs.xcheInputs.cheLength = 14;
|
// x121Inputs.xcheInputs.cheLength = 14;
|
||||||
@@ -800,8 +800,8 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
x121Inputs.xpvInputs.showSar = showAll || false;
|
x121Inputs.xpvInputs.showSar = showAll || false;
|
||||||
x121Inputs.xpvInputs.showPeaks = showAll || false;
|
x121Inputs.xpvInputs.showPeaks = showAll || true;
|
||||||
x121Inputs.xpvInputs.showVales = showAll || false;
|
x121Inputs.xpvInputs.showVales = showAll || true;
|
||||||
x121Inputs.xpvInputs.showSupports = showAll || false;
|
x121Inputs.xpvInputs.showSupports = showAll || false;
|
||||||
x121Inputs.xpvInputs.showResistances = showAll || false;
|
x121Inputs.xpvInputs.showResistances = showAll || false;
|
||||||
x121Inputs.xpvInputs.showGoldenZones = showAll || false;
|
x121Inputs.xpvInputs.showGoldenZones = showAll || false;
|
||||||
@@ -854,7 +854,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// X3MA ...
|
// X3MA ...
|
||||||
x121Inputs.x3maInputs.showX3MaFast = showAll || false;
|
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
|
||||||
x121Inputs.x3maInputs.showX3MaMid = showAll || false;
|
x121Inputs.x3maInputs.showX3MaMid = showAll || false;
|
||||||
x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
|
x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
|
||||||
|
|
||||||
@@ -862,7 +862,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
// XICH ...
|
// XICH ...
|
||||||
x121Inputs.xichInputs.showTenkanSen = showAll || true;
|
x121Inputs.xichInputs.showTenkanSen = showAll || true;
|
||||||
x121Inputs.xichInputs.showKijunSen = showAll || true;
|
x121Inputs.xichInputs.showKijunSen = showAll || true;
|
||||||
x121Inputs.xichInputs.showChikouSpan = showAll || false;
|
x121Inputs.xichInputs.showChikouSpan = showAll || true;
|
||||||
x121Inputs.xichInputs.showSenkouSpanA = showAll || true;
|
x121Inputs.xichInputs.showSenkouSpanA = showAll || true;
|
||||||
x121Inputs.xichInputs.showSenkouSpanB = showAll || true;
|
x121Inputs.xichInputs.showSenkouSpanB = showAll || true;
|
||||||
x121Inputs.xichInputs.showKumo = showAll || false;
|
x121Inputs.xichInputs.showKumo = showAll || false;
|
||||||
|
|||||||
Reference in New Issue
Block a user