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 ...
ENUM_X_PRICE mPType = ToXPrice(maAppliedTo);
double iPrice = GetAppliedPrice(
maAppliedTo,
mPType,
open,
high,
low,
+4 -2
View File
@@ -575,8 +575,9 @@ void CalculateAtrZones(
//
// Select Upper Price ...
ENUM_X_PRICE mUpperType = ToXPrice(atrUpperAppliedTo);
double upperPrice = GetAppliedPrice(
atrUpperAppliedTo,
mUpperType,
open,
high,
low,
@@ -586,8 +587,9 @@ void CalculateAtrZones(
//
// Select Lower Price ...
ENUM_X_PRICE mLowerType = ToXPrice(atrLowerAppliedTo);
double lowerPrice = GetAppliedPrice(
atrLowerAppliedTo,
mLowerType,
open,
high,
low,
+2 -1
View File
@@ -491,8 +491,9 @@ void CalculateStr(
{
//
// Calculated Price ...
ENUM_X_PRICE mPTYpe = ToXPrice(strAppliedTo);
double price = GetAppliedPrice(
strAppliedTo,
mPTYpe,
open,
high,
low,
+2 -1
View File
@@ -581,8 +581,9 @@ void CalculateTrend(
)
{
//
ENUM_X_PRICE mPType = ToXPrice(trendPriceType);
double iPrice = GetAppliedPrice(
trendPriceType,
mPType,
open,
high,
low,
+2 -1
View File
@@ -615,8 +615,9 @@ void CalculateVWAPDataBuffers(
)
{
//
ENUM_X_PRICE mPType = ToXPrice(vwapAppliedTo);
double price = GetAppliedPrice(
vwapAppliedTo,
mPType,
open,
high,
low,
@@ -5930,10 +5930,10 @@ double GetPipPrice(
*/
double GetAppliedPrice(
ENUM_X_PRICE mType, // Type of Price Selection
double &mOpen[], // Open Prices
double &mHigh[], // High Preices
double &mLow[], // Low Prices
double &mClose[], // Close Prices
const double &mOpen[], // Open Prices
const double &mHigh[], // High Preices
const double &mLow[], // Low Prices
const double &mClose[], // Close Prices
int barIndex // Bar Index
)
{
@@ -2799,30 +2799,156 @@ struct X121SMCStrategyConditionParser
IsBearish(iBarPosDir);
//
// result = isBarValidForBullish ||
// isBarValidForBearish;
// if (!result)
// {
// //
// zBar.Clean();
// cBar.Clean();
// pBar.Clean();
// cState.Clean();
// chState.Clean();
// insideBox.Clean();
// ZeroMemory(cHelper);
// cConditions.Clean();
// cXConditions.Clean();
// ZeroMemory(chHelper);
// chConditions.Clean();
// chXConditions.Clean();
// //
// return result;
// }
XSignalBox iSignalBox;
count = ArraySize(waitingBoxes);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XSignalBox iBox = waitingBoxes[i];
//
// Detecting Signal Conditions ...
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();
//
// 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 ...
@@ -2831,11 +2957,10 @@ struct X121SMCStrategyConditionParser
// Base Condition ...
(
//
false
// cBar.IsBullish() &&
// isBarValidForBullish &&
// cBar.close > cXConditions.x3maFastBuffer[cIDX] &&
// cXConditions.x3maFastBuffer[cIDX] < cXConditions.x3maSlowBuffer[cIDX]
hasSignalBox &&
isSignalBoxBullish &&
isSignalBoxRetested &&
isBarValidForBullish
//
)
//
@@ -2848,11 +2973,10 @@ struct X121SMCStrategyConditionParser
// Base Condition ...
(
//
false
// cBar.IsBearish() &&
// isBarValidForBearish &&
// cBar.close < cXConditions.x3maFastBuffer[cIDX] &&
// cXConditions.x3maFastBuffer[cIDX] > cXConditions.x3maSlowBuffer[cIDX]
hasSignalBox &&
!isSignalBoxBullish &&
isSignalBoxRetested &&
isBarValidForBearish
//
)
//
@@ -2872,13 +2996,17 @@ struct X121SMCStrategyConditionParser
: X_DIRECTION_BEARISH;
//
box.dir = dir;
if (iSignalBox.fvg.IsValid())
{
box = iSignalBox.fvg;
}
else
{
box = iSignalBox.ob;
}
//
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();
cState.Clean();
chState.Clean();
// insideBox.Clean();
iSignalBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cStateEvents.Clean();
@@ -223,7 +223,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
//
// Detectiong Signal Boxes ...
hasWaitingBoxes = workingZone
.DetectSignalBoxes(
.DetectWaitingBoxes(
X_CYCLE_ANALYSE,
provider,
zIndex //
@@ -472,53 +472,23 @@ class XCX121SMCXWZSignalDetector : public XCBase
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
}
// else
// if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX)
// {
// //
// iAtr = provider.decisionXConditions.atrBuffer[1];
// iAtr *= 1.5;
else if (signalProvider == X121SMC_XWZ_PROVIDER_XREJECTED_BOX)
{
//
iAtr = provider.decisionXConditions.atrBuffer[1];
iAtr *= 0;
// // //
// // if (isBullish)
// // {
// // //
// // iSL = MathMin(
// // provider.decisionXConditions.le1Buffer[1],
// // provider.decisionXConditions.le2Buffer[1] //
// // );
// // if (iSL > 0)
// // {
// // //
// // 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;
// }
//
Clean(sls);
//
// Prepare Box fro SL ...
iSL = signalBox.lower + ((signalBox.upper - signalBox.lower) / 2);
Add(
iSL,
sls //
);
}
//
// Select Condition SL ...
+77 -25
View File
@@ -32,6 +32,7 @@ enum ENUM_X121SMC_XWZ_PROVIDERS
{
X121SMC_XWZ_PROVIDER_NONE,
X121SMC_XWZ_PROVIDER_XHKMA,
X121SMC_XWZ_PROVIDER_XREJECTED_BOX,
};
//
@@ -466,7 +467,7 @@ struct X121SMCStrategyXWZWorkingZone
*
* @return ( bool )
*/
bool DetectSignalBoxes(
bool DetectWaitingBoxes(
ENUM_X_CYCLES cycle,
X121SMCStrategySignalProviderData &provider,
int barIndex = 0 //
@@ -524,46 +525,91 @@ struct X121SMCStrategyXWZWorkingZone
if (has)
{
//
XCFVG *iFVG = NULL;
XCOrderBlock *iOB = cState.orderBlocks[idx];
bool isBullish = iOB.IsBullish();
//
XBoxZone iOBBox;
XBoxZone iFVGBox;
has = ToBox(
iOBBox,
iOB //
);
// Detecting Inside FVG ...
has = cState.HasFairValueGaps();
if (has)
{
//
// Detect FVGs ...
if (cStateEvents.hasNewFairValueGap)
XCFVG *tmpFVGs[];
count = cState.CountFairValueGaps();
for (int i = 0; i < count; i++)
{
//
int idx =
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(cState.bullishFairValueGaps)
: GetHighest(cState.bearishFairValueGaps);
XCFVG *iFVG =
isBullish
? cState.bullishFairValueGaps[idx]
: cState.bearishFairValueGaps[idx];
? GetLowest(tmpFVGs)
: GetHighest(tmpFVGs);
has = IsValidIndex(idx);
if (has)
{
//
ToBox(
iFVGBox,
iFVG //
);
}
iFVG = tmpFVGs[idx];
}
}
//
has = iOBBox.IsValid() &&
iFVGBox.IsValid();
Clean(tmpFVGs);
}
//
XBoxZone iOBBox;
XBoxZone iFVGBox;
if (iFVG != NULL)
{
//
has = ToBox(
iFVGBox,
iFVG //
);
}
//
has = ToBox(
iOBBox,
iOB //
);
//
has = iOBBox.IsValid();
if (has)
{
//
@@ -586,6 +632,8 @@ struct X121SMCStrategyXWZWorkingZone
//
iOBBox.Clean();
iFVGBox.Clean();
ZeroMemory(iOB);
ZeroMemory(iFVG);
}
}
@@ -1099,7 +1147,7 @@ struct X121SMCStrategyXWZWorkingZone
//
if (isSenario1Happend)
{
signalProvider = X121SMC_XWZ_PROVIDER_XHKMA;
signalProvider = X121SMC_XWZ_PROVIDER_XREJECTED_BOX;
}
}
@@ -1661,6 +1709,10 @@ struct X121SMCStrategyXWZWorkingZone
);
if (has)
{
//
iFVGBoxObj.BoxStyle(STYLE_SOLID);
//
mDrawnObjects.Add(iFVGBoxObj);
}
@@ -798,7 +798,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true;
//
// XMAS ...
@@ -841,9 +841,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// X3MA ...
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
x121Inputs.x3maInputs.showX3MaMid = showAll || true;
x121Inputs.x3maInputs.showX3MaSlow = showAll || true;
x121Inputs.x3maInputs.showX3MaFast = showAll || false;
x121Inputs.x3maInputs.showX3MaMid = showAll || false;
x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
//
// Initialize Cycle Helpers ...