This commit is contained in:
2025-04-13 11:46:41 +03:30
parent d1ab32ffb8
commit 1d91d3be1b
5 changed files with 1618 additions and 23 deletions
+36
View File
@@ -0,0 +1,36 @@
// isLowsUnderValesGolden &&
// conditions.isStrSwitchedToBullish
//
// conditions.isStrBullish &&
// conditions.isRejectUpHSM // &&
//
// isStrBullishVPattern &&
// isSwingLowSameAsVale &&
// !conditions.isNewPeakUnderLast
//
// zBar.IsBullish() &&
// isSameStrBreakedUp &&
// isCBarValidForBullish &&
// conditions.isStrBullish &&
// conditions.isATROverLast &&
// conditions.isVidyaUnderLSM // &&
// zBar.close > conditions.strSMHighBuffer[cIDX]
//
// isHighsOverPeaksGolden &&
// conditions.isStrSwitchedToBearish
// conditions.isStrBearish &&
// conditions.isRejectDownLSM // &&
//
// isStrBearishVPattern &&
// isSwingHighSameAsPeak &&
// !conditions.isNewValeOverLast
//
// zBar.IsBearish() &&
// isSameStrBreakedDown &&
// isCBarValidForBearish &&
// conditions.isStrBearish &&
// conditions.isATRUnderLast &&
// conditions.isVidyaOverHSM // &&
// zBar.close < conditions.strSMLowBuffer[cIDX]
+9 -9
View File
@@ -197,7 +197,7 @@ struct X121XSTRConditions
// //
bool isRejectUpVidya; bool isRejectUpVidya;
bool isClosedOverVidya; bool isCloseOverVidya;
bool isCrossedOverVidya; bool isCrossedOverVidya;
// //
@@ -356,7 +356,7 @@ struct X121XSTRConditions
isCrossedUnderHSM = false; isCrossedUnderHSM = false;
isCrossedUnderLSM = false; isCrossedUnderLSM = false;
isCrossedUnderStr = false; isCrossedUnderStr = false;
isClosedOverVidya = false; isCloseOverVidya = false;
isRejectDownVidya = false; isRejectDownVidya = false;
isCloseUnderVidya = false; isCloseUnderVidya = false;
isCrossedOverVidya = false; isCrossedOverVidya = false;
@@ -407,7 +407,7 @@ struct X121XSTRConditions
{ {
bullishScore += minScore; bullishScore += minScore;
} }
if (isClosedOverVidya) if (isCloseOverVidya)
{ {
bullishScore += minScore; bullishScore += minScore;
} }
@@ -618,7 +618,7 @@ struct X121XSTRConditions
ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBullish", isStrSwitchedToBullish, ignoreFalseConditions, separator) +
ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) + ToString("isStrSwitchedToBearish", isStrSwitchedToBearish, ignoreFalseConditions, separator) +
ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) + ToString("isRejectUpVidya", isRejectUpVidya, ignoreFalseConditions, separator) +
ToString("isClosedOverVidya", isClosedOverVidya, ignoreFalseConditions, separator) + ToString("isCloseOverVidya", isCloseOverVidya, ignoreFalseConditions, separator) +
ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) + ToString("isCrossedOverVidya", isCrossedOverVidya, ignoreFalseConditions, separator) +
ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) + ToString("isRejectDownVidya", isRejectDownVidya, ignoreFalseConditions, separator) +
ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) + ToString("isCloseUnderVidya", isCloseUnderVidya, ignoreFalseConditions, separator) +
@@ -1497,10 +1497,10 @@ class XCX121XSTRHelper : public XCBaseHelper
); );
// //
bool isClosedOverVidya = cBar.close > vidyaBuffer[cIDX]; bool isCloseOverVidya = cBar.close > vidyaBuffer[cIDX];
bool isClosedOverVidyaPrev = pBar.close > vidyaBuffer[pIDX]; bool isCloseOverVidyaPrev = pBar.close > vidyaBuffer[pIDX];
bool isCrossedOverVidya = isClosedOverVidya && bool isCrossedOverVidya = isCloseOverVidya &&
!isClosedOverVidyaPrev; !isCloseOverVidyaPrev;
// //
bool isRejectDownVidya = cBar.IsRejected( bool isRejectDownVidya = cBar.IsRejected(
@@ -1672,7 +1672,7 @@ class XCX121XSTRHelper : public XCBaseHelper
conditions.isCrossedUnderHSM = isCrossedUnderHSM; conditions.isCrossedUnderHSM = isCrossedUnderHSM;
conditions.isCrossedUnderLSM = isCrossedUnderLSM; conditions.isCrossedUnderLSM = isCrossedUnderLSM;
conditions.isCrossedUnderStr = isCrossedUnderStr; conditions.isCrossedUnderStr = isCrossedUnderStr;
conditions.isClosedOverVidya = isClosedOverVidya; conditions.isCloseOverVidya = isCloseOverVidya;
conditions.isRejectDownVidya = isRejectDownVidya; conditions.isRejectDownVidya = isRejectDownVidya;
conditions.isCloseUnderVidya = isCloseUnderVidya; conditions.isCloseUnderVidya = isCloseUnderVidya;
conditions.isCrossedOverVidya = isCrossedOverVidya; conditions.isCrossedOverVidya = isCrossedOverVidya;
File diff suppressed because it is too large Load Diff
+367
View File
@@ -24,6 +24,7 @@
#include "../../Libraries/x-saherelm.common.lib.mq5" #include "../../Libraries/x-saherelm.common.lib.mq5"
#include "../../Libraries/x-saherelm.x-poi.lib.mq5" #include "../../Libraries/x-saherelm.x-poi.lib.mq5"
#include "../../Libraries/x-saherelm.x-trade.lib.mq5" #include "../../Libraries/x-saherelm.x-trade.lib.mq5"
#include "../Helpers/xstrcci.helper.mq5"
// //
// Enumeration ... // Enumeration ...
@@ -418,4 +419,370 @@ int AddGuard(
return result; return result;
} }
//
bool DetectXSTRCCIConditions(
XBoxZone &box,
ENUM_X_DIRECTION &dir,
XCXSTRCCIHelper *helper,
int barIndex = 0,
int loopback = 10 //
)
{
//
bool result = false;
//
box.Clean();
dir = X_DIRECTION_NONE;
//
if (barIndex < 0)
{
barIndex = 0;
}
loopback = NormalizeInt(loopback, 5);
//
string symbol = helper.GetSymbol();
ENUM_TIMEFRAMES period = helper.GetPeriod();
//
XSTRCCIConditions conditions;
result = helper.GetConditions(
conditions,
barIndex,
loopback //
);
if (!result)
{
//
conditions.Clean();
return result;
}
//
int zIDX = barIndex;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int ppIDX = pIDX + 1;
int p3IDX = ppIDX + 1;
int p4IDX = p3IDX + 1;
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL ppBar;
XOHCL p3Bar;
XOHCL p4Bar;
result = zBar.Init(
symbol,
period,
zIDX //
);
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(ppBar);
result =
result &&
ppBar.GetPreviousBar(p3Bar);
result =
result &&
p3Bar.GetPreviousBar(p4Bar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
ppBar.Clean();
p3Bar.Clean();
p4Bar.Clean();
//
return result;
}
//
// Bars Conditions ...
//
ENUM_X_DIRECTION cBarDir;
//
// Hammer ...
bool isCBarHammer = helper
.barAnalyser
.IsHammer(
cBar,
cBarDir //
);
bool isCBarBullishHammer =
isCBarHammer &&
IsBullish(cBarDir);
bool isCBarBearishHammer =
isCBarHammer &&
IsBearish(cBarDir);
//
// Rejected ...
bool isCBarRejected = helper
.barAnalyser
.IsRejected(
cBar,
cBarDir,
false, // Force Type ...
true // Force Fibo Pressure ...
);
bool isCBarBullishRejected =
isCBarRejected &&
IsBullish(cBarDir);
bool isCBarBearishRejected =
isCBarRejected &&
IsBearish(cBarDir);
//
// Engulfed ...
bool isCBarEngulfed = helper
.barAnalyser
.IsEngulfed(
cBar,
cBarDir //
);
bool isCBarBullishEngulfed =
isCBarEngulfed &&
IsBullish(cBarDir);
bool isCBarBearishEngulfed =
isCBarEngulfed &&
IsBearish(cBarDir);
//
// Momentum ...
bool isCBarMomentum = helper
.barAnalyser
.IsMomentum(
cBar,
cBarDir,
1 //
);
bool isCBarBullishMomentum =
isCBarMomentum &&
IsBullish(cBarDir);
bool isCBarBearishMomentum =
isCBarMomentum &&
IsBearish(cBarDir);
//
// Bar Sumarise ...
//
bool isCBarValidForBullish =
(isCBarBullishHammer ||
isCBarBullishRejected ||
isCBarBullishMomentum ||
isCBarBullishEngulfed);
//
bool isCBarValidForBearish =
(isCBarBearishHammer ||
isCBarBearishRejected ||
isCBarBearishMomentum ||
isCBarBearishEngulfed);
//
// Conditions ...
//
bool isLowsUnderValesGolden =
//
pBar.low < conditions.valesGoldenBuffer[pIDX] &&
ppBar.low < conditions.valesGoldenBuffer[ppIDX] &&
p3Bar.low < conditions.valesGoldenBuffer[p3IDX] &&
p4Bar.low < conditions.valesGoldenBuffer[p4IDX]
//
;
//
bool isHighsOverPeaksGolden =
//
pBar.high > conditions.peaksGoldenBuffer[pIDX] &&
ppBar.high > conditions.peaksGoldenBuffer[ppIDX] &&
p3Bar.high > conditions.peaksGoldenBuffer[p3IDX] &&
p4Bar.high > conditions.peaksGoldenBuffer[p4IDX]
//
;
//
bool isSwingLowSameAsVale =
conditions.swingLowsBuffer[p4IDX] == conditions.valesBuffer[p4IDX];
//
bool isSwingHighSameAsPeak =
conditions.swingHighsBuffer[p4IDX] == conditions.peaksBuffer[p4IDX];
//
bool isStrSame = conditions.strBuffer[cIDX] == conditions.strBuffer[pIDX] &&
conditions.strBuffer[pIDX] == conditions.strBuffer[ppIDX];
//
bool isSameStrBreakedUp =
isStrSame &&
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX];
//
bool isSameStrBreakedDown =
isStrSame &&
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX];
//
bool isStrBullishVPattern =
//
conditions.strStateBuffer[zIDX] > 0 &&
conditions.strStateBuffer[cIDX] > 0 &&
conditions.strStateBuffer[pIDX] > 0 &&
conditions.strBuffer[pIDX] < conditions.strBuffer[ppIDX] &&
conditions.strBuffer[pIDX] < conditions.strBuffer[cIDX] &&
conditions.strBuffer[pIDX] < conditions.strBuffer[zIDX] &&
conditions.strBuffer[zIDX] > conditions.strBuffer[cIDX]
//
;
//
bool isStrBearishVPattern =
//
conditions.strStateBuffer[zIDX] < 0 &&
conditions.strStateBuffer[cIDX] < 0 &&
conditions.strStateBuffer[pIDX] < 0 &&
conditions.strBuffer[pIDX] > conditions.strBuffer[ppIDX] &&
conditions.strBuffer[pIDX] > conditions.strBuffer[cIDX] &&
conditions.strBuffer[pIDX] > conditions.strBuffer[zIDX] &&
conditions.strBuffer[zIDX] < conditions.strBuffer[cIDX]
//
;
//
bool isCBarLowInTKZone =
//
cBar.low < conditions.tenkanSenBuffer[cIDX] &&
cBar.low > conditions.kijunSenBuffer[cIDX]
//
;
//
bool isCBarHighInTKZone =
//
cBar.high > conditions.tenkanSenBuffer[cIDX] &&
cBar.high < conditions.kijunSenBuffer[cIDX]
//
;
//
// Summarise Conditions ...
//
bool isBullish =
//
isCBarLowInTKZone &&
isCBarBullishRejected &&
isCBarValidForBullish &&
conditions.isX3MaSlowBullish &&
conditions.isTenkanSenOverKijunSen &&
conditions.kijunSenBuffer[cIDX] > conditions.x3maSlowBuffer[cIDX]
//
;
//
bool isBearish =
//
isCBarHighInTKZone &&
isCBarBearishRejected &&
isCBarValidForBearish &&
conditions.isX3MaSlowBearish &&
conditions.isTenkanSenUnderKijunSen &&
conditions.kijunSenBuffer[cIDX] < conditions.x3maSlowBuffer[cIDX]
//
;
//
result = isBullish ||
isBearish;
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
double entry = GetEntry(
conditions.symbol,
dir //
);
double sl = conditions.kijunSenBuffer[cIDX];
//
box.dir = dir;
box.symbol = conditions.symbol;
box.period = conditions.period;
//
box.upper =
isBullish
? entry
: sl;
//
box.lower =
isBullish
? sl
: entry;
//
box.to = zBar.time;
box.from = p4Bar.time;
//
box.type = ToString(dir) + "_Signal_" + conditions.symbol + "_" + ToString(conditions.period);
//
XCBoxObject *iObj;
bool isCreated = helper.poiDrawer.DrawBox(
box,
iObj //
);
if (isCreated)
{
Print("Signal Box ...");
}
}
//
result = box.IsValid() &&
HasDirection(dir);
//
// Cleanup Resources ...
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
ppBar.Clean();
p3Bar.Clean();
p4Bar.Clean();
//
conditions.Clean();
//
return result;
}
// //
+156 -8
View File
@@ -40,6 +40,7 @@ class XCXSTRCCISignaller : XCBase
double rfReward; double rfReward;
bool isPassedBoxes; bool isPassedBoxes;
XSTRCCIInputs inputs; XSTRCCIInputs inputs;
XBarTracker barTraker;
XCXSTRCCIHelper *helper; XCXSTRCCIHelper *helper;
bool continuesRFTillTarget; bool continuesRFTillTarget;
XSTRCCIStrategyConditions mConditions; XSTRCCIStrategyConditions mConditions;
@@ -96,6 +97,117 @@ class XCXSTRCCISignaller : XCBase
// //
bool result = false; bool result = false;
//
// Check Bar Processing ...
if (!barTraker.CanProcessBar())
{
return result;
}
//
bool isBullish = false;
bool isBearish = false;
//
int zIndex = 0;
int cIndex = zIndex + 1;
int pIndex = cIndex + 1;
int ppIndex = pIndex + 1;
//
int loopback = 10;
//
double ask = GetAsk(symbol);
double bid = GetBid(symbol);
datetime cTime = TimeCurrent();
double points = GetPoints(symbol);
//
mConditions.symbol = symbol;
mConditions.period = period;
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
XOHCL pPBar;
result = zBar.Init(
symbol,
period,
zIndex //
);
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result &&
cBar.GetPreviousBar(pBar);
result =
result &&
pBar.GetPreviousBar(pPBar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
//
return result;
}
//
// Setup Conditions ...
double sls[];
double sl = 0;
double pivot = 0;
double point = 0;
double targets[];
XBoxZone signalBox;
bool hasSignalBox = false;
ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE;
//
// Checking Conditions ...
//
hasSignalBox = DetectXSTRCCIConditions(
signalBox,
signalBoxDir,
helper,
zIndex,
loopback //
);
//
isBullish = hasSignalBox &&
IsBullish(signalBoxDir);
//
isBearish = hasSignalBox &&
IsBearish(signalBoxDir);
//
result = isBullish ||
isBearish;
if (result)
{
//
// Do What we Want ...
barTraker.Waits();
}
//
// Cleanup Resource ...
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
pPBar.Clean();
// //
return result; return result;
} }
@@ -303,6 +415,12 @@ class XCXSTRCCISignaller : XCBase
isPassedBoxes = false; isPassedBoxes = false;
continuesRFTillTarget = true; continuesRFTillTarget = true;
//
barTraker.Init(
symbol,
period //
);
// //
inputs.Default(); inputs.Default();
@@ -317,21 +435,48 @@ class XCXSTRCCISignaller : XCBase
// XCT ... // XCT ...
inputs.ctInputs.showCandleTime = true; inputs.ctInputs.showCandleTime = true;
//
// XPV ...
inputs.pvInputs.showSar = false;
inputs.pvInputs.showPeaks = false;
inputs.pvInputs.showVales = false;
inputs.pvInputs.showTrend = false;
inputs.pvInputs.showSwingLows = false;
inputs.pvInputs.showSwingHighs = false;
inputs.pvInputs.showGoldenZones = false;
inputs.pvInputs.showSupports = false;
inputs.pvInputs.showResistances = false;
// //
// XSTR ... // XSTR ...
inputs.strInputs.showStr = true; inputs.strInputs.showStr = false;
inputs.strInputs.showVidya = true; inputs.strInputs.showVidya = false;
inputs.strInputs.showStrUpper = false; inputs.strInputs.showStrUpper = false;
inputs.strInputs.showStrLower = false; inputs.strInputs.showStrLower = false;
inputs.strInputs.showStrSMLow = true; inputs.strInputs.showStrSMLow = false;
inputs.strInputs.showStrSMHigh = true; inputs.strInputs.showStrSMHigh = false;
//
// X3MA ...
inputs.ma3Inputs.showX3MaFast = false;
inputs.ma3Inputs.showX3MaMid = false;
inputs.ma3Inputs.showX3MaSlow = true;
//
// XICH ...
inputs.ichInputs.showKumo = false;
inputs.ichInputs.showKijunSen = true;
inputs.ichInputs.showTenkanSen = true;
inputs.ichInputs.showChikouSpan = false;
inputs.ichInputs.showSenkouSpanA = false;
inputs.ichInputs.showSenkouSpanB = false;
// //
// XOSCS ... // XOSCS ...
inputs.oscsInputs.rsiLength = 5; // inputs.oscsInputs.rsiLength = 5;
inputs.oscsInputs.mfiLength = 5; // inputs.oscsInputs.mfiLength = 5;
inputs.oscsInputs.rviLength = 5; // inputs.oscsInputs.rviLength = 5;
inputs.oscsInputs.cciLength = 5; // inputs.oscsInputs.cciLength = 5;
// //
// Oscillators Views ... // Oscillators Views ...
@@ -367,6 +512,9 @@ class XCXSTRCCISignaller : XCBase
// //
mObjects.Clear(); mObjects.Clear();
mBarObjects.Clear(); mBarObjects.Clear();
//
barTraker.Clean();
} }
// //