This commit is contained in:
2025-12-31 13:49:57 +03:30
parent b1731af03c
commit ad945b90b2
9 changed files with 246 additions and 7 deletions
@@ -4332,14 +4332,14 @@ class XCMarketPatternDetector : public XCBase
bool containsFVGs = true,
bool containsSupports = true,
bool containsResistancess = true,
int loopback = 500,
ENUM_X_DIRECTION forDir = X_DIRECTION_NONE,
ENUM_X_SORT_BY sortBy = X_SORT_BY_DATE,
ENUM_X_DIRECTION sortDir = X_DIRECTION_BEARISH,
double zonesRangeValidationFactor = 10,
int zonesLoopback = 5,
int zonesValidationLength = 5,
int count = 0,
int loopback = 500 //
int count = 0 //
)
{
//
+53
View File
@@ -1104,6 +1104,59 @@ struct XBoxZone
ZeroMemory(this);
}
bool Init(
string _symbol,
ENUM_TIMEFRAMES _period,
double _upper,
double _lower,
datetime _from,
datetime _to,
ENUM_X_DIRECTION _dir,
string _type = "",
datetime _at = NULL //
)
{
//
bool result = false;
//
// Validate ...
result = IsXValid(_symbol) &&
IsXValid(_period) &&
_upper > 0 &&
_lower > 0 &&
_upper > _lower &&
IsXValid(_from) &&
IsXValid(_to) &&
_from < _to &&
HasDirection(_dir);
if (!result)
{
return result;
}
//
this.to = _to;
this.at = _at;
this.dir = _dir;
this.from = _from;
this.type = _type;
this.lower = _lower;
this.upper = _upper;
this.symbol = _symbol;
this.period = _period;
//
result = IsValid();
if (!result)
{
Clean();
}
//
return result;
}
/**
* Clean Special Props ...
*/
@@ -923,10 +923,165 @@ class XCX121XKIStrategy1Signaller : public XCX121XKIBaseSignaller
}
//
DebugBreak();
// Detect Nearest Directional ...
int nearestDirectionalSwitchIndex = -1;
if (isBullish)
{
//
isBullish = poiDetector.NearestKIFastSwitchedToBullish(
nearestDirectionalSwitchIndex,
bar.Index() + 2 //
);
}
else
{
//
isBearish = poiDetector.NearestKIFastSwitchedToBearish(
nearestDirectionalSwitchIndex,
bar.Index() + 2 //
);
}
result =
IsValidIndex(nearestDirectionalSwitchIndex) &&
(isBullish ||
isBearish);
if (!result)
{
//
bar.Clean();
return result;
}
//
// Preparing Zone ...
double upper = bar.FindHighest(nearestDirectionalSwitchIndex - bar.Index(), MODE_HIGH);
double lower = bar.FindLowest(nearestDirectionalSwitchIndex - bar.Index(), MODE_LOW);
//
result = zone.Init(
symbol,
period,
upper,
lower,
GetBarTime(symbol, period, nearestDirectionalSwitchIndex),
bar.time,
dir,
"XKI1" //
);
//
// Support and Resistance ...
XBoxZone support;
XBoxZone resistance;
if (result)
{
//
XOHCL tmpBar;
int tmpIDX = -1;
bool has = false;
double upper = 0;
double lower = 0;
int length = zone.GetAge();
//
// Support ...
tmpIDX = bar.FindLowestIndex(length, MODE_LOW);
if (IsValidIndex(tmpIDX))
{
//
if (tmpBar.Init(symbol, period, tmpIDX))
{
//
lower = iLow(symbol, period, tmpIDX);
upper = bar.FindLowest(length, MODE_CLOSE);
if (upper <= lower)
{
upper = tmpBar.GetDown();
}
//
has = support.Init(
symbol,
period,
upper,
lower,
tmpBar.time,
bar.time,
X_DIRECTION_BULLISH,
X_BAR_PATTERN_SUPPORT //
);
//
tmpBar.Clean();
}
}
//
// Resistance ...
tmpIDX = bar.FindHighestIndex(length, MODE_HIGH);
if (IsValidIndex(tmpIDX))
{
//
if (tmpBar.Init(symbol, period, tmpIDX))
{
//
upper = iHigh(symbol, period, tmpIDX);
lower = bar.FindHighest(length, MODE_CLOSE);
if (upper <= lower)
{
upper = tmpBar.GetUp();
}
//
has = resistance.Init(
symbol,
period,
upper,
lower,
tmpBar.time,
bar.time,
X_DIRECTION_BEARISH,
X_BAR_PATTERN_RESISTANCE //
);
//
tmpBar.Clean();
}
}
}
//
// TODO: Rempve ...
if (result)
{
//
// Other Drawing Materials ...
XPOIDrawConfig drawConfig;
drawConfig.Default();
//
poiDrawer.DrawZone(zone, drawConfig);
//
if (support.IsValid())
{
poiDrawer.DrawZone(support, drawConfig);
}
//
if (resistance.IsValid())
{
poiDrawer.DrawZone(resistance, drawConfig);
}
//
drawConfig.Clean();
//
// DebugBreak();
}
//
result = ToBox(bar, zone, dir, X_BAR_PATTERN_SIGNALKEY);
result =
result &&
zone.IsValid() &&
+2 -1
View File
@@ -1,7 +1,8 @@
@echo off
set METAEDITOR="C:\Program Files\MetaTrader 5\MetaEditor64.exe"
@REM set METAEDITOR="C:\Program Files\MetaTrader 5 General\MetaEditor64.exe"
set METAEDITOR="C:\Program Files\MetaTrader 5 Main\MetaEditor64.exe"
@REM set METAEDITOR="C:\Program Files\MetaTrader 5 Main\MetaEditor64.exe"
@REM set METAEDITOR="C:\Program Files\MetaTrader 5 General\MetaEditor64.exe"
set "LOGFILE=%~dpn1.log"
+2 -1
View File
@@ -18,7 +18,8 @@
"compileIndicators": "npm run mqlHelper indicators",
"repackXFIMAEA": "node prepareXFIMAEA.js",
"repackXCATBEA": "node prepareXCATBEA.js",
"repackXOM1EA": "node prepareXOM1EA.js"
"repackXOM1EA": "node prepareXOM1EA.js",
"repackX121XKIEA": "node prepareX121XKIEA.js"
},
"repository": {
"type": "git",
+29
View File
@@ -0,0 +1,29 @@
//
// Import Requirements ...
const XProjectTools = require("./x-mql-project.tools");
//
// define constants ...
const projectName = "X121XKIEA";
//
// Projects Resources ...
const projectResources = [
"Libraries/*", // Required Libraries
"Classes/*", // Required Classes
"X121XKIEA/*", // X121XKIEA Projects ...
"Indicators/x-saherelm.x121.xki", // Required Indicators
"Helpers/x-saherelm.x121.xki.helper", // Indicator's Helpers Classes
"Experts/x-saherelm.x121.xki.backtester.ea", // Expert Advisers
];
//
run();
/**
* Main Project Function ...
*/
async function run() {
//
await XProjectTools.prepareProject(projectName, projectResources);
}