cleanup x121 helper, apply all cleanup and buffers and conditions on helpers and try to complete x121 new helper ...

This commit is contained in:
2025-03-31 07:04:12 +03:30
parent 7619129c26
commit 53ad7b092a
28 changed files with 14572 additions and 6548 deletions
+2
View File
@@ -158,3 +158,5 @@
// isNearestTenkensSenCrossedUnderKijunSen
//
;
+27
View File
@@ -0,0 +1,27 @@
//
// XCC ...
//
// XPV ...
//
// XHK ...
//
// XMAS ...
//
// XATR ...
//
// XSTR ...
//
// XCHE ...
//
// X3MA ...
//
// XVWAP ...
+82
View File
@@ -0,0 +1,82 @@
//
// XCC ...
//
// Buffers ...
//
// Conditions ...
//
// XPV ...
//
// Buffers ...
//
// Conditions ...
//
// XHK ...
//
// Buffers ...
//
// Conditions ...
//
// XMAS ...
//
// Buffers ...
//
// Conditions ...
//
// XATR ...
//
// Buffers ...
//
// Conditions ...
//
// XSTR ...
//
// Buffers ...
//
// Conditions ...
//
// XCHE ...
//
// Buffers ...
//
// Conditions ...
//
// X3MA ...
//
// Buffers ...
//
// Conditions ...
//
// XVWAP ...
//
// Buffers ...
//
// Conditions ...
+359
View File
@@ -0,0 +1,359 @@
//
// XCC ...
//
// Buffers ...
//
// Conditions ...
//
// XPV ...
//
// Buffers ...
//
double sarBuffer[];
double cHHBuffer[];
double cLLBuffer[];
double sHHBuffer[];
double sLLBuffer[];
double mHHBuffer[];
double mLLBuffer[];
double lHHBuffer[];
double lLLBuffer[];
double hHHBuffer[];
double hLLBuffer[];
double peaksBuffer[];
double valesBuffer[];
double supportsBuffer[];
double peaksGoldenBuffer[];
double valesGoldenBuffer[];
double resistancesBuffer[];
double fractalsUpperBuffer[];
double fractalsLowerBuffer[];
//
// Conditions ...
//
bool isSarBullish;
bool isSarBearish;
//
bool isSarSwitchedToBullish;
bool isSarSwitchedToBearish;
//
bool isNewPeak;
bool isNewPeakOverLast;
bool isNewPeakUnderLast;
//
bool isNewVale;
bool isNewValeOverLast;
bool isNewValeUnderLast;
//
// XHK ...
//
// Buffers ...
//
double xhkSMLowBuffer[];
double xhkRawLowBuffer[];
double xhkSMOpenBuffer[];
double xhkSMHighBuffer[];
double xhkRawOpenBuffer[];
double xhkRawHighBuffer[];
double xhkSMCloseBuffer[];
double xhkRawCloseBuffer[];
//
// Conditions ...
//
bool isSMHKBullish;
bool isRawHKBullish;
bool isSMHKSwitchedToBullish;
bool isRawHKSwitchedToBullish;
//
bool isSMHKBearish;
bool isRawHKBearish;
bool isSMHKSwitchedToBearish;
bool isRawHKSwitchedToBearish;
//
bool isClosedOverSMHK;
bool isClosedUnderSMHK;
bool isClosedOverRawHK;
bool isClosedUnderRawHK;
//
bool isRawHKClosedOverSMHK;
bool isRawHKClosedUnderSMHK;
//
// XMAS ...
//
// Buffers ...
//
double midBuffer[];
double upperBuffer[];
double lowerBuffer[];
//
// Conditions ...
//
// XATR ...
//
// Buffers ...
//
double rsiBuffer[];
double atrBuffer[];
double atrUpperBuffer[];
double atrLowerBuffer[];
double atrUpperSMBuffer[];
double atrLowerSMBuffer[];
double rsiChangeBuffer[];
double rsiChangeSMBuffer[];
double priceChangeBuffer[];
double priceChangeSMBuffer[];
//
// Conditions ...
//
bool isRsiInRange;
bool isRsiOverSold;
bool isRsiOverBought;
bool isRsiCrossedOverOverSold;
bool isRsiCrossedUnderOverSold;
bool isRsiCrossedOverOverBought;
bool isRsiCrossedUnderOverBought;
//
bool isRsiSMOverPriceChange;
bool isRsiSMUnderPriceChange;
//
bool isRsiSMCrossedOverPriceChange;
bool isRsiSMCrossedUnderPriceChange;
//
bool isPriceChangeSMOverRsi;
bool isPriceChangeSMUnderRsi;
//
bool isPriceChangeSMCrossedOverRsi;
bool isPriceChangeSMCrossedUnderRsi;
//
bool isRsiOverRsiSM;
bool isRsiUnderRsiSM;
//
bool isRsiCrossedOverRsiSM;
bool isRsiCrossedUnderRsiSM;
//
bool isPriceChangeOverPriceChangeSM;
bool isPriceChangeUnderPriceChangeSM;
//
bool isPriceChangeCrossedOverPriceChangeSM;
bool isPriceChangeCrossedUnderPriceChangeSM;
//
// XSTR ...
//
// Buffers ...
//
double strBuffer[];
double strUpBuffer[];
double strDownBuffer[];
double strPriceBuffer[];
double strStateBuffer[];
//
// Conditions ...
//
bool isStrBullish;
bool isStrBearish;
//
bool isStrSwitchedToBullish;
bool isStrSwitchedToBearish;
//
// XCHE ...
//
// Buffers ...
//
double le1Buffer[];
double se1Buffer[];
double le2Buffer[];
double se2Buffer[];
double le1StartBuffer[];
double se1StartBuffer[];
double le2StartBuffer[];
double se2StartBuffer[];
//
// Conditions ...
//
bool isChe1Bullish;
bool isChe1Bearish;
//
bool isChe1SwitchedToBullish;
bool isChe1SwitchedToBearish;
//
bool isChe2Bullish;
bool isChe2Bearish;
//
bool isChe2SwitchedToBullish;
bool isChe2SwitchedToBearish;
//
bool isCheBullish;
bool isCheBearish;
//
bool isCheSwitchedToBullish;
bool isCheSwitchedToBearish;
//
// X3MA ...
//
// Buffers ...
//
double x3maMidBuffer[];
double x3maFastBuffer[];
double x3maSlowBuffer[];
double x3maMidStateBuffer[];
double x3maFastStateBuffer[];
double x3maSlowStateBuffer[];
//
// Conditions ...
//
bool isX3MaFastBullish;
bool isX3MaFastBearish;
bool isX3MaFastNeutural;
//
bool isX3MaMidBullish;
bool isX3MaMidBearish;
bool isX3MaMidNeutural;
//
bool isX3MaSlowBullish;
bool isX3MaSlowBearish;
bool isX3MaSlowNeutural;
//
bool isX3MaFastOverMid;
bool isX3MaMidOverSlow;
//
bool isX3MaFastUnderMid;
bool isX3MaMidUnderSlow;
//
bool isX3MaBullishState;
bool isX3MaBearishState;
bool isX3MaNeuturalState;
//
bool isX3MaBullishOrdered;
bool isX3MaBearishOrdered;
//
bool isX3MaSwitchedToBullishOrdered;
bool isX3MaSwitchedToBearishOrdered;
//
bool isX3MaSwitchedToBullishState;
bool isX3MaSwitchedToBearishState;
bool isX3MaSwitchedToNeuturalState;
//
// XVWAP ...
//
// Buffers ...
//
double vwapMidBuffer[];
double vwapFastBuffer[];
double vwapSlowBuffer[];
double vwapPriceBuffer[];
double vwapVolumeBuffer[];
double vwapMidStateBuffer[];
double vwapFastStateBuffer[];
double vwapSlowStateBuffer[];
//
// Conditions ...
//
bool isVWapFastBullish;
bool isVWapFastBearish;
bool isVWapFastNeutural;
//
bool isVWapMidBullish;
bool isVWapMidBearish;
bool isVWapMidNeutural;
//
bool isVWapSlowBullish;
bool isVWapSlowBearish;
bool isVWapSlowNeutural;
//
bool isVWapFastOverMid;
bool isVWapMidOverSlow;
//
bool isVWapFastUnderMid;
bool isVWapMidUnderSlow;
//
bool isVWapBullishState;
bool isVWapBearishState;
bool isVWapNeuturalState;
//
bool isVWapBullishOrdered;
bool isVWapBearishOrdered;
//
bool isVWapSwitchedToBullishOrdered;
bool isVWapSwitchedToBearishOrdered;
//
bool isVWapSwitchedToBullishState;
bool isVWapSwitchedToBearishState;
bool isVWapSwitchedToNeuturalState;
+408
View File
@@ -0,0 +1,408 @@
//
// XPV ...
//
// Buffers ...
//
// Clean ...
//
Clean(sarBuffer);
Clean(cHHBuffer);
Clean(cLLBuffer);
Clean(sHHBuffer);
Clean(sLLBuffer);
Clean(mHHBuffer);
Clean(mLLBuffer);
Clean(lHHBuffer);
Clean(lLLBuffer);
Clean(hHHBuffer);
Clean(hLLBuffer);
Clean(peaksBuffer);
Clean(valesBuffer);
Clean(supportsBuffer);
Clean(peaksGoldenBuffer);
Clean(valesGoldenBuffer);
Clean(resistancesBuffer);
Clean(fractalsUpperBuffer);
Clean(fractalsLowerBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(sarBuffer, true);
ArraySetAsSeries(cHHBuffer, true);
ArraySetAsSeries(cLLBuffer, true);
ArraySetAsSeries(sHHBuffer, true);
ArraySetAsSeries(sLLBuffer, true);
ArraySetAsSeries(mHHBuffer, true);
ArraySetAsSeries(mLLBuffer, true);
ArraySetAsSeries(lHHBuffer, true);
ArraySetAsSeries(lLLBuffer, true);
ArraySetAsSeries(hHHBuffer, true);
ArraySetAsSeries(hLLBuffer, true);
ArraySetAsSeries(peaksBuffer, true);
ArraySetAsSeries(valesBuffer, true);
ArraySetAsSeries(supportsBuffer, true);
ArraySetAsSeries(peaksGoldenBuffer, true);
ArraySetAsSeries(valesGoldenBuffer, true);
ArraySetAsSeries(resistancesBuffer, true);
ArraySetAsSeries(fractalsUpperBuffer, true);
ArraySetAsSeries(fractalsLowerBuffer, true);
//
// Conditions ...
//
isNewPeak = false;
isNewVale = false;
isSarBullish = false;
isSarBearish = false;
isNewPeakOverLast = false;
isNewValeOverLast = false;
isNewPeakUnderLast = false;
isNewValeUnderLast = false;
isSarSwitchedToBullish = false;
isSarSwitchedToBearish = false;
//
// XHK ...
//
// Buffers ...
//
// Clean ...
//
Clean(xhkSMLowBuffer);
Clean(xhkRawLowBuffer);
Clean(xhkSMOpenBuffer);
Clean(xhkSMHighBuffer);
Clean(xhkRawOpenBuffer);
Clean(xhkRawHighBuffer);
Clean(xhkSMCloseBuffer);
Clean(xhkRawCloseBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(xhkSMLowBuffer, true);
ArraySetAsSeries(xhkRawLowBuffer, true);
ArraySetAsSeries(xhkSMOpenBuffer, true);
ArraySetAsSeries(xhkSMHighBuffer, true);
ArraySetAsSeries(xhkRawOpenBuffer, true);
ArraySetAsSeries(xhkRawHighBuffer, true);
ArraySetAsSeries(xhkSMCloseBuffer, true);
ArraySetAsSeries(xhkRawCloseBuffer, true);
//
// Conditions ...
//
isSMHKBullish = false;
isSMHKBearish = false;
isRawHKBullish = false;
isRawHKBearish = false;
isClosedOverSMHK = false;
isClosedUnderSMHK = false;
isClosedOverRawHK = false;
isClosedUnderRawHK = false;
isRawHKClosedOverSMHK = false;
isRawHKClosedUnderSMHK = false;
isSMHKSwitchedToBearish = false;
isSMHKSwitchedToBullish = false;
isRawHKSwitchedToBullish = false;
isRawHKSwitchedToBearish = false;
//
// XMAS ...
//
// Buffers ...
//
// Clean ...
//
Clean(midBuffer);
Clean(upperBuffer);
Clean(lowerBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(midBuffer, true);
ArraySetAsSeries(upperBuffer, true);
ArraySetAsSeries(lowerBuffer, true);
//
// Conditions ...
//
// XATR ...
//
// Buffers ...
//
// Clean ...
//
Clean(rsiBuffer);
Clean(atrBuffer);
Clean(atrUpperBuffer);
Clean(atrLowerBuffer);
Clean(rsiChangeBuffer);
Clean(atrUpperSMBuffer);
Clean(atrLowerSMBuffer);
Clean(rsiChangeSMBuffer);
Clean(priceChangeBuffer);
Clean(priceChangeSMBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(rsiBuffer, true);
ArraySetAsSeries(atrBuffer, true);
ArraySetAsSeries(atrUpperBuffer, true);
ArraySetAsSeries(atrLowerBuffer, true);
ArraySetAsSeries(rsiChangeBuffer, true);
ArraySetAsSeries(atrUpperSMBuffer, true);
ArraySetAsSeries(atrLowerSMBuffer, true);
ArraySetAsSeries(rsiChangeSMBuffer, true);
ArraySetAsSeries(priceChangeBuffer, true);
ArraySetAsSeries(priceChangeSMBuffer, true);
//
// Conditions ...
//
isRsiInRange = false;
isRsiOverSold = false;
isRsiOverRsiSM = false;
isRsiUnderRsiSM = false;
isRsiOverBought = false;
isRsiCrossedOverRsiSM = false;
isRsiCrossedUnderRsiSM = false;
isPriceChangeSMOverRsi = false;
isRsiSMOverPriceChange = false;
isRsiSMUnderPriceChange = false;
isPriceChangeSMUnderRsi = false;
isRsiCrossedOverOverSold = false;
isRsiCrossedUnderOverSold = false;
isRsiCrossedOverOverBought = false;
isRsiCrossedUnderOverBought = false;
isRsiSMCrossedOverPriceChange = false;
isPriceChangeSMCrossedOverRsi = false;
isRsiSMCrossedUnderPriceChange = false;
isPriceChangeSMCrossedUnderRsi = false;
isPriceChangeOverPriceChangeSM = false;
isPriceChangeUnderPriceChangeSM = false;
isPriceChangeCrossedOverPriceChangeSM = false;
isPriceChangeCrossedUnderPriceChangeSM = false;
//
// XSTR ...
//
// Buffers ...
//
// Clean ...
//
Clean(strBuffer);
Clean(strUpBuffer);
Clean(strDownBuffer);
Clean(strPriceBuffer);
Clean(strStateBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(strBuffer, true);
ArraySetAsSeries(strUpBuffer, true);
ArraySetAsSeries(strDownBuffer, true);
ArraySetAsSeries(strPriceBuffer, true);
ArraySetAsSeries(strStateBuffer, true);
//
// Conditions ...
//
isStrBullish = false;
isStrBearish = false;
isStrSwitchedToBullish = false;
isStrSwitchedToBearish = false;
//
// XCHE ...
//
// Buffers ...
//
// Clean ...
//
Clean(le1Buffer);
Clean(se1Buffer);
Clean(le2Buffer);
Clean(se2Buffer);
Clean(le1StartBuffer);
Clean(se1StartBuffer);
Clean(le2StartBuffer);
Clean(se2StartBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(le1Buffer, true);
ArraySetAsSeries(se1Buffer, true);
ArraySetAsSeries(le2Buffer, true);
ArraySetAsSeries(se2Buffer, true);
ArraySetAsSeries(le1StartBuffer, true);
ArraySetAsSeries(se1StartBuffer, true);
ArraySetAsSeries(le2StartBuffer, true);
ArraySetAsSeries(se2StartBuffer, true);
//
// Conditions ...
//
isCheBullish = false;
isCheBearish = false;
isChe1Bullish = false;
isChe1Bearish = false;
isChe2Bullish = false;
isChe2Bearish = false;
isCheSwitchedToBullish = false;
isCheSwitchedToBearish = false;
isChe1SwitchedToBullish = false;
isChe1SwitchedToBearish = false;
isChe2SwitchedToBullish = false;
isChe2SwitchedToBearish = false;
//
// X3MA ...
//
// Buffers ...
//
// Clean ...
//
Clean(x3maMidBuffer);
Clean(x3maFastBuffer);
Clean(x3maSlowBuffer);
Clean(x3maMidStateBuffer);
Clean(x3maFastStateBuffer);
Clean(x3maSlowStateBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(x3maMidBuffer, true);
ArraySetAsSeries(x3maFastBuffer, true);
ArraySetAsSeries(x3maSlowBuffer, true);
ArraySetAsSeries(x3maMidStateBuffer, true);
ArraySetAsSeries(x3maFastStateBuffer, true);
ArraySetAsSeries(x3maSlowStateBuffer, true);
//
// Conditions ...
//
isX3MaMidBullish = false;
isX3MaMidBearish = false;
isX3MaFastBullish = false;
isX3MaFastBearish = false;
isX3MaMidNeutural = false;
isX3MaSlowBullish = false;
isX3MaSlowBearish = false;
isX3MaFastOverMid = false;
isX3MaMidOverSlow = false;
isX3MaFastNeutural = false;
isX3MaSlowNeutural = false;
isX3MaFastUnderMid = false;
isX3MaMidUnderSlow = false;
isX3MaBullishState = false;
isX3MaBearishState = false;
isX3MaNeuturalState = false;
isX3MaBullishOrdered = false;
isX3MaBearishOrdered = false;
isX3MaSwitchedToBullishState = false;
isX3MaSwitchedToBearishState = false;
isX3MaSwitchedToNeuturalState = false;
isX3MaSwitchedToBullishOrdered = false;
isX3MaSwitchedToBearishOrdered = false;
//
// XVWAP ...
//
// Buffers ...
//
// Clean ...
//
Clean(vwapMidBuffer);
Clean(vwapFastBuffer);
Clean(vwapSlowBuffer);
Clean(vwapPriceBuffer);
Clean(vwapVolumeBuffer);
Clean(vwapMidStateBuffer);
Clean(vwapFastStateBuffer);
Clean(vwapSlowStateBuffer);
//
// Set As Series ...
//
ArraySetAsSeries(vwapMidBuffer, true);
ArraySetAsSeries(vwapFastBuffer, true);
ArraySetAsSeries(vwapSlowBuffer, true);
ArraySetAsSeries(vwapPriceBuffer, true);
ArraySetAsSeries(vwapVolumeBuffer, true);
ArraySetAsSeries(vwapMidStateBuffer, true);
ArraySetAsSeries(vwapFastStateBuffer, true);
ArraySetAsSeries(vwapSlowStateBuffer, true);
//
// Conditions ...
//
isVWapMidBullish = false;
isVWapMidBearish = false;
isVWapMidNeutural = false;
isVWapFastBullish = false;
isVWapFastBearish = false;
isVWapSlowBullish = false;
isVWapSlowBearish = false;
isVWapFastOverMid = false;
isVWapMidOverSlow = false;
isVWapFastNeutural = false;
isVWapSlowNeutural = false;
isVWapFastUnderMid = false;
isVWapMidUnderSlow = false;
isVWapBullishState = false;
isVWapBearishState = false;
isVWapNeuturalState = false;
isVWapBullishOrdered = false;
isVWapBearishOrdered = false;
isVWapSwitchedToBullishState = false;
isVWapSwitchedToBearishState = false;
isVWapSwitchedToNeuturalState = false;
isVWapSwitchedToBullishOrdered = false;
isVWapSwitchedToBearishOrdered = false;
+96
View File
@@ -0,0 +1,96 @@
//
// XDON ...
x121Inputs.xdonInputs.showOpen = showAll || false;
x121Inputs.xdonInputs.showClose = showAll || false;
x121Inputs.xdonInputs.showLow = showAll || false;
x121Inputs.xdonInputs.showHigh = showAll || false;
//
// XICH ...
x121Inputs.xichInputs.showTenkanSen = showAll || false;
x121Inputs.xichInputs.showKijunSen = showAll || false;
x121Inputs.xichInputs.showChikouSpan = showAll || false;
x121Inputs.xichInputs.showSenkouSpanA = showAll || false;
x121Inputs.xichInputs.showSenkouSpanB = showAll || false;
x121Inputs.xichInputs.showKumo = showAll || false;
//
// XCC ...
x121Inputs.xccInputs.showCandles = showAll || true;
//
// XPV ...
//
x121Inputs.xpvInputs.showSar = showAll || false;
x121Inputs.xpvInputs.showPeaks = showAll || true;
x121Inputs.xpvInputs.showVales = showAll || true;
x121Inputs.xpvInputs.showSupports = showAll || false;
x121Inputs.xpvInputs.showResistances = showAll || false;
x121Inputs.xpvInputs.showGoldenZones = showAll || true;
//
// XHK ...
//
x121Inputs.xhkInputs.drawRawXHKCandles = showAll || false;
x121Inputs.xhkInputs.drawSmoothedXHKCandles = showAll || false;
//
// XMAS ...
//
x121Inputs.xmasInputs.showUpper = showAll || false;
x121Inputs.xmasInputs.showMid = showAll || false;
x121Inputs.xmasInputs.showLower = showAll || false;
//
// XATR ...
x121Inputs.xatrInputs.showATRUpper = showAll || false;
x121Inputs.xatrInputs.showATRLower = showAll || false;
//
// XSTR ...
x121Inputs.xstrInputs.showStr = showAll || true;
x121Inputs.xstrInputs.showStrUpper = showAll || false;
x121Inputs.xstrInputs.showStrLower = showAll || false;
//
// XCHE ...
x121Inputs.xcheInputs.showLE1 = showAll || false;
x121Inputs.xcheInputs.showLE2 = showAll || false;
x121Inputs.xcheInputs.showSE1 = showAll || false;
x121Inputs.xcheInputs.showSE2 = showAll || false;
//
// XVWAP ...
x121Inputs.xvwapInputs.showVWapFast = showAll || false;
x121Inputs.xvwapInputs.showVWapMedium = showAll || false;
x121Inputs.xvwapInputs.showVWapSlow = showAll || false;
//
// X3MA ...
x121Inputs.x3maInputs.showX3MaFast = showAll || true;
x121Inputs.x3maInputs.showX3MaMid = showAll || false;
x121Inputs.x3maInputs.showX3MaSlow = showAll || false;
//
//
// x121Inputs.xcheInputs.cheLength = 14;
// x121Inputs.xcheInputs.cheLoopback = 7;
// x121Inputs.xcheInputs.cheMultiplier1 = 1.5;
// x121Inputs.xcheInputs.cheMultiplier2 = 2;
//
// x121Inputs.xstrInputs.strLength = 14;
// x121Inputs.xstrInputs.strMultiplier = 1.5;
//
// x121Inputs.xccInputs.upColor = clrLime;
// x121Inputs.xccInputs.downColor = clrRed;
// x121Inputs.xccInputs.lineColor = CLR_NONE;
// x121Inputs.xccInputs.bearishColor = clrRed;
// x121Inputs.xccInputs.bullishColor = clrLime;
// x121Inputs.xccInputs.volumesColor = clrGreen;
File diff suppressed because it is too large Load Diff
+580
View File
@@ -0,0 +1,580 @@
//
bool DetectNearestTenKijCross(
XOHCL &bar,
ENUM_X_DIRECTION &dir,
int barIndex = 0,
int maxAllowedBars = 20 //
)
{
//
bool result = false;
//
bar.Clean();
dir = X_DIRECTION_NONE;
barIndex = NormalizeInt(barIndex, 0);
maxAllowedBars = NormalizeInt(maxAllowedBars, 20);
//
// Looping Through LoopBack Period ...
// for Detecting Result ...
for (int i = barIndex; i < barIndex + maxAllowedBars; i++)
{
//
XOHCL iBar;
result = iBar.Init(
GetSymbol(),
GetPeriod(),
i //
);
if (!result)
{
//
iBar.Clean();
break;
}
//
double iTSen = mX121Helper.xichHelper.GetTenkanSen(i);
double iTSenP = mX121Helper.xichHelper.GetTenkanSen(i + 1);
//
double iKSen = mX121Helper.xichHelper.GetKijunSen(i);
double iKSenP = mX121Helper.xichHelper.GetKijunSen(i + 1);
//
bool isTSenOverKSen = iTSen > iKSen;
bool isTSenOverKSenP = iTSenP > iKSenP;
//
bool isTSenUnderKSen = iTSen < iKSen;
bool isTSenUnderKSenP = iTSenP < iKSenP;
//
//
bool isTSenCrossedOverKSen = isTSenOverKSen &&
!isTSenOverKSenP;
//
bool isTSenCrossedUnderKSen = isTSenUnderKSen &&
!isTSenUnderKSenP;
//
result = isTSenCrossedOverKSen ||
isTSenCrossedUnderKSen;
if (result)
{
//
bar = iBar;
//
dir = isTSenCrossedOverKSen
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
iBar.Clean();
break;
}
//
iBar.Clean();
}
//
return result;
}
//
bool DetectNearestVolumeSwitched(
XOHCL &bar,
ENUM_X_DIRECTION &dir,
int barIndex = 0,
int maxAllowedBars = 20 //
)
{
//
bool result = false;
//
bar.Clean();
dir = X_DIRECTION_NONE;
barIndex = NormalizeInt(barIndex, 0);
maxAllowedBars = NormalizeInt(maxAllowedBars, 20);
//
// Looping Through LoopBack Period ...
// for Detecting Result ...
for (int i = barIndex; i < barIndex + maxAllowedBars; i++)
{
//
XOHCL iBar;
result = iBar.Init(
GetSymbol(),
GetPeriod(),
i //
);
if (!result)
{
//
iBar.Clean();
break;
}
//
double iBullVMa = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i);
double iBullVMaP = mX121Helper.xvolumeHelper.GetBullishVolumeMa(i + 1);
//
double iBearVMa = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i);
double iBearVMaP = mX121Helper.xvolumeHelper.GetBearishVolumeMa(i + 1);
//
bool isBullVMaOverBearVMa = iBullVMa > iBearVMa;
bool isBullVMaOverBearVMaP = iBullVMaP > iBearVMaP;
bool isCrossOver = isBullVMaOverBearVMa &&
!isBullVMaOverBearVMaP;
//
bool isBullVMaUnderBearVMa = iBullVMa < iBearVMa;
bool isBullVMaUnderBearVMaP = iBullVMaP < iBearVMaP;
bool isCrossUnder = isBullVMaUnderBearVMa &&
!isBullVMaUnderBearVMaP;
//
result = isCrossOver ||
isCrossUnder;
if (result)
{
//
bar = iBar;
//
dir = isCrossOver
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
iBar.Clean();
break;
}
//
iBar.Clean();
}
//
return result;
}
//
bool DetectNearestDeltaSwitched(
XOHCL &bar,
ENUM_X_DIRECTION &dir,
int barIndex = 0,
int maxAllowedBars = 20 //
)
{
//
bool result = false;
//
bar.Clean();
dir = X_DIRECTION_NONE;
barIndex = NormalizeInt(barIndex, 0);
maxAllowedBars = NormalizeInt(maxAllowedBars, 20);
//
// Looping Through LoopBack Period ...
// for Detecting Result ...
for (int i = barIndex; i < barIndex + maxAllowedBars; i++)
{
//
XOHCL iBar;
result = iBar.Init(
GetSymbol(),
GetPeriod(),
i //
);
if (!result)
{
//
iBar.Clean();
break;
}
//
double iDelta = mX121Helper.xdeltaHelper.GetDelta(i);
double iDeltaP = mX121Helper.xdeltaHelper.GetDelta(i + 1);
//
double iDeltaMa = mX121Helper.xdeltaHelper.GetDeltaMa(i);
double iDeltaMaP = mX121Helper.xdeltaHelper.GetDeltaMa(i + 1);
//
bool isDeltaOverMa = iDelta > iDeltaMa;
bool isDeltaOverMaP = iDeltaP > iDeltaMaP;
//
bool isDeltaUnderMa = iDelta < iDeltaMa;
bool isDeltaUnderMaP = iDeltaP < iDeltaMaP;
//
bool isCrossOver = isDeltaOverMa &&
!isDeltaOverMaP;
//
bool isCrossUnder = isDeltaUnderMa &&
!isDeltaUnderMaP;
//
result = isCrossOver ||
isCrossUnder;
if (result)
{
//
bar = iBar;
//
dir = isCrossOver
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
iBar.Clean();
break;
}
//
iBar.Clean();
}
//
return result;
}
////////////////////////////////////////////////////////////////////////////
//
// Activated Boxes ...
bool HasActivatedBoxConditions(
ENUM_X_CYCLES cycle,
XSignalBox &box,
ENUM_X_DIRECTION &dir,
XSignalBox &waitingBoxes[],
X121SMCStrategySignalProviderData &provider,
int barIndex = 0 //
)
{
//
bool result = false;
//
box.Clean();
dir = X_DIRECTION_NONE;
//
// Checking Waiting Baoxes Exists ...
result = HasChild(waitingBoxes);
if (!result)
{
return result;
}
//
// Fil Selected Data ...
XPOIState cState;
X121Conditions cXConditions;
XPOIStateEvents cStateEvents;
XC121SMCCycleHelper *cHelper;
X121SMCCycleConditions cConditions;
result = provider.SelectCycle(
cycle,
cState,
cStateEvents,
cXConditions,
cHelper,
cConditions //
);
if (!result)
{
//
cState.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
cStateEvents.Clean();
//
return result;
}
Parse(cXConditions);
//
// Normalize Args ...
//
if (barIndex < 0)
{
barIndex = 0;
}
//
int idx = -1;
int count = 0;
bool has = false;
//
int zIDX = barIndex;
int cIDX = zIDX + 1;
int pIDX = cIDX + 1;
int ppIDX = pIDX + 1;
//
bool isBullish = false;
bool isBearish = false;
//
XOHCL zBar;
XOHCL cBar;
XOHCL pBar;
//
// Initial Bars ...
result = zBar.Init(
cState.symbol,
cState.period,
barIndex //
);
result =
result &&
zBar.GetPreviousBar(cBar);
result =
result &&
cBar.GetPreviousBar(pBar);
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
cState.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
//
return result;
}
//
// Checking Bar Based on Positions State ...
ENUM_X_DIRECTION iBarPosDir;
bool isBarValidForDir = cHelper
.mBarAnalyser
.IsValidForPosition(
cBar,
iBarPosDir //
);
bool isBarValidForBullish =
isBarValidForDir &&
IsBullish(iBarPosDir);
bool isBarValidForBearish =
isBarValidForDir &&
IsBearish(iBarPosDir);
//
// Extract Selected Boxes ...
XBoxZone selectedBox;
XSignalBox iSignalBox;
count = ArraySize(waitingBoxes);
has = IsValidSize(count);
if (has)
{
//
for (int i = 0; i < count; i++)
{
//
XSignalBox iBox = waitingBoxes[i];
//
bool isBullish = iBox.ob.IsBullish();
//
has = cBar.low < iBox.sharp.upper &&
cBar.low > iBox.sharp.lower &&
cBar.high > iBox.sharp.lower &&
cBar.high < iBox.sharp.upper;
//
// Force Using OB ...
if (has)
{
//
iSignalBox = iBox;
if (!selectedBox.IsValid())
{
selectedBox = iBox.ob;
}
iBox.Clean();
break;
}
//
iBox.Clean();
}
}
result =
iSignalBox.IsValid() &&
selectedBox.IsValid();
if (!result)
{
//
zBar.Clean();
cBar.Clean();
pBar.Clean();
cState.Clean();
iSignalBox.Clean();
selectedBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cXConditions.Clean();
//
return result;
}
//
bool hasSignalBox = iSignalBox.IsValid();
bool isSignalBoxBullish = IsBullish(iSignalBox.ob.dir);
//
// Checking Other Conditions ...
//
// XVWAP ...
//
bool isVWapSlopeBullish =
cXConditions.isVwapFastSlopeBullish &&
cXConditions.isVwapMidSlopeBullish &&
cXConditions.isVwapSlowSlopeBullish;
//
bool isVWapSlopeBearish =
cXConditions.isVwapFastSlopeBearish &&
cXConditions.isVwapMidSlopeBearish &&
cXConditions.isVwapSlowSlopeBearish;
//
bool isVWapBullishCondition =
(cXConditions.isVWapBullishOrdered &&
cXConditions.isVWapSwitchedToBullishState) ||
(cXConditions.isVWapBullishState &&
cXConditions.isVWapSwitchedToBullishOrdered);
//
bool isVWapBearishCondition =
(cXConditions.isVWapBearishOrdered &&
cXConditions.isVWapSwitchedToBearishState) ||
(cXConditions.isVWapBearishState &&
cXConditions.isVWapSwitchedToBearishOrdered);
//
// Bullish Conditions ...
isBullish =
//
// Base Condition ...
(
//
hasSignalBox &&
isSignalBoxBullish &&
isVWapSlopeBullish &&
isBarValidForBullish &&
isVWapBullishCondition
//
)
//
;
//
// Bearish Conditions ...
isBearish =
//
// Base Condition ...
(
//
hasSignalBox &&
isVWapSlopeBearish &&
!isSignalBoxBullish &&
isBarValidForBearish &&
isVWapBearishCondition
//
)
//
;
//
// Filling Requirements ...
result =
isBullish ||
isBearish;
if (result)
{
//
dir =
isBullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box = iSignalBox;
box.UpdateTo(TimeCurrent());
//
// Provide TP/SL ...
//
box.sl = isBullish
? cXConditions.vwapMin
: cXConditions.vwapMax;
//
box.tp = isBullish
? box.sharp.upper
: box.sharp.lower;
}
//
// Check All Conditions ...
result =
box.IsValid() &&
HasDirection(dir) &&
(isBullish ||
isBearish);
//
// Cleanup Resources ...
zBar.Clean();
cBar.Clean();
pBar.Clean();
cState.Clean();
iSignalBox.Clean();
selectedBox.Clean();
ZeroMemory(cHelper);
cConditions.Clean();
cStateEvents.Clean();
cXConditions.Clean();
//
return result;
}
/////////////////////////////////////////////////////////////////////////////////////
File diff suppressed because it is too large Load Diff
+393
View File
@@ -0,0 +1,393 @@
// //
// // XICH ...
// X121XICHConditions xichConditions;
// result = GetICHConditions(
// xichConditions,
// barIndex,
// loopback //
// );
// if (!result)
// {
// //
// xpvConditions.Clean();
// xhkConditions.Clean();
// xichConditions.Clean();
// //
// return result;
// }
// //
// // XDON ...
// X121XDONConditions xdonConditions;
// result = GetDONConditions(
// xdonConditions,
// barIndex,
// loopback //
// );
// if (!result)
// {
// //
// xpvConditions.Clean();
// xhkConditions.Clean();
// xichConditions.Clean();
// xmasConditions.Clean();
// xatrConditions.Clean();
// xstrConditions.Clean();
// xcheConditions.Clean();
// xdonConditions.Clean();
// //
// return result;
// }
// //
// // XDELTA ...
// X121XDELTAConditions xdeltaConditions;
// result = GetDELTAConditions(
// xdeltaConditions,
// barIndex,
// loopback //
// );
// if (!result)
// {
// //
// xpvConditions.Clean();
// xhkConditions.Clean();
// xichConditions.Clean();
// xmasConditions.Clean();
// xatrConditions.Clean();
// xstrConditions.Clean();
// xcheConditions.Clean();
// xdonConditions.Clean();
// x3maConditions.Clean();
// xvwapConditions.Clean();
// xdeltaConditions.Clean();
// //
// return result;
// }
// //
// // XVOLUME ...
// X121XVOLUMEConditions xvolumeConditions;
// result = GetVOLUMEConditions(
// xvolumeConditions,
// barIndex,
// loopback //
// );
// if (!result)
// {
// //
// xpvConditions.Clean();
// xhkConditions.Clean();
// xichConditions.Clean();
// xmasConditions.Clean();
// xatrConditions.Clean();
// xstrConditions.Clean();
// xcheConditions.Clean();
// xdonConditions.Clean();
// x3maConditions.Clean();
// xvwapConditions.Clean();
// xdeltaConditions.Clean();
// xvolumeConditions.Clean();
// //
// return result;
// }
//
// xichConditions.Clean();
// xdonConditions.Clean();
// xdeltaConditions.Clean();
// xvolumeConditions.Clean();
// //
// // XICH ...
// bool GetICHConditions(
// X121XICHConditions &conditions, //
// int barIndex = 0, //
// int loopback = 5 //
// )
// {
// //
// bool result = false;
// //
// result = xichHelper.GetConditions(
// conditions,
// barIndex,
// loopback //
// );
// //
// return result;
// }
// //
// // XDON ...
// bool GetDONConditions(
// X121XDONConditions &conditions, //
// int barIndex = 0, //
// int loopback = 5 //
// )
// {
// //
// bool result = false;
// //
// result = xdonHelper.GetConditions(
// conditions,
// barIndex,
// loopback //
// );
// //
// return result;
// }
// //
// // XDELTA ...
// bool GetDELTAConditions(
// X121XDELTAConditions &conditions, //
// int barIndex = 0, //
// int loopback = 5 //
// )
// {
// //
// bool result = false;
// //
// result = xdeltaHelper.GetConditions(
// conditions,
// barIndex,
// loopback //
// );
// //
// return result;
// }
// //
// // XVOLUME ...
// bool GetVOLUMEConditions(
// X121XVOLUMEConditions &conditions, //
// int barIndex = 0, //
// int loopback = 5 //
// )
// {
// //
// bool result = false;
// //
// result = xvolumeHelper.GetConditions(
// conditions,
// barIndex,
// loopback //
// );
// //
// return result;
// }
//
// xichInputs = inputs.xichInputs;
// xdonInputs = inputs.xdonInputs;
// xdeltaInputs = inputs.xdeltaInputs;
// xvolumeInputs = inputs.xvolumeInputs;
// //
// // XICH ...
// xichHelper = new XCX121XICHHelper();
// result = xichHelper.Init(
// symbol,
// period,
// xichInputs //
// );
// if (!result)
// {
// //
// ZeroMemory(xccHelper);
// ZeroMemory(xpvHelper);
// ZeroMemory(xhkHelper);
// ZeroMemory(xmasHelper);
// ZeroMemory(xatrHelper);
// ZeroMemory(xstrHelper);
// ZeroMemory(xcheHelper);
// ZeroMemory(x3maHelper);
// ZeroMemory(xvwapHelper);
// //
// // ZeroMemory(xichHelper);
// // ZeroMemory(xdonHelper);
// // ZeroMemory(xdeltaHelper);
// // ZeroMemory(xvolumeHelper);
// //
// return result;
// }
// //
// // XDON ...
// xdonHelper = new XCX121XDONHelper();
// result = xdonHelper.Init(
// symbol,
// period,
// xdonInputs //
// );
// if (!result)
// {
// //
// ZeroMemory(xccHelper);
// ZeroMemory(xpvHelper);
// ZeroMemory(xhkHelper);
// ZeroMemory(xmasHelper);
// ZeroMemory(xatrHelper);
// ZeroMemory(xstrHelper);
// ZeroMemory(xcheHelper);
// ZeroMemory(x3maHelper);
// ZeroMemory(xvwapHelper);
// //
// // ZeroMemory(xichHelper);
// // ZeroMemory(xdonHelper);
// // ZeroMemory(xdeltaHelper);
// // ZeroMemory(xvolumeHelper);
// //
// return result;
// }
// //
// // XDELTA ...
// xdeltaHelper = new XCX121XDELTAHelper();
// result = xdeltaHelper.Init(
// symbol,
// period,
// xdeltaInputs //
// );
// if (!result)
// {
// //
// ZeroMemory(xccHelper);
// ZeroMemory(xpvHelper);
// ZeroMemory(xhkHelper);
// ZeroMemory(xmasHelper);
// ZeroMemory(xatrHelper);
// ZeroMemory(xstrHelper);
// ZeroMemory(xcheHelper);
// ZeroMemory(x3maHelper);
// ZeroMemory(xvwapHelper);
// //
// // ZeroMemory(xichHelper);
// // ZeroMemory(xdonHelper);
// // ZeroMemory(xdeltaHelper);
// // ZeroMemory(xvolumeHelper);
// //
// return result;
// }
// //
// // XVOLUME ...
// xvolumeHelper = new XCX121XVOLUMEHelper();
// result = xvolumeHelper.Init(
// symbol,
// period,
// xvolumeInputs //
// );
// if (!result)
// {
// //
// ZeroMemory(xccHelper);
// ZeroMemory(xpvHelper);
// ZeroMemory(xhkHelper);
// ZeroMemory(xmasHelper);
// ZeroMemory(xatrHelper);
// ZeroMemory(xstrHelper);
// ZeroMemory(xcheHelper);
// ZeroMemory(x3maHelper);
// ZeroMemory(xvwapHelper);
// //
// // ZeroMemory(xichHelper);
// // ZeroMemory(xdonHelper);
// // ZeroMemory(xdeltaHelper);
// // ZeroMemory(xvolumeHelper);
// //
// return result;
// }
//
// ZeroMemory(xichHelper);
// ZeroMemory(xdonHelper);
// ZeroMemory(xdeltaHelper);
// ZeroMemory(xvolumeHelper);
//
// XCX121XICHHelper *xichHelper;
// XCX121XDONHelper *xdonHelper;
// XCX121XDELTAHelper *xdeltaHelper;
// XCX121XVOLUMEHelper *xvolumeHelper;
//
// int xdonMax = xdonInputs.Max();
// int xichMax = xichInputs.Max();
// int xdeltaMax = xdeltaInputs.Max();
// int xvolumeMax = xvolumeInputs.Max();
//
// result = MathMax(result, xdonMax);
// result = MathMax(result, xichMax);
// result = MathMax(result, xdeltaMax);
// result = MathMax(result, xvolumeMax);
// &&
// xichInputs.IsValid() &&
// xdonInputs.IsValid() &&
// xdeltaInputs.IsValid() &&
// xvolumeInputs.IsValid()
//
//
// xichInputs.Default();
// xdonInputs.Default();
// xdeltaInputs.Default();
// xvolumeInputs.Default();
//
// xichInputs.Clean();
// xdonInputs.Clean();
// xdeltaInputs.Clean();
// xvolumeInputs.Clean();
//
// xichInputs.Clean();
// xdonInputs.Clean();
// xdeltaInputs.Clean();
// xvolumeInputs.Clean();
//
// delete xichHelper;
// delete xdonHelper;
// delete xdeltaHelper;
// delete xvolumeHelper;
//
// ZeroMemory(xichHelper);
// ZeroMemory(xdonHelper);
// ZeroMemory(xdeltaHelper);
// ZeroMemory(xvolumeHelper);