Files
MQL5Data/Documents/BKP/2.mq5
T
2025-05-03 21:59:49 +03:30

450 lines
11 KiB
Plaintext

//
void ApplyManalyswerValidation(
XBoxZone &pivots[],
int barIndex = 0 //
)
{
//
int zIDX = 0;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int p2IDX = pIDX + 1;
//
barIndex = NormalizeInt(barIndex, 0);
//
bool has = HasChild(pivots);
if (!has)
{
return;
}
//
XBoxZone tmp[];
Copy(
pivots,
tmp //
);
Clean(pivots);
while (HasChild(tmp))
{
//
XBoxZone iPivot = tmp[0];
ArrayRemove(
tmp,
0,
1 //
);
//
// Retrieve Pivot info ...
// int toIDX = iPivot.ToIndex();
// int fromIDX = iPivot.FromIndex();
// bool isBullish = iPivot.IsBullish();
//
// Retrieve Conditions ...
// XCAEAConditions conditions;
// has = helper.GetConditions(
// conditions,
// toIDX,
// 5 //
// );
//
// Retrieve Bars ...
//
// XOHCL cBar;
// XOHCL pBar;
// XOHCL p2Bar;
// //
// has =
// has &&
// cBar.Init(
// conditions.symbol,
// conditions.period,
// toIDX //
// );
// has = has &&
// cBar.GetPreviousBar(pBar);
// has = has &&
// pBar.GetPreviousBar(p2Bar);
// if (!has)
// {
// //
// cBar.Clean();
// pBar.Clean();
// p2Bar.Clean();
// iPivot.Clean();
// conditions.Clean();
// //
// continue;
// }
//
// Reading Conditions ...
// //
// // MAL ...
// double zMAL = conditions.malBuffer[zIDX];
// double cMAL = conditions.malBuffer[cIDX];
// double pMAL = conditions.malBuffer[pIDX];
// double p2MAL = conditions.malBuffer[p2IDX];
// //
// // MAC ...
// double zMAC = conditions.macBuffer[zIDX];
// double cMAC = conditions.macBuffer[cIDX];
// double pMAC = conditions.macBuffer[pIDX];
// double p2MAC = conditions.macBuffer[p2IDX];
// //
// // MAH ...
// double zMAH = conditions.mahBuffer[zIDX];
// double cMAH = conditions.mahBuffer[cIDX];
// double pMAH = conditions.mahBuffer[pIDX];
// double p2MAH = conditions.mahBuffer[p2IDX];
//
// Checking Conditions ...
// has = isBullish
// ? cBar.high < cMAL ||
// pBar.high < pMAL
// : cBar.low < cMAH ||
// pBar.low < pMAL;
//
has =
isBullish
? iPivot.
if (has)
{
//
AddRef(
iPivot,
pivots //
);
}
//
// Cleanup Resources ...
// cBar.Clean();
// pBar.Clean();
// p2Bar.Clean();
iPivot.Clean();
// conditions.Clean();
}
//
Clean(tmp);
}
//////////////////////////////////////////////////////////////
//
// Parsing Pivots ...
XBoxZone rciPivot;
double providedSL = 0;
XBoxZone rejectedPivot;
XBoxZone insidePivots[];
XBoxZone rciContainers[];
int insidePivotsCount = 0;
bool isRejectedOnMid = false;
bool hasInsidePivots = false;
bool hasRCIContainers = false;
bool hasPivots = HasChild(pivots);
if (hasPivots)
{
//
// drawer.DrawBoxes(
// pivots,
// TimeCurrent() //
// );
//
// Select Inside Boxes ...
//
ENUM_XCA_PIVOTS allowedInsidePivots[] = {
XCA_FVG_BULL,
XCA_FVG_BEAR,
XCA_PEAKSWHRES,
XCA_VALESWLSUP,
XCA_TREND_BULL,
XCA_TREND_BEAR,
};
insidePivotsCount = SelectInsideBoxes(
allowedInsidePivots,
insidePivots,
pivots,
zBar,
cBar,
pBar,
p2Bar //
);
hasInsidePivots = IsValidSize(insidePivotsCount);
if (hasInsidePivots)
{
//
// drawer.DrawBoxes(
// insidePivots,
// zBar.time //
// );
}
//
// Detect Rejected Pivot ...
ENUM_XCA_PIVOTS allowedRejectedPivots[] = {
XCA_FVG_BULL,
XCA_FVG_BEAR,
// XCA_PEAKSWHRES,
// XCA_VALESWLSUP,
// XCA_TREND_BULL,
// XCA_TREND_BEAR,
};
has = SelectRejectedBox(
allowedRejectedPivots,
rejectedPivot,
isRejectedOnMid,
pivots,
zBar,
cBar,
pBar,
p2Bar,
false, // Ignore Mid Rejection ...
true,
true //
);
//
// Select CCI/RSI Cross Object ...
count = ArraySize(pivots);
for (int i = 0; i < count; i++)
{
//
XBoxZone iPivot = pivots[i];
//
ENUM_XCA_PIVOTS iType = GetPivotType(iPivot);
//
// Checking Type is Passed ...
has =
//
iType == XCA_RSI_COOS ||
iType == XCA_CCI_COOS ||
iType == XCA_RSI_CUOB ||
iType == XCA_CCI_CUOB
//
;
//
// Checking cBar is Pivots' Last Bar ...
has =
has &&
cBar.time <= iPivot.to &&
cBar.time > iPivot.from;
if (has)
{
//
rciPivot = iPivot;
//
iPivot.Clean();
//
break;
}
//
iPivot.Clean();
}
//
// Detect RCI Pivot Containers Pivots ...
count = ArraySize(pivots);
has = rciPivot.IsValid();
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XBoxZone iPivot = pivots[i];
//
ENUM_XCA_PIVOTS iType = GetPivotType(iPivot);
//
// Checking Type is Passed ...
has =
//
IsValid(iType) &&
(iType == XCA_PEAKSWHRES ||
iType == XCA_VALESWLSUP)
//
;
//
// Check Dir is Passed ...
has =
has &&
rciPivot.dir == iPivot.dir;
//
// Check RCI Pivot is Inside Pivot ...
has =
has &&
//
(
//
(rciPivot.lower >= iPivot.lower &&
rciPivot.lower < iPivot.upper)
//
||
//
(rciPivot.upper <= iPivot.upper &&
rciPivot.upper > iPivot.lower)
//
||
//
(rciPivot.upper > iPivot.upper &&
rciPivot.lower < iPivot.lower)
//
)
//
;
//
if (has)
{
//
AddRef(
iPivot,
rciContainers //
);
}
//
iPivot.Clean();
}
//
hasRCIContainers = HasChild(rciContainers);
}
}
/////////////////////////////////////////////////////////////////////
//
// Box Based Conditions ...
//
// if (isCBarHasStrongATR)
// {
// //
// Print(ToString(cBar.GetDirection()), " ATR Growing ...");
// }
//
// bool isZeroVScore = isScoreNeutural ||
// isVolumeNeutural;
// //
// bool isBullishTested =
// isZeroVScore &&
// isCBarValidForBullish // &&
// // rejectedPivot.IsValid() &&
// // rejectedPivot.IsBullish()
// ;
// bool isBearishTested =
// isZeroVScore &&
// isCBarValidForBearish // &&
// // rejectedPivot.IsValid() &&
// // rejectedPivot.IsBearish()
// ;
// //
// bool isTested =
// //
// isBullishTested ||
// isBearishTested
// //
// ;
// if (isTested)
// {
// //
// Print("Zero Volume ...");
// }
/////////////////////////////////////////////////////////////////////
//
bool isCond2Bullish =
//
false // &&
//
// conditions.
//
// zPeak > cPeak &&
// zBar.close > cPeak &&
// ((zPeak - cPeak) > 2 * points) &&
//
// z3MAFastState > 0 &&
// isValeGoldenRejected &&
// isCBarBullishRejected &&
// conditions.isValeIsPivot
//
// isPCCIOS &&
// isRSIBullish &&
// conditions.isCloseUnderMal
// rciPivot.IsValid() &&
// rciPivot.IsBullish() &&
// isCCIBullish &&
// cBar.close > c3MAFast
// isADXBullish &&
// hasRCIContainers &&
// conditions.isValeIsPivot &&
// (conditions.isRSICrossedOverOS ||
// conditions.isCCICrossedOverOS) // &&
// conditions.swingLowBuffer[cIDX] < conditions.fiboLevel3Buffer[cIDX]
// //
;
//
bool isCond2Bearish =
//
false // &&
//
// z3MAFastState < 0 &&
// isPeakGoldenRejected &&
// isCBarBullishRejected &&
// conditions.isPeakIsPivot
//
// isPCCIOB &&
// isRSIBearish &&
// c3MAFastState < 0 &&
// conditions.isCloseOverMah
// rciPivot.IsValid() &&
// rciPivot.IsBearish() &&
// conditions.isRSIOB &&
// isCCIBearish &&
// cBar.close < c3MAFast
// isADXBearish &&
// hasRCIContainers &&
// conditions.isPeakIsPivot &&
// (conditions.isRSICrossedUnderOB ||
// conditions.isCCICrossedUnderOB) // &&
// conditions.swingHighBuffer[cIDX] > conditions.fiboLevel1Buffer[cIDX]
// //
;