This commit is contained in:
2025-03-04 03:05:25 +03:30
parent 6a3fb91e9c
commit ec006cd6b7
6 changed files with 1278 additions and 357 deletions
+6 -6
View File
@@ -49,8 +49,8 @@ input bool eaAllowShort = true; // Allow Short Signal
input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals
input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals
input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol
input double eaLastPositionProfitForAcceptNextInPoint = 0; // Last Position Profit In Points for Accept new Signal input double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal
input int eaDelaysBetweenTwoSignalsInBar = 0; // Delay between two Signals in Bars input int eaDelaysBetweenTwoSignalsInBar = 12; // Delay between two Signals in Bars
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
@@ -58,8 +58,8 @@ input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Ver
// Trade ... // Trade ...
input group "Trade"; input group "Trade";
input bool eaAllowTrade = true; // Allow Open Trade On Signals input bool eaAllowTrade = true; // Allow Open Trade On Signals
input string eaStartTradeAt = ""; // Enable Trade on Signals on Time input string eaStartTradeAt = "02:30"; // Enable Trade on Signals on Time
input string eaStopTradeAt = ""; // Enable Trade on Signals on Time input string eaStopTradeAt = "23:30"; // Enable Trade on Signals on Time
input string eaCloseAllTradesAt = ""; // Enable Close All Trades on Signals on Time input string eaCloseAllTradesAt = ""; // Enable Close All Trades on Signals on Time
// //
@@ -82,9 +82,9 @@ input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 10800; // Pause
// Protection ... // Protection ...
input group "Protection"; input group "Protection";
input bool eaAllowHedging = true; // Allow Hedge Positions input bool eaAllowHedging = true; // Allow Hedge Positions
input int eaMinOpenTradesFroHedging = 4; // Minimum Open Positions for Hedging input int eaMinOpenTradesFroHedging = 3; // Minimum Open Positions for Hedging
input double eaHedgingMinVolumeStep = 0.01; // Minimum Volume Step for Hedging input double eaHedgingMinVolumeStep = 0.01; // Minimum Volume Step for Hedging
input double eaHedgeingMinRequiredProfitPerVolumeStep = 4.0; // Minimum Required Profit Per Volume Step for Hedging input double eaHedgeingMinRequiredProfitPerVolumeStep = 1.0; // Minimum Required Profit Per Volume Step for Hedging
// //
// Alert ... // Alert ...
@@ -1299,7 +1299,7 @@ bool HasInsideBox(
// //
bool isInside = !iBox.IsSameAs(source) && bool isInside = !iBox.IsSameAs(source) &&
IsBoxInside( IsBoxInsideOr(
iBox, iBox,
source // source //
); );
@@ -169,12 +169,14 @@ class XC121SMCCycleHelper : public XCBase
// //
int maxLoopbackBars = mPOIDetector.MaxAllowedLoopbackForInit(); int maxLoopbackBars = mPOIDetector.MaxAllowedLoopbackForInit();
int periodSeconds = PeriodSeconds(period); int periodSeconds = PeriodSeconds(period);
if (periodSeconds > PeriodSeconds(PERIOD_M15)) { if (periodSeconds > PeriodSeconds(PERIOD_M15))
{
// //
int multiplier = periodSeconds / PeriodSeconds(PERIOD_M15); int multiplier = periodSeconds / PeriodSeconds(PERIOD_M15);
// //
if (multiplier >= 1) { if (multiplier >= 1)
{
maxLoopbackBars *= 2; maxLoopbackBars *= 2;
} }
} }
@@ -450,6 +452,134 @@ class XC121SMCCycleHelper : public XCBase
return result; return result;
} }
bool GeneratePVBox(
XBoxZone &box,
int barIndex = 0 //
)
{
//
bool result = false;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
box.Clean();
box.symbol = GetSymbol();
box.period = GetPeriod();
//
int index = barIndex;
//
// Peak ...
datetime peaksSameFrom = NULL;
double peak = mX121Helper.xpvHelper.GetPeak(index);
double prevPeak = mX121Helper.xpvHelper.GetPeak(index + 1);
bool startsByPeak = peak == prevPeak;
//
// Vale ...
datetime valesSameFrom = NULL;
double vale = mX121Helper.xpvHelper.GetVale(index);
double prevVale = mX121Helper.xpvHelper.GetVale(index + 1);
bool startsByVale = vale == prevVale;
//
bool canBreak = false;
while (!canBreak)
{
//
index++;
//
datetime cTime = iTime(
box.symbol,
box.period,
index //
);
//
// Peak ...
double iPeak = mX121Helper.xpvHelper.GetPeak(index);
//
// Vale ...
double iVale = mX121Helper.xpvHelper.GetVale(index);
//
// Start By Peak or Value ...
bool isSame = false;
if (startsByPeak)
{
//
isSame = iPeak == peak;
bool canSetVale = vale == 0
? true
: iVale > vale;
if (canSetVale)
{
vale = iVale;
}
}
else if (startsByVale)
{
//
isSame = iVale == vale;
bool canSetPeak = peak == 0
? true
: iPeak < peak;
if (canSetPeak)
{
peak = iPeak;
}
}
//
if (isSame)
{
//
box.from = cTime;
box.upper = peak;
box.lower = vale;
}
else if (IsValid(box.from))
{
//
// Complete Box ...
box.to = iTime(
box.symbol,
box.period,
barIndex //
);
//
box.type = "XPVBox";
box.dir = startsByPeak
? X_DIRECTION_BEARISH
: startsByVale
? X_DIRECTION_BULLISH
: X_DIRECTION_NONE;
}
//
canBreak = !isSame;
}
//
result = box.IsValid();
if (!result)
{
box.Clean();
}
//
return result;
}
// //
// Virtuals ... // Virtuals ...
+413 -110
View File
@@ -500,6 +500,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
idx = i; idx = i;
signalBox = iBox; signalBox = iBox;
hasSignalBox = has; hasSignalBox = has;
signalBox.to = cTime;
signalBoxDir = iBox.dir; signalBoxDir = iBox.dir;
isSignalBoxReversal = false; isSignalBoxReversal = false;
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE; provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
@@ -553,119 +554,25 @@ class XCX121SMCXWZSignalDetector : public XCBase
if (!hasSignalBox) if (!hasSignalBox)
{ {
// //
// Score Conditions ... // Senari A ...
double scoreMultiplier = 3;
bool isBullishScorePassed =
//
analyseBullishScore > (analyseBearishScore * scoreMultiplier) &&
decisionBullishScore > (decisionBearishScore * scoreMultiplier)
//
;
bool isBearishScorePassed =
//
analyseBearishScore > (analyseBullishScore * scoreMultiplier) &&
decisionBearishScore > (decisionBullishScore * scoreMultiplier)
//
;
// //
// X3Ma ... hasSignalBox = hasWorkingZone &&
workingZone.DetectSenarioASignalBox(
// signalBox,
// X3Ma Bullish ... signalBoxDir,
bool isX3MaBullish = decisionXConditions,
// analyseXConditions,
decisionXConditions.isX3MaBullishState && decisionCycleHelper,
decisionXConditions.isX3MaSwitchedToBullishOrdered && drawer,
decisionXConditions.x3maMidBuffer[1] > decisionXConditions.x3maSlowBuffer[1] zIndex //
// );
; if (hasSignalBox)
//
// X3Ma Bearish ...
bool isX3MaBearish =
//
decisionXConditions.isX3MaBearishState &&
decisionXConditions.isX3MaSwitchedToBearishOrdered &&
decisionXConditions.x3maMidBuffer[1] < decisionXConditions.x3maSlowBuffer[1]
//
;
//
bool isX3MaHasCondition =
(isX3MaBullish &&
isBullishScorePassed) ||
(isX3MaBearish &&
isBearishScorePassed);
//
// VWap ...
//
// VWap Bullish ...
bool isVWapBullish =
//
decisionXConditions.isVWapBullishState &&
decisionXConditions.isVWapSwitchedToBullishOrdered &&
decisionXConditions.vwapMidBuffer[1] > decisionXConditions.vwapSlowBuffer[1]
//
;
//
// VWap Bearish ...
bool isVWapBearish =
//
decisionXConditions.isVWapBearishState &&
decisionXConditions.isVWapSwitchedToBearishOrdered &&
decisionXConditions.vwapMidBuffer[1] < decisionXConditions.vwapSlowBuffer[1]
//
;
//
bool isVWapHasCondition =
(isVWapBullish &&
isBullishScorePassed) ||
(isVWapBearish &&
isBearishScorePassed);
//
// Checking Other Conditions XWZ Reject on EMA 20 ...
//
// Check Has Conditions ...
bool hasXConditions =
(isX3MaHasCondition ||
isVWapHasCondition);
//
if (hasXConditions)
{ {
// //
if (isX3MaHasCondition) signalBox.to = cTime;
{ isSignalBoxReversal = false;
// provider = X121SMC_XWZ_PROVIDER_PV_ZONE;
signalBoxDir =
isX3MaBullish
? X_DIRECTION_BULLISH
: isX3MaBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
if (isVWapHasCondition)
{
//
signalBoxDir =
isVWapBullish
? X_DIRECTION_BULLISH
: isVWapBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
Print("X Conditions ...");
} }
} }
@@ -711,10 +618,394 @@ class XCX121SMCXWZSignalDetector : public XCBase
iObj.BoxWidth(1); iObj.BoxWidth(1);
iObj.BoxColor(clrYellow); iObj.BoxColor(clrYellow);
iObj.BoxStyle(STYLE_SOLID); iObj.BoxStyle(STYLE_SOLID);
}
// //
Print("Signal Box Exists ..."); isBullish = IsBullish(signalBoxDir);
isBearish = IsBearish(signalBoxDir);
//
pivot = isBullish
? signalBox.lower
: signalBox.upper;
//
point = isBullish
? signalBox.upper
: signalBox.lower;
//
double iSL = 0;
double signalBoxRange = (signalBox.upper - signalBox.lower);
if (signalBoxRange < points * 100)
{
iSL = pivot;
} }
else
{
iSL = signalBox.lower + (signalBox.upper - signalBox.lower) / 2;
}
//
Add(
iSL,
sls //
);
//
// Targets ...
//
// Based On Priority ...
has = priority != X121SMC_XWZ_PRIORITY_NONE;
if (has)
{
//
switch (priority)
{
//
case X121SMC_XWZ_PRIORITY_WEAK:
//
if (isBullish)
{
//
// Weak ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
}
else
{
//
// Weak ...
Add(
workingZone.demandZone.Upper(),
targets //
);
}
break;
//
case X121SMC_XWZ_PRIORITY_LOW:
//
if (isBullish)
{
//
// Weak ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
//
// Low ...
Add(
workingZone.quarter1,
targets //
);
}
else
{
//
// Weak ...
Add(
workingZone.demandZone.Upper(),
targets //
);
//
// Low ...
Add(
workingZone.quarter3,
targets //
);
}
break;
//
case X121SMC_XWZ_PRIORITY_REGULAR:
//
if (isBullish)
{
//
// Weak ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
//
// Low ...
Add(
workingZone.quarter1,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
}
else
{
//
// Weak ...
Add(
workingZone.demandZone.Upper(),
targets //
);
//
// Low ...
Add(
workingZone.quarter3,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
}
break;
//
case X121SMC_XWZ_PRIORITY_HIGH:
//
if (isBullish)
{
//
// Weak ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
//
// Low ...
Add(
workingZone.quarter1,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
//
// High ...
Add(
workingZone.quarter3,
targets //
);
}
else
{
//
// Weak ...
Add(
workingZone.demandZone.Upper(),
targets //
);
//
// Low ...
Add(
workingZone.quarter3,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
//
// High ...
Add(
workingZone.quarter1,
targets //
);
}
break;
//
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
//
if (isBullish)
{
//
// Weak ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
//
// Low ...
Add(
workingZone.quarter1,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
//
// High ...
Add(
workingZone.quarter3,
targets //
);
//
// Strong High ...
Add(
workingZone.demandZone.Upper(),
targets //
);
}
else
{
//
// Weak ...
Add(
workingZone.demandZone.Upper(),
targets //
);
//
// Low ...
Add(
workingZone.quarter3,
targets //
);
//
// Regular ...
Add(
workingZone.quarter2,
targets //
);
//
// High ...
Add(
workingZone.quarter1,
targets //
);
//
// Strong High ...
Add(
workingZone.supplyZone.Lower(),
targets //
);
}
break;
}
}
//
XBoxZone waitingBoxes[];
has = workingZone.HasWaitingBoxes();
if (has)
{
//
Copy(
workingZone.waitingBoxes,
waitingBoxes //
);
//
while (HasChild(waitingBoxes))
{
//
XBoxZone iBox;
idx = GetYoungest(waitingBoxes);
has = IsValidIndex(idx);
if (!has)
{
//
iBox.Clean();
continue;
}
//
iBox = waitingBoxes[idx];
ArrayRemove(
waitingBoxes,
idx,
1 //
);
//
bool hasInside = workingZone.HasInsideBox(iBox);
if (!hasInside)
{
continue;
}
//
double iTarget =
IsBullish(signalBoxDir)
? iBox.lower
: iBox.upper;
//
Add(
iTarget,
targets //
);
//
iBox.Clean();
}
}
}
//
result = hasPriority &&
hasSignalBox &&
hasRewardAmount;
//
if (result)
{
//
Copy(
sls,
mConditions.sls //
);
Copy(
targets,
mConditions.targets //
);
//
mConditions.pivot = pivot;
mConditions.point = point;
mConditions.reward = reward;
mConditions.setupTime = cTime;
mConditions.dir = signalBoxDir;
mConditions.priority = priority;
mConditions.provider = provider;
mConditions.signalBox = signalBox;
mConditions.amountPercent = amountPercent;
} }
// //
@@ -953,6 +1244,18 @@ class XCX121SMCXWZSignalDetector : public XCBase
? longSL ? longSL
: shortSL; : shortSL;
//
// Add TP 2 as Target ...
double risk = MathAbs(entry - sl);
double reward2 = 2 * risk;
double iTP2 = isBullish
? entry + reward2
: entry - reward2;
Add(
iTP2,
conditions.targets //
);
// //
conditions.sl = sl; conditions.sl = sl;
conditions.triggerTime = cTime; conditions.triggerTime = cTime;
+490 -2
View File
@@ -30,6 +30,7 @@
enum ENUM_X121SMC_XWZ_PROVIDERS enum ENUM_X121SMC_XWZ_PROVIDERS
{ {
X121SMC_XWZ_PROVIDER_NONE, X121SMC_XWZ_PROVIDER_NONE,
X121SMC_XWZ_PROVIDER_PV_ZONE,
X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE, X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE,
X121SMC_XWZ_PROVIDER_ACTIVATED_CHOCH, X121SMC_XWZ_PROVIDER_ACTIVATED_CHOCH,
X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE, X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE,
@@ -85,6 +86,10 @@ struct X121SMCStrategyXWZWorkingZone
CArrayObj mWaitingZoneObjects; CArrayObj mWaitingZoneObjects;
CArrayObj mWorkingZoneObjects; CArrayObj mWorkingZoneObjects;
//
bool mUseOrderBlocks;
bool mUseFairValueGaps;
// //
// Constructor ... // Constructor ...
X121SMCStrategyXWZWorkingZone() X121SMCStrategyXWZWorkingZone()
@@ -129,6 +134,10 @@ struct X121SMCStrategyXWZWorkingZone
mBreakedZoneObjects.Clear(); mBreakedZoneObjects.Clear();
mWaitingZoneObjects.Clear(); mWaitingZoneObjects.Clear();
mWorkingZoneObjects.Clear(); mWorkingZoneObjects.Clear();
//
mUseOrderBlocks = true;
mUseFairValueGaps = false;
} }
// //
@@ -385,6 +394,9 @@ struct X121SMCStrategyXWZWorkingZone
// //
// Using Order Blocks ... // Using Order Blocks ...
if (mUseOrderBlocks)
{
//
has = iState.HasOrderBlocks(); has = iState.HasOrderBlocks();
if (has) if (has)
{ {
@@ -417,9 +429,13 @@ struct X121SMCStrategyXWZWorkingZone
// //
Clean(obs); Clean(obs);
} }
}
// //
// Using Fair Value Gaps ... // Using Fair Value Gaps ...
if (mUseFairValueGaps)
{
//
has = iState.HasFairValueGaps(); has = iState.HasFairValueGaps();
if (has) if (has)
{ {
@@ -479,6 +495,7 @@ struct X121SMCStrategyXWZWorkingZone
Clean(fvgs); Clean(fvgs);
Clean(boxes); Clean(boxes);
} }
}
// //
// Cleaning State ... // Cleaning State ...
@@ -976,7 +993,10 @@ struct X121SMCStrategyXWZWorkingZone
XPOIState iState = mtfState; XPOIState iState = mtfState;
// //
// Detect Waiting Zones ... // Use Order Blocks ...
if (mUseOrderBlocks)
{
//
has = iState.HasOrderBlocks(); has = iState.HasOrderBlocks();
if (has) if (has)
{ {
@@ -1070,9 +1090,13 @@ struct X121SMCStrategyXWZWorkingZone
// //
Clean(obs); Clean(obs);
} }
}
// //
// Using Fair Value Gaps ... // Use Fair Value Gaps ...
if (mUseFairValueGaps)
{
//
has = iState.HasFairValueGaps(); has = iState.HasFairValueGaps();
if (has) if (has)
{ {
@@ -1167,6 +1191,7 @@ struct X121SMCStrategyXWZWorkingZone
// //
Clean(fvgs); Clean(fvgs);
} }
}
// //
iState.Clean(); iState.Clean();
@@ -1380,6 +1405,469 @@ struct X121SMCStrategyXWZWorkingZone
return result; return result;
} }
//
bool DetectSenarioASignalBox(
XBoxZone &signalBox,
ENUM_X_DIRECTION &signalDir,
X121Conditions &decisionXConditions,
X121Conditions &analyseXConditions,
XC121SMCCycleHelper *decisionCycleHelper,
XCPOIDrawer *drawer = NULL,
int barIndex = 0 //
)
{
//
bool result = false;
//
signalBox.Clean();
signalDir = X_DIRECTION_NONE;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
result = decisionCycleHelper != NULL;
if (!result)
{
return result;
}
//
// Decision ...
double decisionBullishScore = 0;
double decisionBearishScore = 0;
decisionXConditions.GenerateScore(
decisionBullishScore,
decisionBearishScore //
);
//
// Analyse ...
double analyseBullishScore = 0;
double analyseBearishScore = 0;
analyseXConditions.GenerateScore(
analyseBullishScore,
analyseBearishScore //
);
//
// Score Conditions ...
double scoreMultiplier = 3;
bool isBullishScorePassed =
//
analyseBullishScore > (analyseBearishScore * scoreMultiplier) &&
decisionBullishScore > (decisionBearishScore * scoreMultiplier)
//
;
bool isBearishScorePassed =
//
analyseBearishScore > (analyseBullishScore * scoreMultiplier) &&
decisionBearishScore > (decisionBullishScore * scoreMultiplier)
//
;
//
// Checking Other Conditions
//
bool isCommonBullish =
//
decisionXConditions.isSarBullish &&
decisionXConditions.isStrBullish &&
decisionXConditions.isCheBullish &&
decisionXConditions.isSMHKBullish &&
decisionXConditions.isRawHKBullish &&
decisionXConditions.isRawHKClosedOverSMHK
//
;
//
bool isCommonBearish =
//
decisionXConditions.isSarBearish &&
decisionXConditions.isStrBearish &&
decisionXConditions.isCheBearish &&
decisionXConditions.isSMHKBearish &&
decisionXConditions.isRawHKBearish &&
decisionXConditions.isRawHKClosedUnderSMHK
//
;
//
// X3Ma ...
//
// X3Ma Bullish ...
bool isX3MaBullish =
//
decisionXConditions.isX3MaBullishState &&
decisionXConditions.isX3MaSwitchedToBullishOrdered &&
decisionXConditions.x3maMidBuffer[1] > decisionXConditions.x3maSlowBuffer[1]
//
;
//
// X3Ma Bearish ...
bool isX3MaBearish =
//
decisionXConditions.isX3MaBearishState &&
decisionXConditions.isX3MaSwitchedToBearishOrdered &&
decisionXConditions.x3maMidBuffer[1] < decisionXConditions.x3maSlowBuffer[1]
//
;
//
bool isX3MaHasCondition =
(isX3MaBullish &&
isCommonBullish &&
isBullishScorePassed) ||
(isX3MaBearish &&
isCommonBearish &&
isBearishScorePassed);
//
// VWap ...
//
// VWap Bullish ...
bool isVWapBullish =
//
decisionXConditions.isVWapBullishState &&
decisionXConditions.isVWapSwitchedToBullishOrdered &&
decisionXConditions.vwapMidBuffer[1] > decisionXConditions.vwapSlowBuffer[1]
//
;
//
// VWap Bearish ...
bool isVWapBearish =
//
decisionXConditions.isVWapBearishState &&
decisionXConditions.isVWapSwitchedToBearishOrdered &&
decisionXConditions.vwapMidBuffer[1] < decisionXConditions.vwapSlowBuffer[1]
//
;
//
bool isVWapHasCondition =
(isVWapBullish &&
isBullishScorePassed) ||
(isVWapBearish &&
isBearishScorePassed);
//
// Senario ....
// - a vale Under X3MA Slow when X3MA Bullish Ordered ...
//
bool isX3MASenarioBBullish =
//
decisionXConditions.isX3MaBullishOrdered &&
decisionXConditions.valesBuffer[1] < decisionXConditions.x3maSlowBuffer[1] &&
decisionXConditions.valesBuffer[2] >= decisionXConditions.x3maSlowBuffer[2]
//
;
if (isX3MASenarioBBullish)
{
}
//
bool isX3MASenarioBBearish =
//
decisionXConditions.isX3MaBearishOrdered &&
decisionXConditions.peaksBuffer[1] > decisionXConditions.x3maSlowBuffer[1] &&
decisionXConditions.peaksBuffer[2] <= decisionXConditions.x3maSlowBuffer[2]
//
;
if (isX3MASenarioBBearish)
{
}
//
// Checking Other Conditions XWZ Reject on EMA 20 ...
//
// Check Has Conditions ...
bool hasXConditions =
(isX3MaHasCondition ||
isVWapHasCondition);
//
result = hasXConditions;
if (!result)
{
return result;
}
//
if (isX3MaHasCondition)
{
//
signalDir =
isX3MaBullish
? X_DIRECTION_BULLISH
: isX3MaBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
if (isVWapHasCondition)
{
//
signalDir =
isVWapBullish
? X_DIRECTION_BULLISH
: isVWapBearish
? X_DIRECTION_BEARISH
: X_DIRECTION_NONE;
}
//
// Creating SignalBox ...
//
// Detect Box based on PV ...
bool hasSignalBox = decisionCycleHelper.GeneratePVBox(
signalBox,
barIndex //
);
//
result =
hasSignalBox &&
signalDir == signalBox.dir;
//
if (result)
{
//
XCBoxObject *iObj;
bool isCreated= drawer.DrawBox(
signalBox,
iObj //
);
if (isCreated)
{
//
iObj.BoxWidth(1);
iObj.BoxColor(clrYellow);
iObj.BoxStyle(STYLE_SOLID);
}
//
Print("Senario A ...");
}
//
return result;
}
//
bool DetetctSenarioBSignalBox(
XBoxZone &signalBox,
ENUM_X_DIRECTION &signalDir,
X121Conditions &decisionXConditions,
X121Conditions &analyseXConditions,
XC121SMCCycleHelper *decisionCycleHelper,
int barIndex = 0 //
)
{
//
bool result = false;
//
signalBox.Clean();
signalDir = X_DIRECTION_NONE;
//
if (barIndex < 0)
{
barIndex = 0;
}
//
result = decisionCycleHelper != NULL;
if (!result)
{
return result;
}
//
// Decision ...
double decisionBullishScore = 0;
double decisionBearishScore = 0;
decisionXConditions.GenerateScore(
decisionBullishScore,
decisionBearishScore //
);
//
// Analyse ...
double analyseBullishScore = 0;
double analyseBearishScore = 0;
analyseXConditions.GenerateScore(
analyseBullishScore,
analyseBearishScore //
);
//
// Score Conditions ...
double scoreMultiplier = 3;
bool isBullishScorePassed =
//
analyseBullishScore > (analyseBearishScore * scoreMultiplier) &&
decisionBullishScore > (decisionBearishScore * scoreMultiplier)
//
;
bool isBearishScorePassed =
//
analyseBearishScore > (analyseBullishScore * scoreMultiplier) &&
decisionBearishScore > (decisionBullishScore * scoreMultiplier)
//
;
//
// Senario ....
// - a vale Under X3MA Slow when X3MA Bullish Ordered ...
//
bool isX3MASenarioBBullish =
//
decisionXConditions.isX3MaBullishOrdered &&
decisionXConditions.valesBuffer[1] < decisionXConditions.x3maSlowBuffer[1] &&
decisionXConditions.valesBuffer[2] >= decisionXConditions.x3maSlowBuffer[2]
//
;
if (isX3MASenarioBBullish)
{
}
//
bool isX3MASenarioBBearish =
//
decisionXConditions.isX3MaBearishOrdered &&
decisionXConditions.peaksBuffer[1] > decisionXConditions.x3maSlowBuffer[1] &&
decisionXConditions.peaksBuffer[2] <= decisionXConditions.x3maSlowBuffer[2]
//
;
if (isX3MASenarioBBearish)
{
}
//
return result;
}
//
bool HasInsideBox(
XBoxZone &box //
)
{
//
bool result = false;
//
int index = -1;
//
result = box.IsValid();
if (!result)
{
return result;
}
//
int count = 0;
bool has = false;
//
has = HasWaitingBoxes();
if (has)
{
//
result = HasInsideBox(
index,
box,
waitingBoxes //
);
}
//
// Supply Zones ...
if (!result)
{
//
has = HasSupplyZones();
if (has)
{
//
XBoxZone tmpBoxes[];
count = ToBox(
supplyZones,
tmpBoxes //
);
//
has = IsValidSize(count);
if (has)
{
//
result = HasInsideBox(
index,
box,
tmpBoxes //
);
}
//
Clean(tmpBoxes);
}
}
//
// Demand Zones ...
if (!result)
{
//
has = HasDemandZones();
if (has)
{
//
XBoxZone tmpBoxes[];
count = ToBox(
demandZones,
tmpBoxes //
);
//
has = IsValidSize(count);
if (has)
{
//
result = HasInsideBox(
index,
box,
tmpBoxes //
);
}
//
Clean(tmpBoxes);
}
}
//
result = IsValidIndex(index);
//
return result;
}
// //
void UpdateTo(datetime value = NULL) void UpdateTo(datetime value = NULL)
{ {
+13 -13
View File
@@ -763,7 +763,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// XTREND ... // XTREND ...
x121Inputs.xtrendInputs.showUpTrend = showAll || false; x121Inputs.xtrendInputs.showUpTrend = showAll || false;
x121Inputs.xtrendInputs.showDownTrend = showAll || false; x121Inputs.xtrendInputs.showDownTrend = showAll || false;
x121Inputs.xtrendInputs.showOnlyTrendStart = showAll || false; x121Inputs.xtrendInputs.showOnlyTrendStart = showAll || true;
// //
// XPV ... // XPV ...
@@ -775,26 +775,26 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// XHK ... // XHK ...
// //
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false; x121Inputs.xhkInputs.drawRawXHKCandles = showAll || true;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false; x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || true;
// //
// XATR ... // XATR ...
x121Inputs.xatrInputs.showATRUpper = showAll || false; x121Inputs.xatrInputs.showATRUpper = showAll || true;
x121Inputs.xatrInputs.showATRLower = showAll || false; x121Inputs.xatrInputs.showATRLower = showAll || true;
// //
// XSTR ... // XSTR ...
x121Inputs.xstrInputs.showStr = showAll || false; x121Inputs.xstrInputs.showStr = showAll || true;
x121Inputs.xstrInputs.showStrUpper = showAll || false; x121Inputs.xstrInputs.showStrUpper = showAll || false;
x121Inputs.xstrInputs.showStrLower = showAll || false; x121Inputs.xstrInputs.showStrLower = showAll || false;
// //
// XCHE ... // XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || false; x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || false; x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || false; x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || false; x121Inputs.xcheInputs.showSE2 = showAll || true;
// //
// XDON ... // XDON ...
@@ -805,9 +805,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
// //
// XVWAP ... // XVWAP ...
x121Inputs.xvwapInputs.showVWapFast = showAll || false; x121Inputs.xvwapInputs.showVWapFast = showAll || true;
x121Inputs.xvwapInputs.showVWapMedium = showAll || false; x121Inputs.xvwapInputs.showVWapMedium = showAll || true;
x121Inputs.xvwapInputs.showVWapSlow = showAll || false; x121Inputs.xvwapInputs.showVWapSlow = showAll || true;
// //
// X3MA ... // X3MA ...