This commit is contained in:
2025-01-15 11:53:34 +03:30
parent 56cd60e31d
commit 341992374c
6 changed files with 737 additions and 145 deletions
+9 -9
View File
@@ -44,15 +44,15 @@ input string eaSymbols = "EURUSDb,GBPUSDb,USDJPYb,USDCHFb"; // Trading Symbols
//
// Signalling ...
input group "Signalling";
input bool eaAllowLong = true; // Allow Long Signals
input bool eaAllowShort = true; // Allow Short Signals
input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals
input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals
input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed Signal Types Per Symbol
input double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal
input int eaDelaysBetweenTwoSignalsInBar = 100; // Delay between two Signals in Bars
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
input bool eaAllowLong = true; // Allow Long Signals
input bool eaAllowShort = true; // Allow Short Signals
input int eaMaxAllowedLongs = 5; // Max Allowed Long Signals
input int eaMaxAllowedShorts = 5; // Max Allowed Short Signals
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 int eaDelaysBetweenTwoSignalsInBar = 0; // Delay between two Signals in Bars
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
//
// Trade ...
+195 -16
View File
@@ -237,10 +237,10 @@ struct X121Conditions
bool isRsiCrossedOverOverSold;
//
bool isCloseOverAtrUpper;
bool isCloseOverAtrLower;
bool isCloseUnderAtrUpper;
bool isCloseUnderAtrLower;
bool isClosedOverAtrUpper;
bool isClosedOverAtrLower;
bool isClosedUnderAtrUpper;
bool isClosedUnderAtrLower;
//
bool isRejectUpAtrUpper;
@@ -349,9 +349,25 @@ struct X121Conditions
//
// Complex Conditions ...
double cheMin;
double cheMax;
double vwapMin;
double vwapMax;
//
bool isBreakedUpPrevCheMin;
bool isBreakedUpPrevCheMax;
bool isBreakedDownPrevCheMin;
bool isBreakedDownPrevCheMax;
bool isBreakedUpPrevCheLE1;
bool isBreakedUpPrevCheLE2;
bool isBreakedUpPrevCheSE1;
bool isBreakedUpPrevCheSE2;
bool isBreakedDownPrevCheLE1;
bool isBreakedDownPrevCheLE2;
bool isBreakedDownPrevCheSE1;
bool isBreakedDownPrevCheSE2;
//
bool isSarIncreased;
bool isSarDecreased;
@@ -473,11 +489,13 @@ struct X121Conditions
bool isStrLowerCrossedUnderDonLowLower;
//
bool isAtrUpperOverPeak;
bool isAtrUpperEqualsToPeak;
bool isAtrUpperCrossedUpPeak;
bool isAtrUpperCrossedDownPeak;
//
bool isAtrLowerUnderVale;
bool isAtrLowerEqualsToVale;
bool isAtrLowerCrossedUpVale;
bool isAtrLowerCrossedDownVale;
@@ -607,6 +625,8 @@ struct X121Conditions
ArraySetAsSeries(donCloseLowerBuffer, true);
//
cheMin = 0;
cheMax = 0;
vwapMin = 0;
vwapMax = 0;
@@ -659,12 +679,12 @@ struct X121Conditions
// ATR ...
//
isCloseOverAtrUpper = false;
isCloseOverAtrLower = false;
isClosedOverAtrUpper = false;
isClosedOverAtrLower = false;
//
isCloseUnderAtrUpper = false;
isCloseUnderAtrLower = false;
isClosedUnderAtrUpper = false;
isClosedUnderAtrLower = false;
//
isRejectUpAtrUpper = false;
@@ -858,6 +878,20 @@ struct X121Conditions
isBreakedUpPrevAtrLower = false;
isBreakedDownPrevAtrLower = false;
//
isBreakedUpPrevCheMin = false;
isBreakedUpPrevCheMax = false;
isBreakedDownPrevCheMin = false;
isBreakedDownPrevCheMax = false;
isBreakedUpPrevCheLE1 = false;
isBreakedUpPrevCheLE2 = false;
isBreakedUpPrevCheSE1 = false;
isBreakedUpPrevCheSE2 = false;
isBreakedDownPrevCheLE1 = false;
isBreakedDownPrevCheLE2 = false;
isBreakedDownPrevCheSE1 = false;
isBreakedDownPrevCheSE2 = false;
//
isSarIncreased = false;
isSarDecreased = false;
@@ -899,11 +933,13 @@ struct X121Conditions
isStrLowerUnderVale = false;
//
isAtrUpperOverPeak = false;
isAtrUpperEqualsToPeak = false;
isAtrUpperCrossedUpPeak = false;
isAtrUpperCrossedDownPeak = false;
//
isAtrLowerUnderVale = false;
isAtrLowerEqualsToVale = false;
isAtrLowerCrossedUpVale = false;
isAtrLowerCrossedDownVale = false;
@@ -1055,10 +1091,10 @@ struct X121Conditions
"-----------------------" + separator +
"ATR ..." + separator +
"-----------------------" + separator +
ToString("isCloseOverAtrUpper", isCloseOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isCloseOverAtrLower", isCloseOverAtrLower, ignoreFalseConditions, separator) +
ToString("isCloseUnderAtrUpper", isCloseUnderAtrUpper, ignoreFalseConditions, separator) +
ToString("isCloseUnderAtrLower", isCloseUnderAtrLower, ignoreFalseConditions, separator) +
ToString("isClosedOverAtrUpper", isClosedOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) +
ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) +
ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) +
ToString("isRejectUpAtrUpper", isRejectUpAtrUpper, ignoreFalseConditions, separator) +
ToString("isRejectDownAtrUpper", isRejectDownAtrUpper, ignoreFalseConditions, separator) +
ToString("isRejectUpAtrLower", isRejectUpAtrLower, ignoreFalseConditions, separator) +
@@ -1165,6 +1201,8 @@ struct X121Conditions
ToString("isVWapMaxBreakedUp", isVWapMaxBreakedUp, ignoreFalseConditions, separator) +
ToString("isStrUpperOverPeak", isStrUpperOverPeak, ignoreFalseConditions, separator) +
ToString("isStrLowerOverVale", isStrLowerOverVale, ignoreFalseConditions, separator) +
ToString("isAtrUpperOverPeak", isAtrUpperOverPeak, ignoreFalseConditions, separator) +
ToString("isAtrLowerUnderVale", isAtrLowerUnderVale, ignoreFalseConditions, separator) +
ToString("isClosedOverVWapMin", isClosedOverVWapMin, ignoreFalseConditions, separator) +
ToString("isClosedOverVWapMax", isClosedOverVWapMax, ignoreFalseConditions, separator) +
ToString("isStrUpperUnderPeak", isStrUpperUnderPeak, ignoreFalseConditions, separator) +
@@ -1178,14 +1216,26 @@ struct X121Conditions
ToString("isBreakedDownPrevStr", isBreakedDownPrevStr, ignoreFalseConditions, separator) +
ToString("isSarCrossedOverVale", isSarCrossedOverVale, ignoreFalseConditions, separator) +
ToString("isStrCrossedOverVale", isStrCrossedOverVale, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheLE1", isBreakedUpPrevCheLE1, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheLE2", isBreakedUpPrevCheLE2, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheSE1", isBreakedUpPrevCheSE1, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheSE2", isBreakedUpPrevCheSE2, ignoreFalseConditions, separator) +
ToString("isSarCrossedUnderPeak", isSarCrossedUnderPeak, ignoreFalseConditions, separator) +
ToString("isStrCrossedUnderPeak", isStrCrossedUnderPeak, ignoreFalseConditions, separator) +
ToString("isNewPeakOverAtrUpper", isNewPeakOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheMin", isBreakedUpPrevCheMin, ignoreFalseConditions, separator) +
ToString("isBreakedUpPrevCheMax", isBreakedUpPrevCheMax, ignoreFalseConditions, separator) +
ToString("isNewValeUnderAtrLower", isNewValeUnderAtrLower, ignoreFalseConditions, separator) +
ToString("isStrUpperOverAtrUpper", isStrUpperOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isStrLowerOverAtrLower", isStrLowerOverAtrLower, ignoreFalseConditions, separator) +
ToString("isAtrUpperEqualsToPeak", isAtrUpperEqualsToPeak, ignoreFalseConditions, separator) +
ToString("isAtrLowerEqualsToVale", isAtrLowerEqualsToVale, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheMin", isBreakedDownPrevCheMin, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheMax", isBreakedDownPrevCheMax, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheLE1", isBreakedDownPrevCheLE1, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheLE2", isBreakedDownPrevCheLE2, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheSE1", isBreakedDownPrevCheSE1, ignoreFalseConditions, separator) +
ToString("isBreakedDownPrevCheSE2", isBreakedDownPrevCheSE2, ignoreFalseConditions, separator) +
ToString("isAtrUpperCrossedUpPeak", isAtrUpperCrossedUpPeak, ignoreFalseConditions, separator) +
ToString("isAtrLowerCrossedUpVale", isAtrLowerCrossedUpVale, ignoreFalseConditions, separator) +
ToString("isStrUpperUnderAtrUpper", isStrUpperUnderAtrUpper, ignoreFalseConditions, separator) +
@@ -1893,14 +1943,14 @@ class XCX121Helper : public XCBase
conditions.isRsiOverBought = xatrConditions.isRsiOverBought;
conditions.isBreakUpAtrUpper = xatrConditions.isBreakUpAtrUpper;
conditions.isBreakUpAtrLower = xatrConditions.isBreakUpAtrLower;
conditions.isCloseOverAtrUpper = xatrConditions.isCloseOverAtrUpper;
conditions.isClosedOverAtrUpper = xatrConditions.isClosedOverAtrUpper;
conditions.isRejectUpAtrUpper = xatrConditions.isRejectUpAtrUpper;
conditions.isRejectUpAtrLower = xatrConditions.isRejectUpAtrLower;
conditions.isCloseOverAtrLower = xatrConditions.isCloseOverAtrLower;
conditions.isClosedOverAtrLower = xatrConditions.isClosedOverAtrLower;
conditions.isBreakDownAtrUpper = xatrConditions.isBreakDownAtrUpper;
conditions.isBreakDownAtrLower = xatrConditions.isBreakDownAtrLower;
conditions.isCloseUnderAtrUpper = xatrConditions.isCloseUnderAtrUpper;
conditions.isCloseUnderAtrLower = xatrConditions.isCloseUnderAtrLower;
conditions.isClosedUnderAtrUpper = xatrConditions.isClosedUnderAtrUpper;
conditions.isClosedUnderAtrLower = xatrConditions.isClosedUnderAtrLower;
conditions.isRejectDownAtrUpper = xatrConditions.isRejectDownAtrUpper;
conditions.isRejectDownAtrLower = xatrConditions.isRejectDownAtrLower;
conditions.isRsiCrossedOverOverSold = xatrConditions.isRsiCrossedOverOverSold;
@@ -2325,9 +2375,52 @@ class XCX121Helper : public XCBase
//
double prevSar = conditions.sarBuffer[pIDX];
double prevStr = conditions.strBuffer[pIDX];
double prevCheLE1 = conditions.le1Buffer[pIDX];
double prevCheLE2 = conditions.le2Buffer[pIDX];
double prevCheSE1 = conditions.se1Buffer[pIDX];
double prevCheSE2 = conditions.se2Buffer[pIDX];
double prevAtrUpper = conditions.atrUpperBuffer[pIDX];
double prevAtrLower = conditions.atrLowerBuffer[pIDX];
//
double ches[];
if (prevCheLE1 != EMPTY_VALUE)
{
//
Add(
prevCheLE1,
ches //
);
}
if (prevCheLE2 != EMPTY_VALUE)
{
//
Add(
prevCheLE2,
ches //
);
}
if (prevCheSE1 != EMPTY_VALUE)
{
//
Add(
prevCheSE1,
ches //
);
}
if (prevCheSE2 != EMPTY_VALUE)
{
//
Add(
prevCheSE2,
ches //
);
}
//
double cheMin = GetMin(ches);
double cheMax = GetMax(ches);
//
bool isBreakedUpPrevSar = IsBarBreak(
prevSar,
@@ -2376,6 +2469,74 @@ class XCX121Helper : public XCBase
cBar //
);
//
bool isBreakedUpPrevCheLE1 = IsBarBreak(
prevCheLE1,
X_DIRECTION_BULLISH,
cBar //
);
bool isBreakedUpPrevCheLE2 = IsBarBreak(
prevCheLE2,
X_DIRECTION_BULLISH,
cBar //
);
bool isBreakedUpPrevCheSE1 = IsBarBreak(
prevCheSE1,
X_DIRECTION_BULLISH,
cBar //
);
bool isBreakedUpPrevCheSE2 = IsBarBreak(
prevCheSE2,
X_DIRECTION_BULLISH,
cBar //
);
//
bool isBreakedDownPrevCheLE1 = IsBarBreak(
prevCheLE1,
X_DIRECTION_BEARISH,
cBar //
);
bool isBreakedDownPrevCheLE2 = IsBarBreak(
prevCheLE2,
X_DIRECTION_BEARISH,
cBar //
);
bool isBreakedDownPrevCheSE1 = IsBarBreak(
prevCheSE1,
X_DIRECTION_BEARISH,
cBar //
);
bool isBreakedDownPrevCheSE2 = IsBarBreak(
prevCheSE2,
X_DIRECTION_BEARISH,
cBar //
);
//
bool isBreakedUpPrevCheMin = IsBarBreak(
cheMin,
X_DIRECTION_BULLISH,
cBar //
);
bool isBreakedDownPrevCheMin = IsBarBreak(
cheMin,
X_DIRECTION_BEARISH,
cBar //
);
//
bool isBreakedUpPrevCheMax = IsBarBreak(
cheMax,
X_DIRECTION_BULLISH,
cBar //
);
bool isBreakedDownPrevCheMax = IsBarBreak(
cheMax,
X_DIRECTION_BEARISH,
cBar //
);
//
bool isSarCrossedUnderPeak =
conditions.sarBuffer[cIDX] < conditions.peaksBuffer[cIDX] &&
@@ -2519,6 +2680,7 @@ class XCX121Helper : public XCBase
!isStrLowerUnderDonLowLowerPrev;
//
bool isAtrUpperOverPeak = conditions.atrUpperBuffer[cIDX] > conditions.peaksBuffer[cIDX];
bool isAtrUpperEqualsToPeak = conditions.atrUpperBuffer[cIDX] == conditions.peaksBuffer[cIDX];
//
@@ -2528,6 +2690,7 @@ class XCX121Helper : public XCBase
!(conditions.atrUpperBuffer[cIDX] < conditions.peaksBuffer[cIDX]);
//
bool isAtrLowerUnderVale = conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX];
bool isAtrLowerEqualsToVale = conditions.atrUpperBuffer[cIDX] == conditions.valesBuffer[cIDX];
//
@@ -2537,6 +2700,8 @@ class XCX121Helper : public XCBase
!(conditions.atrUpperBuffer[cIDX] < conditions.valesBuffer[cIDX]);
//
conditions.cheMin = cheMin;
conditions.cheMax = cheMax;
conditions.vwapMin = vwapMin;
conditions.vwapMax = vwapMax;
@@ -2554,6 +2719,8 @@ class XCX121Helper : public XCBase
conditions.isVWapMaxBreakedUp = isVWapMaxBreakedUp;
conditions.isBreakedUpPrevSar = isBreakedUpPrevSar;
conditions.isBreakedUpPrevStr = isBreakedUpPrevStr;
conditions.isAtrUpperOverPeak = isAtrUpperOverPeak;
conditions.isAtrLowerUnderVale = isAtrLowerUnderVale;
conditions.isStrLowerUnderVale = isStrLowerUnderVale;
conditions.isStrUpperUnderPeak = isStrUpperUnderPeak;
conditions.isValeUnderAtrLower = isValeUnderAtrLower;
@@ -2570,11 +2737,23 @@ class XCX121Helper : public XCBase
conditions.isSarCrossedUnderPeak = isSarCrossedUnderPeak;
conditions.isStrCrossedUnderPeak = isStrCrossedUnderPeak;
conditions.isNewPeakOverAtrUpper = isNewPeakOverAtrUpper;
conditions.isBreakedUpPrevCheLE1 = isBreakedUpPrevCheLE1;
conditions.isBreakedUpPrevCheLE2 = isBreakedUpPrevCheLE2;
conditions.isBreakedUpPrevCheSE1 = isBreakedUpPrevCheSE1;
conditions.isBreakedUpPrevCheSE2 = isBreakedUpPrevCheSE2;
conditions.isBreakedUpPrevCheMin = isBreakedUpPrevCheMin;
conditions.isBreakedUpPrevCheMax = isBreakedUpPrevCheMax;
conditions.isAtrUpperEqualsToPeak = isAtrUpperEqualsToPeak;
conditions.isAtrLowerEqualsToVale = isAtrLowerEqualsToVale;
conditions.isNewValeUnderAtrLower = isNewValeUnderAtrLower;
conditions.isStrUpperOverAtrUpper = isStrUpperOverAtrUpper;
conditions.isStrLowerOverAtrLower = isStrLowerOverAtrLower;
conditions.isBreakedDownPrevCheMin = isBreakedDownPrevCheMin;
conditions.isBreakedDownPrevCheMax = isBreakedDownPrevCheMax;
conditions.isBreakedDownPrevCheLE1 = isBreakedDownPrevCheLE1;
conditions.isBreakedDownPrevCheLE2 = isBreakedDownPrevCheLE2;
conditions.isBreakedDownPrevCheSE1 = isBreakedDownPrevCheSE1;
conditions.isBreakedDownPrevCheSE2 = isBreakedDownPrevCheSE2;
conditions.isStrUpperUnderAtrUpper = isStrUpperUnderAtrUpper;
conditions.isStrLowerUnderAtrLower = isStrLowerUnderAtrLower;
conditions.isBreakedUpPrevAtrUpper = isBreakedUpPrevAtrUpper;
+20 -20
View File
@@ -210,12 +210,12 @@ struct X121XATRConditions
// ATR ...
//
bool isCloseOverAtrUpper;
bool isCloseOverAtrLower;
bool isClosedOverAtrUpper;
bool isClosedOverAtrLower;
//
bool isCloseUnderAtrUpper;
bool isCloseUnderAtrLower;
bool isClosedUnderAtrUpper;
bool isClosedUnderAtrLower;
//
bool isRejectUpAtrUpper;
@@ -296,12 +296,12 @@ struct X121XATRConditions
// ATR ...
//
isCloseOverAtrUpper = false;
isCloseOverAtrLower = false;
isClosedOverAtrUpper = false;
isClosedOverAtrLower = false;
//
isCloseUnderAtrUpper = false;
isCloseUnderAtrLower = false;
isClosedUnderAtrUpper = false;
isClosedUnderAtrLower = false;
//
isRejectUpAtrUpper = false;
@@ -402,10 +402,10 @@ struct X121XATRConditions
ToString("isRsiCrossedOverOverSold", isRsiCrossedOverOverSold, ignoreFalseConditions, separator) +
//
// ATR ...
ToString("isCloseOverAtrUpper", isCloseOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isCloseOverAtrLower", isCloseOverAtrLower, ignoreFalseConditions, separator) +
ToString("isCloseUnderAtrUpper", isCloseUnderAtrUpper, ignoreFalseConditions, separator) +
ToString("isCloseUnderAtrLower", isCloseUnderAtrLower, ignoreFalseConditions, separator) +
ToString("isClosedOverAtrUpper", isClosedOverAtrUpper, ignoreFalseConditions, separator) +
ToString("isClosedOverAtrLower", isClosedOverAtrLower, ignoreFalseConditions, separator) +
ToString("isClosedUnderAtrUpper", isClosedUnderAtrUpper, ignoreFalseConditions, separator) +
ToString("isClosedUnderAtrLower", isClosedUnderAtrLower, ignoreFalseConditions, separator) +
ToString("isRejectUpAtrUpper", isRejectUpAtrUpper, ignoreFalseConditions, separator) +
ToString("isRejectDownAtrUpper", isRejectDownAtrUpper, ignoreFalseConditions, separator) +
ToString("isRejectUpAtrLower", isRejectUpAtrLower, ignoreFalseConditions, separator) +
@@ -1022,12 +1022,12 @@ class XCX121XATRHelper : public XCBaseHelper
// ATR ...
//
bool isCloseOverAtrUpper = cBar.close > conditions.atrUpperBuffer[cIDX];
bool isCloseOverAtrLower = cBar.close > conditions.atrLowerBuffer[cIDX];
bool isClosedOverAtrUpper = cBar.close > conditions.atrUpperBuffer[cIDX];
bool isClosedOverAtrLower = cBar.close > conditions.atrLowerBuffer[cIDX];
//
bool isCloseUnderAtrUpper = cBar.close < conditions.atrUpperBuffer[cIDX];
bool isCloseUnderAtrLower = cBar.close < conditions.atrLowerBuffer[cIDX];
bool isClosedUnderAtrUpper = cBar.close < conditions.atrUpperBuffer[cIDX];
bool isClosedUnderAtrLower = cBar.close < conditions.atrLowerBuffer[cIDX];
//
bool isRejectUpAtrUpper = IsBarReject(
@@ -1088,12 +1088,12 @@ class XCX121XATRHelper : public XCBaseHelper
conditions.isBreakUpAtrLower = isBreakUpAtrLower;
conditions.isRejectDownAtrUpper = isRejectDownAtrUpper;
conditions.isRejectDownAtrLower = isRejectDownAtrLower;
conditions.isCloseOverAtrUpper = isCloseOverAtrUpper;
conditions.isCloseOverAtrLower = isCloseOverAtrLower;
conditions.isClosedOverAtrUpper = isClosedOverAtrUpper;
conditions.isClosedOverAtrLower = isClosedOverAtrLower;
conditions.isBreakDownAtrUpper = isBreakDownAtrUpper;
conditions.isBreakDownAtrLower = isBreakDownAtrLower;
conditions.isCloseUnderAtrUpper = isCloseUnderAtrUpper;
conditions.isCloseUnderAtrLower = isCloseUnderAtrLower;
conditions.isClosedUnderAtrUpper = isClosedUnderAtrUpper;
conditions.isClosedUnderAtrLower = isClosedUnderAtrLower;
conditions.isRsiCrossedOverOverSold = isRsiCrossedOverOverSold;
conditions.isRsiCrossedUnderOverSold = isRsiCrossedUnderOverSold;
conditions.isRsiCrossedOverOverBought = isRsiCrossedOverOverBought;
@@ -3272,18 +3272,6 @@ class XC121SMCTradeHandler : public XCBaseAlert
//
XCSignalObject *iObj;
mDrawer.DrawSignal(signal, iObj);
//
XCBaseObject *conditionsObjects[];
DrawX121SMCStrategyConditions(
conditions,
conditionsObjects,
mDrawer,
false,
true, // Analyse Price Zones ...
false, // Decision Zone ...
true // Only Box ...
);
}
//
+500 -83
View File
@@ -52,6 +52,11 @@ struct X121SMCStrategyXSTRPVSignalConditions
double pivot;
double point;
//
XPriceZones priceZone;
bool isPriceZoneValidForPeak;
bool isPriceZoneValidForVale;
//
// Constructor ...
X121SMCStrategyXSTRPVSignalConditions()
@@ -169,6 +174,11 @@ struct X121SMCStrategyXSTRPVSignalConditions
//
pivot = 0;
point = 0;
//
priceZone.Clean();
isPriceZoneValidForPeak = false;
isPriceZoneValidForVale = false;
}
//
@@ -402,18 +412,68 @@ bool DetectX121SMCXSTRPVSiganlSetup(
// Detect Trend ...
//
ENUM_X_DIRECTION marketDir;
bool hasMarketDir = decisionCycleHelper.DetectMarketStructure(marketDir);
// Consolidation ...
ENUM_X_DIRECTION consolidationMarketDir;
bool hasConsolidationMarketDir = consolidationCycleHelper
.DetectMarketStructure(consolidationMarketDir);
//
bool hasBullishTrend =
hasMarketDir &&
IsBullish(marketDir);
bool hasConsolidationBullishTrend =
hasConsolidationMarketDir &&
IsBullish(consolidationMarketDir);
//
bool hasBearishTrend =
hasMarketDir &&
IsBearish(marketDir);
bool hasConsolidationBearishTrend =
hasConsolidationMarketDir &&
IsBearish(consolidationMarketDir);
//
// Verification ...
ENUM_X_DIRECTION verificationMarketDir;
bool hasVerificationMarketDir = verificationCycleHelper
.DetectMarketStructure(verificationMarketDir);
//
bool hasVerificationBullishTrend =
hasVerificationMarketDir &&
IsBullish(verificationMarketDir);
//
bool hasVerificationBearishTrend =
hasVerificationMarketDir &&
IsBearish(verificationMarketDir);
//
// Analyse ...
ENUM_X_DIRECTION analyseMarketDir;
bool hasAnalyseMarketDir = analyseCycleHelper
.DetectMarketStructure(analyseMarketDir);
//
bool hasAnalyseBullishTrend =
hasAnalyseMarketDir &&
IsBullish(analyseMarketDir);
//
bool hasAnalyseBearishTrend =
hasAnalyseMarketDir &&
IsBearish(analyseMarketDir);
//
// Decision ...
ENUM_X_DIRECTION decisionMarketDir;
bool hasDecisionMarketDir = decisionCycleHelper
.DetectMarketStructure(decisionMarketDir);
//
bool hasDecisionBullishTrend =
hasDecisionMarketDir &&
IsBullish(decisionMarketDir);
//
bool hasDecisionBearishTrend =
hasDecisionMarketDir &&
IsBearish(decisionMarketDir);
//
// Detect Bar State ...
@@ -515,40 +575,75 @@ bool DetectX121SMCXSTRPVSiganlSetup(
// Detect Price Zone ...
//
double pzPeak = decisionConditions.x121Conditions.peaksBuffer[1];
double pzVale = decisionConditions.x121Conditions.valesBuffer[1];
double pzPeak = decisionXConditions.peaksBuffer[1];
double pzVale = decisionXConditions.valesBuffer[1];
//
XPriceZones priceZones;
bool hasPriceZones = CalculatePriceInsideZones(
priceZones,
// Detecting Analyse Price ones ...
XPriceZones analysePriceZone;
bool hasAnalysePriceZone = CalculatePriceInsideZones(
analysePriceZone,
analyseState,
cBar //
);
double priceZonesUpper = 0;
double priceZonesLower = 0;
bool isPriceZoneValidForPeak = false;
bool isPriceZoneValidForVale = false;
if (hasPriceZones)
double analysePriceZoneUpper = 0;
double analysePriceZoneLower = 0;
bool isAnalysePriceZoneValidForPeak = false;
bool isAnalysePriceZoneValidForVale = false;
if (hasAnalysePriceZone)
{
//
bool hasBoundary = priceZones.GetBoundary(
bool hasBoundary = analysePriceZone.GetBoundary(
X_DIRECTION_ALL,
priceZonesUpper,
priceZonesLower //
analysePriceZoneUpper,
analysePriceZoneLower //
);
//
isPriceZoneValidForPeak =
isAnalysePriceZoneValidForPeak =
hasBoundary &&
pzPeak <= priceZonesUpper &&
pzPeak >= priceZonesLower;
pzPeak <= analysePriceZoneUpper &&
pzPeak >= analysePriceZoneLower;
//
isPriceZoneValidForVale =
isAnalysePriceZoneValidForVale =
hasBoundary &&
pzVale <= priceZonesUpper &&
pzVale >= priceZonesLower;
pzVale <= analysePriceZoneUpper &&
pzVale >= analysePriceZoneLower;
}
//
// Detecting Verification Price ones ...
XPriceZones verificationPriceZone;
bool hasVerificationPriceZone = CalculatePriceInsideZones(
verificationPriceZone,
verificationState,
cBar //
);
double verificationPriceZoneUpper = 0;
double verificationPriceZoneLower = 0;
bool isVerificationPriceZoneValidForPeak = false;
bool isVerificationPriceZoneValidForVale = false;
if (hasVerificationPriceZone)
{
//
bool hasBoundary = verificationPriceZone.GetBoundary(
X_DIRECTION_ALL,
verificationPriceZoneUpper,
verificationPriceZoneLower //
);
//
isVerificationPriceZoneValidForPeak =
hasBoundary &&
pzPeak <= verificationPriceZoneUpper &&
pzPeak >= verificationPriceZoneLower;
//
isVerificationPriceZoneValidForVale =
hasBoundary &&
pzVale <= verificationPriceZoneUpper &&
pzVale >= verificationPriceZoneLower;
}
//
@@ -559,75 +654,363 @@ bool DetectX121SMCXSTRPVSiganlSetup(
// Summarize Conditions ...
//
isBullish =
// Decision Conditions ...
//
bool isDecisionBullish =
//
// Other Time Frames ...
//
// Consolidation ...
(consolidationXConditions.isCheBullish &&
consolidationXConditions.isStrBullish &&
consolidationXConditions.isSarBullish &&
consolidationXConditions.isClosedOverVWapMax) &&
//
// Analyse ...
(analyseXConditions.isCheBullish &&
analyseXConditions.isStrBullish &&
analyseXConditions.isSarBullish &&
analyseXConditions.isClosedOverVWapMax) &&
hasAnalysePriceZone &&
analysePriceZone.IsBullish() &&
isAnalysePriceZoneValidForVale &&
//
// Decision ...
hasBullishTrend &&
hasVerificationBullishTrend &&
hasAnalyseBullishTrend &&
hasDecisionBullishTrend &&
decisionXConditions.isBreakedDownPrevAtrUpper &&
(
//
((decisionXConditions.isStrSwitchedToBullish &&
((decisionXConditions.isSarBullish &&
decisionXConditions.isCheBullish &&
decisionXConditions.isSarBullish) ||
(decisionXConditions.isCheSwitchedToBullish &&
decisionXConditions.isBreakedUpPrevStr &&
decisionXConditions.isStrSwitchedToBullish) ||
(decisionXConditions.isStrBullish &&
decisionXConditions.isSarBullish &&
decisionXConditions.isStrBullish) ||
(decisionXConditions.isSarSwitchedToBullish &&
decisionXConditions.isBreakedUpPrevCheMax &&
decisionXConditions.isCheSwitchedToBullish) ||
(decisionXConditions.isStrBullish &&
decisionXConditions.isCheBullish &&
decisionXConditions.isStrBullish))
decisionXConditions.isBreakedUpPrevSar &&
decisionXConditions.isSarSwitchedToBullish))
//
)
//
;
//
isBearish =
bool isDecisionBearish =
//
// Other Time Frames ...
//
// Consolidation ...
(consolidationXConditions.isCheBearish &&
consolidationXConditions.isStrBearish &&
consolidationXConditions.isSarBearish &&
consolidationXConditions.isClosedUnderVWapMax) &&
//
// Analyse ...
(analyseXConditions.isCheBearish &&
analyseXConditions.isStrBearish &&
analyseXConditions.isSarBearish &&
analyseXConditions.isClosedUnderVWapMax) &&
hasAnalysePriceZone &&
analysePriceZone.IsBearish() &&
isAnalysePriceZoneValidForPeak &&
//
// Decision ...
hasBearishTrend &&
hasVerificationBearishTrend &&
hasAnalyseBearishTrend &&
hasDecisionBearishTrend &&
decisionXConditions.isBreakedDownPrevAtrLower &&
(
//
((decisionXConditions.isStrSwitchedToBearish &&
((decisionXConditions.isSarBearish &&
decisionXConditions.isCheBearish &&
decisionXConditions.isSarBearish) ||
(decisionXConditions.isCheSwitchedToBearish &&
decisionXConditions.isBreakedDownPrevStr &&
decisionXConditions.isStrSwitchedToBearish) ||
(decisionXConditions.isStrBearish &&
decisionXConditions.isSarBearish &&
decisionXConditions.isStrBearish) ||
(decisionXConditions.isSarSwitchedToBearish &&
decisionXConditions.isCheSwitchedToBearish &&
decisionXConditions.isBreakedDownPrevCheMin) ||
(decisionXConditions.isStrBearish &&
decisionXConditions.isCheBearish &&
decisionXConditions.isStrBearish))
decisionXConditions.isBreakedDownPrevSar &&
decisionXConditions.isSarSwitchedToBearish))
//
)
//
;
//
bool hasDecisionCondition = isDecisionBullish ||
isDecisionBearish;
if (hasDecisionCondition)
{
//
conditions.priceZone = analysePriceZone;
conditions.isPriceZoneValidForPeak = isAnalysePriceZoneValidForPeak;
conditions.isPriceZoneValidForVale = isAnalysePriceZoneValidForVale;
//
pzPeak = analysePriceZoneUpper;
pzVale = analysePriceZoneLower;
//
double point = GetEntry(
conditions.symbol,
conditions.dir //
);
//
// Manipulate Conditions Point ...
//
point =
isDecisionBullish ? pzPeak
: pzVale;
conditions.point = point;
//
// Manipulate Conditions Pivot ...
//
conditions.pivot =
isDecisionBullish
? pzVale
: pzPeak;
}
//
// Analyse Conditions ...
//
bool isAnalyseBullish =
//
!hasDecisionCondition &&
//
hasVerificationPriceZone &&
verificationPriceZone.IsBullish() &&
isVerificationPriceZoneValidForVale &&
//
hasConsolidationBullishTrend &&
hasVerificationBullishTrend &&
hasAnalyseBullishTrend &&
analyseXConditions.isBreakedDownPrevAtrUpper &&
//
(
//
((analyseXConditions.isSarBullish &&
analyseXConditions.isCheBullish &&
analyseXConditions.isBreakedUpPrevStr &&
analyseXConditions.isStrSwitchedToBullish) ||
(analyseXConditions.isStrBullish &&
analyseXConditions.isSarBullish &&
analyseXConditions.isBreakedUpPrevCheMax &&
analyseXConditions.isCheSwitchedToBullish) ||
(analyseXConditions.isStrBullish &&
analyseXConditions.isCheBullish &&
analyseXConditions.isBreakedUpPrevSar &&
analyseXConditions.isSarSwitchedToBullish))
//
)
//
;
//
bool isAnalyseBearish =
//
!hasDecisionCondition &&
//
hasVerificationPriceZone &&
verificationPriceZone.IsBearish() &&
isVerificationPriceZoneValidForPeak &&
//
hasConsolidationBearishTrend &&
hasVerificationBearishTrend &&
hasAnalyseBearishTrend &&
analyseXConditions.isBreakedDownPrevAtrLower &&
//
(
//
((analyseXConditions.isSarBearish &&
analyseXConditions.isCheBearish &&
analyseXConditions.isBreakedDownPrevStr &&
analyseXConditions.isStrSwitchedToBearish) ||
(analyseXConditions.isStrBearish &&
analyseXConditions.isSarBearish &&
analyseXConditions.isCheSwitchedToBearish &&
analyseXConditions.isBreakedDownPrevCheMin) ||
(analyseXConditions.isStrBearish &&
analyseXConditions.isCheBearish &&
analyseXConditions.isBreakedDownPrevSar &&
analyseXConditions.isSarSwitchedToBearish))
//
)
//
;
//
bool hasAnalyseCondition = isAnalyseBullish ||
isAnalyseBearish;
if (hasAnalyseCondition)
{
//
conditions.priceZone = analysePriceZone;
conditions.isPriceZoneValidForPeak = isVerificationPriceZoneValidForPeak;
conditions.isPriceZoneValidForVale = isVerificationPriceZoneValidForVale;
//
pzPeak = analysePriceZoneUpper;
pzVale = analysePriceZoneLower;
//
double point = GetEntry(
conditions.symbol,
conditions.dir //
);
//
// Manipulate Conditions Point ...
//
point =
isAnalyseBullish ? pzPeak
: pzVale;
conditions.point = point;
//
// Manipulate Conditions Pivot ...
//
conditions.pivot =
isAnalyseBullish
? pzVale
: pzPeak;
}
//
//
//
//
double decisionPVMiddle = decisionXConditions.valesBuffer[1] +
(decisionXConditions.peaksBuffer[1] - decisionXConditions.valesBuffer[1]) / 2;
bool isInDecisionPremium =
//
ask > decisionPVMiddle &&
bid > decisionPVMiddle &&
//
ask < decisionXConditions.peaksBuffer[1] &&
bid < decisionXConditions.peaksBuffer[1]
//
;
bool isInDecisionDiscount =
//
ask < decisionPVMiddle &&
bid < decisionPVMiddle &&
//
ask < decisionXConditions.valesBuffer[1] &&
bid < decisionXConditions.valesBuffer[1]
//
;
//
bool isPriceZoneBullish =
//
!hasDecisionCondition &&
!hasAnalyseCondition &&
//
hasVerificationBullishTrend &&
hasAnalyseBullishTrend &&
hasDecisionBullishTrend &&
//
hasAnalysePriceZone &&
analysePriceZone.IsBullish() &&
isAnalysePriceZoneValidForVale &&
//
isCBarBullishFormed &&
isInDecisionDiscount &&
decisionXConditions.isAtrLowerUnderVale &&
decisionXConditions.isAtrLowerSlopeBullish &&
true
//
;
//
bool isPriceZoneBearish =
//
!hasDecisionCondition &&
!hasAnalyseCondition &&
//
hasVerificationBearishTrend &&
hasAnalyseBearishTrend &&
hasDecisionBearishTrend &&
//
hasAnalysePriceZone &&
analysePriceZone.IsBearish() &&
isAnalysePriceZoneValidForPeak &&
//
isInDecisionPremium &&
isCBarBearishFormed &&
decisionXConditions.isAtrUpperOverPeak &&
decisionXConditions.isAtrUpperSlopeBearish &&
true
//
;
//
bool hasPriceZoneCondition = isPriceZoneBullish ||
isPriceZoneBearish;
if (hasPriceZoneCondition)
{
//
ENUM_X_DIRECTION pzDir =
isPriceZoneBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
// XCBaseObject *drawnObjects[];
// int drawnObjectsCount = triggerCycleHelper
// .mPOIDetector
// .mDrawer
// .DrawPriceZone(
// analysePriceZone,
// drawnObjects,
// pzDir //
// );
// if (IsValidSize(drawnObjectsCount))
// {
// Print("DIR: " + EnumToString(pzDir));
// }
//
conditions.priceZone = analysePriceZone;
conditions.isPriceZoneValidForPeak = isAnalysePriceZoneValidForPeak;
conditions.isPriceZoneValidForVale = isAnalysePriceZoneValidForVale;
//
pzPeak = analysePriceZoneUpper;
pzVale = analysePriceZoneLower;
//
double point = GetEntry(
conditions.symbol,
conditions.dir //
);
//
// Manipulate Conditions Point ...
//
// point =
// isPriceZoneBullish ? pzPeak
// : pzVale;
conditions.point = point;
//
// Manipulate Conditions Pivot ...
//
conditions.pivot =
isPriceZoneBullish
? pzVale
: pzPeak;
}
//
//
//
//
isBullish =
isAnalyseBullish ||
isDecisionBullish ||
isPriceZoneBullish;
//
isBearish =
isAnalyseBearish ||
isDecisionBearish ||
isPriceZoneBearish;
//
result = isBullish ||
isBearish;
@@ -637,23 +1020,12 @@ bool DetectX121SMCXSTRPVSiganlSetup(
}
//
conditions.pivot =
isBullish
? pzVale
: pzPeak;
conditions.setupTime = cTime;
conditions.dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
double point = GetEntry(
conditions.symbol,
conditions.dir //
);
conditions.point = point;
//
return result;
}
@@ -970,7 +1342,7 @@ bool DetectX121SMCXSTRPVSiganlTrigger(
//
double point = conditions.point;
bool isPointBreak = IsBarBreak(
bool isPointBreaked = IsBarBreak(
point,
setupDir,
cBar //
@@ -983,7 +1355,7 @@ bool DetectX121SMCXSTRPVSiganlTrigger(
isBullish =
//
isBullish &&
isPointBreak &&
isPointBreaked &&
isSlopesBullish &&
cBar.IsBullish()
//
@@ -993,7 +1365,7 @@ bool DetectX121SMCXSTRPVSiganlTrigger(
isBearish =
//
isBearish &&
isPointBreak &&
isPointBreaked &&
isSlopesBearish &&
cBar.IsBearish()
//
@@ -1392,3 +1764,48 @@ int AddX121SMCXSTRPVConditionsIfNotExists(
}
//
int DrawX121SMCXSTRPVConditions(
X121SMCStrategyXSTRPVSignalConditions &conditions,
XCBaseObject *&drawnObjects[],
XCPOIDrawer *drawer //
)
{
//
int result = 0;
//
Clean(drawnObjects);
//
if (drawer == NULL)
{
return result;
}
//
bool isSetuped = conditions.IsSetuped();
if (!isSetuped)
{
return result;
}
//
bool hasPriceZone = conditions.priceZone.IsValid();
if (!hasPriceZone)
{
return result;
}
//
int zonesObjCount = drawer.DrawPriceZone(
conditions.priceZone,
drawnObjects,
conditions.dir //
);
result = zonesObjCount;
//
return result;
}
//
@@ -1184,6 +1184,14 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
1 //
);
//
XCBaseObject *objects[];
DrawX121SMCXSTRPVConditions(
mConditions,
objects,
mPOIDrawer //
);
//
// Check Signal Direction ...
isBullish = IsBullish(mConditions.dir);
@@ -1261,7 +1269,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
bool showAll = false;
//
x121Inputs.showRSI = true;
x121Inputs.showRSI = false;
//
bool isInited = false;
@@ -1297,10 +1305,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
//
// XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || true;
x121Inputs.xcheInputs.showLE2 = showAll || true;
x121Inputs.xcheInputs.showSE1 = showAll || true;
x121Inputs.xcheInputs.showSE2 = showAll || true;
x121Inputs.xcheInputs.showLE1 = showAll || false;
x121Inputs.xcheInputs.showLE2 = showAll || false;
x121Inputs.xcheInputs.showSE1 = showAll || false;
x121Inputs.xcheInputs.showSE2 = showAll || false;
//
// XDON ...