This commit is contained in:
2025-03-20 04:54:46 +03:30
parent 012499cc73
commit 1f8d75f9b4
12 changed files with 285 additions and 129 deletions
+2 -1
View File
@@ -602,8 +602,9 @@ void CalculateValues(
// //
// Calculate Applied Price ... // Calculate Applied Price ...
ENUM_X_PRICE mPType = ToXPrice(maAppliedTo);
double iPrice = GetAppliedPrice( double iPrice = GetAppliedPrice(
maAppliedTo, mPType,
open, open,
high, high,
low, low,
+4 -2
View File
@@ -575,8 +575,9 @@ void CalculateAtrZones(
// //
// Select Upper Price ... // Select Upper Price ...
ENUM_X_PRICE mUpperType = ToXPrice(atrUpperAppliedTo);
double upperPrice = GetAppliedPrice( double upperPrice = GetAppliedPrice(
atrUpperAppliedTo, mUpperType,
open, open,
high, high,
low, low,
@@ -586,8 +587,9 @@ void CalculateAtrZones(
// //
// Select Lower Price ... // Select Lower Price ...
ENUM_X_PRICE mLowerType = ToXPrice(atrLowerAppliedTo);
double lowerPrice = GetAppliedPrice( double lowerPrice = GetAppliedPrice(
atrLowerAppliedTo, mLowerType,
open, open,
high, high,
low, low,
+2 -1
View File
@@ -491,8 +491,9 @@ void CalculateStr(
{ {
// //
// Calculated Price ... // Calculated Price ...
ENUM_X_PRICE mPTYpe = ToXPrice(strAppliedTo);
double price = GetAppliedPrice( double price = GetAppliedPrice(
strAppliedTo, mPTYpe,
open, open,
high, high,
low, low,
+2 -1
View File
@@ -581,8 +581,9 @@ void CalculateTrend(
) )
{ {
// //
ENUM_X_PRICE mPType = ToXPrice(trendPriceType);
double iPrice = GetAppliedPrice( double iPrice = GetAppliedPrice(
trendPriceType, mPType,
open, open,
high, high,
low, low,
+2 -1
View File
@@ -615,8 +615,9 @@ void CalculateVWAPDataBuffers(
) )
{ {
// //
ENUM_X_PRICE mPType = ToXPrice(vwapAppliedTo);
double price = GetAppliedPrice( double price = GetAppliedPrice(
vwapAppliedTo, mPType,
open, open,
high, high,
low, low,
@@ -5930,10 +5930,10 @@ double GetPipPrice(
*/ */
double GetAppliedPrice( double GetAppliedPrice(
ENUM_X_PRICE mType, // Type of Price Selection ENUM_X_PRICE mType, // Type of Price Selection
double &mOpen[], // Open Prices const double &mOpen[], // Open Prices
double &mHigh[], // High Preices const double &mHigh[], // High Preices
double &mLow[], // Low Prices const double &mLow[], // Low Prices
double &mClose[], // Close Prices const double &mClose[], // Close Prices
int barIndex // Bar Index int barIndex // Bar Index
) )
{ {
@@ -2799,30 +2799,156 @@ struct X121SMCStrategyConditionParser
IsBearish(iBarPosDir); IsBearish(iBarPosDir);
// //
// result = isBarValidForBullish || XSignalBox iSignalBox;
// isBarValidForBearish; count = ArraySize(waitingBoxes);
// if (!result) has = IsValidSize(count);
// { if (has)
// // {
// zBar.Clean(); //
// cBar.Clean(); for (int i = 0; i < count; i++)
// pBar.Clean(); {
// cState.Clean(); //
// chState.Clean(); XSignalBox iBox = waitingBoxes[i];
// insideBox.Clean();
// ZeroMemory(cHelper);
// cConditions.Clean();
// cXConditions.Clean();
// ZeroMemory(chHelper);
// chConditions.Clean();
// chXConditions.Clean();
// // //
// return result; bool isBullish = iBox.ob.IsBullish();
// } bool hasFVG = iBox.fvg.IsValid();
//
bool isFVGBullishRejected =
//
hasFVG &&
cBar.low < iBox.fvg.upper &&
cBar.GetDown() > iBox.fvg.upper
//
;
//
bool isFVGBearishRejected =
//
hasFVG &&
cBar.high > iBox.fvg.lower &&
cBar.GetUp() < iBox.fvg.lower
//
;
//
bool isOBBullishRejected =
//
cBar.low < iBox.ob.upper &&
cBar.GetDown() > iBox.ob.upper
//
;
//
bool isOBBearishRejected =
//
cBar.high > iBox.ob.lower &&
cBar.GetUp() < iBox.ob.lower
//
;
//
has =
isBullish
? isBarValidForBullish &&
(hasFVG
? isFVGBullishRejected
: isOBBullishRejected)
: isBarValidForBearish &&
(hasFVG
? isFVGBearishRejected
: isOBBearishRejected);
if (has)
{
//
iSignalBox = iBox;
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
has = iSignalBox.IsValid();
// //
// Detecting Signal Conditions ... // Retest Signal ...
int retests = 0;
if (has)
{
//
bool hasFVG = iSignalBox.fvg.IsValid();
XBoxZone iBox;
if (hasFVG)
{
iBox = iSignalBox.fvg;
}
else
{
iBox = iSignalBox.ob;
}
//
int iFromIDX = GetBarIndex(
cBar.symbol,
cBar.period,
iBox.from //
);
has = IsValidIndex(iFromIDX);
if (has)
{
//
// Counting Retests ...
for (int i = iFromIDX; i >= barIndex; i--)
{
//
XOHCL iBar;
has = iBar.Init(
cBar.symbol,
cBar.period,
i //
);
//
bool isBullishRetested =
//
iBar.low < iBox.upper &&
iBar.GetDown() > iBox.upper
//
;
//
bool isBearishRetested =
//
iBar.high > iBox.lower &&
iBar.GetUp() < iBox.lower
//
;
//
has = iBox.IsBullish()
? isBullishRetested
: isBearishRetested;
if (has)
{
retests++;
}
//
iBar.Clean();
}
}
//
iBox.Clean();
}
//
bool isSignalBoxRetested = retests > 1;
bool hasSignalBox = iSignalBox.IsValid();
bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir);
// //
// Bullish Conditions ... // Bullish Conditions ...
@@ -2831,11 +2957,10 @@ struct X121SMCStrategyConditionParser
// Base Condition ... // Base Condition ...
( (
// //
false hasSignalBox &&
// cBar.IsBullish() && isSignalBoxBullish &&
// isBarValidForBullish && isSignalBoxRetested &&
// cBar.close > cXConditions.x3maFastBuffer[cIDX] && isBarValidForBullish
// cXConditions.x3maFastBuffer[cIDX] < cXConditions.x3maSlowBuffer[cIDX]
// //
) )
// //
@@ -2848,11 +2973,10 @@ struct X121SMCStrategyConditionParser
// Base Condition ... // Base Condition ...
( (
// //
false hasSignalBox &&
// cBar.IsBearish() && !isSignalBoxBullish &&
// isBarValidForBearish && isSignalBoxRetested &&
// cBar.close < cXConditions.x3maFastBuffer[cIDX] && isBarValidForBearish
// cXConditions.x3maFastBuffer[cIDX] > cXConditions.x3maSlowBuffer[cIDX]
// //
) )
// //
@@ -2872,13 +2996,17 @@ struct X121SMCStrategyConditionParser
: X_DIRECTION_BEARISH; : X_DIRECTION_BEARISH;
// //
box.dir = dir; if (iSignalBox.fvg.IsValid())
{
box = iSignalBox.fvg;
}
else
{
box = iSignalBox.ob;
}
//
box.to = TimeCurrent(); box.to = TimeCurrent();
// box.from = insideBox.from;
// box.upper = insideBox.upper;
// box.lower = insideBox.lower;
box.symbol = cXConditions.symbol;
box.period = cXConditions.period;
} }
// //
@@ -2896,7 +3024,7 @@ struct X121SMCStrategyConditionParser
pBar.Clean(); pBar.Clean();
cState.Clean(); cState.Clean();
chState.Clean(); chState.Clean();
// insideBox.Clean(); iSignalBox.Clean();
ZeroMemory(cHelper); ZeroMemory(cHelper);
cConditions.Clean(); cConditions.Clean();
cStateEvents.Clean(); cStateEvents.Clean();
@@ -223,7 +223,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
// //
// Detectiong Signal Boxes ... // Detectiong Signal Boxes ...
hasWaitingBoxes = workingZone hasWaitingBoxes = workingZone
.DetectSignalBoxes( .DetectWaitingBoxes(
X_CYCLE_ANALYSE, X_CYCLE_ANALYSE,
provider, provider,
zIndex // zIndex //
@@ -472,53 +472,23 @@ class XCX121SMCXWZSignalDetector : public XCBase
iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0; iAtr *= 0;
} }
// else else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
// if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX) {
// { //
// // iAtr = provider.decisionXConditions.atrBuffer[1];
// iAtr = provider.decisionXConditions.atrBuffer[1]; iAtr *= 0;
// iAtr *= 1.5;
// // // //
// // if (isBullish) Clean(sls);
// // {
// // // //
// // iSL = MathMin( // Prepare Box fro SL ...
// // provider.decisionXConditions.le1Buffer[1], iSL = signalBox.lower + ((signalBox.upper - signalBox.lower) / 2);
// // provider.decisionXConditions.le2Buffer[1] // Add(
// // ); iSL,
// // if (iSL > 0) sls //
// // { );
// // // }
// // Add(
// // iSL,
// // sls //
// // );
// // }
// // }
// // else
// // {
// // //
// // iSL = MathMax(
// // provider.decisionXConditions.se1Buffer[1],
// // provider.decisionXConditions.se2Buffer[1] //
// // );
// // if (iSL > 0)
// // {
// // //
// // Add(
// // iSL,
// // sls //
// // );
// // }
// // }
// }
// else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_AREA)
// {
// //
// iAtr = provider.decisionXConditions.atrBuffer[1];
// iAtr *= 1.5;
// }
// //
// Select Condition SL ... // Select Condition SL ...
+82 -30
View File
@@ -32,6 +32,7 @@ enum ENUM_X121SMC_XWZ_PROVIDERS
{ {
X121SMC_XWZ_PROVIDER_NONE, X121SMC_XWZ_PROVIDER_NONE,
X121SMC_XWZ_PROVIDER_XHKMA, X121SMC_XWZ_PROVIDER_XHKMA,
X121SMC_XWZ_PROVIDER_XREJECTED_BOX,
}; };
// //
@@ -466,7 +467,7 @@ struct X121SMCStrategyXWZWorkingZone
* *
* @return ( bool ) * @return ( bool )
*/ */
bool DetectSignalBoxes( bool DetectWaitingBoxes(
ENUM_X_CYCLES cycle, ENUM_X_CYCLES cycle,
X121SMCStrategySignalProviderData &provider, X121SMCStrategySignalProviderData &provider,
int barIndex = 0 // int barIndex = 0 //
@@ -524,46 +525,91 @@ struct X121SMCStrategyXWZWorkingZone
if (has) if (has)
{ {
// //
XCFVG *iFVG = NULL;
XCOrderBlock *iOB = cState.orderBlocks[idx]; XCOrderBlock *iOB = cState.orderBlocks[idx];
bool isBullish = iOB.IsBullish(); bool isBullish = iOB.IsBullish();
//
// Detecting Inside FVG ...
has = cState.HasFairValueGaps();
if (has)
{
//
XCFVG *tmpFVGs[];
count = cState.CountFairValueGaps();
for (int i = 0; i < count; i++)
{
//
XCFVG *jFVG = cState.fairValueGaps[i];
//
bool isDirPassed = jFVG.GetDirection() == iOB.GetDirection();
bool isFromPassed = jFVG.From() >= iOB.From();
bool isPlacePassed = IsInsideOrDiff(
jFVG,
iOB,
false //
);
//
has = isDirPassed &&
isFromPassed &&
isPlacePassed;
if (has)
{
//
Add(
jFVG,
tmpFVGs //
);
}
//
ZeroMemory(jFVG);
}
//
// Selecting iFVG Based on Direction of OB ...
has = HasChild(tmpFVGs);
if (has)
{
//
idx =
isBullish
? GetLowest(tmpFVGs)
: GetHighest(tmpFVGs);
has = IsValidIndex(idx);
if (has)
{
iFVG = tmpFVGs[idx];
}
}
//
Clean(tmpFVGs);
}
// //
XBoxZone iOBBox; XBoxZone iOBBox;
XBoxZone iFVGBox; XBoxZone iFVGBox;
if (iFVG != NULL)
{
//
has = ToBox(
iFVGBox,
iFVG //
);
}
//
has = ToBox( has = ToBox(
iOBBox, iOBBox,
iOB // iOB //
); );
if (has)
{
//
// Detect FVGs ...
if (cStateEvents.hasNewFairValueGap)
{
//
int idx =
isBullish
? GetLowest(cState.bullishFairValueGaps)
: GetHighest(cState.bearishFairValueGaps);
XCFVG *iFVG =
isBullish
? cState.bullishFairValueGaps[idx]
: cState.bearishFairValueGaps[idx];
has = IsValidIndex(idx);
if (has)
{
//
ToBox(
iFVGBox,
iFVG //
);
}
}
}
// //
has = iOBBox.IsValid() && has = iOBBox.IsValid();
iFVGBox.IsValid();
if (has) if (has)
{ {
// //
@@ -586,6 +632,8 @@ struct X121SMCStrategyXWZWorkingZone
// //
iOBBox.Clean(); iOBBox.Clean();
iFVGBox.Clean(); iFVGBox.Clean();
ZeroMemory(iOB);
ZeroMemory(iFVG);
} }
} }
@@ -1099,7 +1147,7 @@ struct X121SMCStrategyXWZWorkingZone
// //
if (isSenario1Happend) if (isSenario1Happend)
{ {
signalProvider = X121SMC_XWZ_PROVIDER_XHKMA; signalProvider = X121SMC_XWZ_PROVIDER_XREJECTED_BOX;
} }
} }
@@ -1661,6 +1709,10 @@ struct X121SMCStrategyXWZWorkingZone
); );
if (has) if (has)
{ {
//
iFVGBoxObj.BoxStyle(STYLE_SOLID);
//
mDrawnObjects.Add(iFVGBoxObj); mDrawnObjects.Add(iFVGBoxObj);
} }
@@ -798,7 +798,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true;
// //
// XMAS ... // XMAS ...
@@ -841,9 +841,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// X3MA ... // X3MA ...
x121Inputs.x3maInputs.showX3MaFast = showAll || true; x121Inputs.x3maInputs.showX3MaFast = showAll || false;
x121Inputs.x3maInputs.showX3MaMid = showAll || true; x121Inputs.x3maInputs.showX3MaMid = showAll || false;
x121Inputs.x3maInputs.showX3MaSlow = showAll || true; x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
// //
// Initialize Cycle Helpers ... // Initialize Cycle Helpers ...