This commit is contained in:
2025-03-09 07:04:04 +03:30
parent d8a989d3dd
commit a81c09e2a5
5 changed files with 850 additions and 291 deletions
@@ -0,0 +1,187 @@
//
// Senario 3:
// ----------
bool useSenario3 = false;
bool isSenario3Happend = false;
bool isSenario3Bullish = false;
bool isSenario3Bearish = false;
if (useSenario3)
{
//
// Senario 3 Bullish Conditions ...
isSenario3Bullish = false;
//
// Senario 3 Bearish Conditions ...
isSenario3Bearish = false;
//
// Filling Requirements using Senario 3 ...
isSenario3Happend =
isSenario3Bullish ||
isSenario3Bearish;
if (isSenario3Happend)
{
//
dir =
isSenario3Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario3Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
+2 -4
View File
@@ -52,7 +52,6 @@ input bool eaUseMaxAllowedSignalsPerSymbol = true; // Use Max Allowed S
input double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal
input int eaDelaysBetweenTwoSignalsInBar = 12; // 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 ...
@@ -76,13 +75,13 @@ input double eaDynamicVolumeStep = 0.01; // Increa
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 2; // Max Allowed SL for Pause Signalling Per Symbol
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 10800; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
input int eaPauseSignallingAfterReachesMaxAllowedSLInSecconds = 86400; // Pause Signalling Per Symbol afte Max Allowed SL Reached In Seconds
//
// Protection ...
input group "Protection";
input bool eaAllowHedging = true; // Allow Hedge Positions
input int eaMinOpenTradesFroHedging = 2; // Minimum Open Positions for Hedging
input int eaMinOpenTradesFroHedging = 4; // Minimum Open Positions for Hedging
input double eaHedgingMinVolumeStep = 0.01; // Minimum Volume Step for Hedging
input double eaHedgeingMinRequiredProfitPerVolumeStep = 1.0; // Minimum Required Profit Per Volume Step for Hedging
@@ -169,7 +168,6 @@ int OnInit()
eaExpert.LastPositionProfitForAcceptNextInPoint(eaLastPositionProfitForAcceptNextInPoint);
eaExpert.DelaysBetweenTwoSignalsInBar(eaDelaysBetweenTwoSignalsInBar);
eaExpert.MaxAllowedSpread(eaMaxAllowedSpread);
eaExpert.MinRequiredVerificationForSpreadPass(eaMinRequiredVerificationForSpreadPass);
//
// Trade ...
@@ -154,26 +154,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
mR2R = value;
}
/**
* Get Max Allowed Spread ...
*
* @return ( double )
*/
double MaxAllowedSpread()
{
return mMaxAllowedSpread;
}
/**
* Set Max Allowed Spread ...
*
* @param value: Double ...
*/
void MaxAllowedSpread(double value)
{
mMaxAllowedSpread = value;
}
/**
* Get Long Signalling State ...
*
@@ -572,9 +552,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
double mR2R; // Risk/Rewar Ratio ...
double mVolume; // Static Volume Per Trades ...
//
double mMaxAllowedSpread; // Max Allowed Spread ...
//
// On X121 Signal Recieved Event Handler(s) ...
TOnX121SMCSignal mSignalEventHandlers[];
+1 -34
View File
@@ -295,36 +295,6 @@ class XC121SMCExpert : public XCBaseExpert
ReConfigure();
}
/**
* Get Minimum Spread Verification for Signalling ...
* 0 => Ignore ...
*
* @return ( int )
*/
int MinRequiredVerificationForSpreadPass()
{
return mMinRequiredVerificationForSpreadPass;
}
/**
* Set Minimum Spread Verification for Signalling ...
*
* @param value: Integer ...
* 0 => Ignore ...
*/
void MinRequiredVerificationForSpreadPass(int value)
{
//
if (value < 0)
{
value = 0;
}
//
mMinRequiredVerificationForSpreadPass = value;
ReConfigure();
}
//
// Trade ...
@@ -1242,6 +1212,7 @@ class XC121SMCExpert : public XCBaseExpert
mTradeHandler.SaveTrades(false);
mTradeHandler.SaveSignals(false);
mTradeHandler.SaveConditions(false);
mTradeHandler.MaxAllowedSpread(MaxAllowedSpread());
//
ReConfigureTradeHandler();
@@ -1802,9 +1773,6 @@ class XC121SMCExpert : public XCBaseExpert
strategy.R2R(R2R());
strategy.AllowLong(AllowLong());
strategy.AllowShort(AllowShort());
strategy.MaxAllowedSpread(20);
// strategy.MaxAllowedSaveTicks(150);
// strategy.MinRequiredTicksForSpreadPass(100);
//
if (Disabled())
@@ -1920,7 +1888,6 @@ class XC121SMCExpert : public XCBaseExpert
double mLastPositionProfitForAcceptNextInPoint; // Last Position Profit In Points for Accept new Signal ...
int mDelaysBetweenTwoSignalsInBar; // Delay between two Signals in Bars ...
double mMaxAllowedSpread; // Max Allowed Spread for Signalling ...
int mMinRequiredVerificationForSpreadPass; // Minimum Spread Verification for Signalling ...
//
// Trade ...
+660 -230
View File
@@ -953,262 +953,688 @@ struct X121SMCStrategyXWZWorkingZone
//
// Senario 1:
// ----------
//
// Senario 1 Bullish Conditions ...
bool isSenario1Bullish =
//
// X3Ma / XVwap Switched To Bulish ...
(
//
// X3Ma Switched To Bulish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedOverMid &&
decisionParser.isX3MaBullishStateUnderValesGoldenZone)
//
)
//
||
//
// XVWap Switched To Bulish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedOverMid &&
decisionParser.isVWapBullishStateUnderValesGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBullish &&
//
// XCHE ...
provider.decisionXConditions.isCheBullish &&
provider.decisionXConditions.le1Buffer[cIDX] < cBar.low &&
provider.decisionXConditions.le2Buffer[cIDX] < cBar.low
//
)
//
;
//
// Senario 1 Bearish Conditions ...
bool isSenario1Bearish =
//
// X3Ma / XVwap Switched To Bearish ...
(
//
// X3Ma Switched To Bearish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedUnderMid &&
decisionParser.isX3MaBearishStateOverPeaksGoldenZone)
//
)
//
||
//
// XVWap Switched To Bearish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedUnderMid &&
decisionParser.isVWapBearishStateOverPeaksGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBearish &&
//
// XCHE ...
provider.decisionXConditions.isCheBearish &&
provider.decisionXConditions.se1Buffer[cIDX] > cBar.high &&
provider.decisionXConditions.se2Buffer[cIDX] > cBar.high
//
)
//
;
//
// Filling Requirements using Senario 1 ...
bool isSenari1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenari1Happend)
bool useSenario1 = false;
bool isSenario1Happend = false;
bool isSenario1Bullish = false;
bool isSenario1Bearish = false;
if (useSenario1)
{
//
dir =
isSenario1Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
// Senario 1 Bullish Conditions ...
isSenario1Bullish =
//
// X3Ma / XVwap Switched To Bulish ...
(
//
// X3Ma Switched To Bulish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedOverMid &&
decisionParser.isX3MaBullishStateUnderValesGoldenZone)
//
)
//
||
//
// XVWap Switched To Bulish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedOverMid &&
decisionParser.isVWapBullishStateUnderValesGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBullish &&
//
// XCHE ...
provider.decisionXConditions.isCheBullish &&
provider.decisionXConditions.le1Buffer[cIDX] < cBar.low &&
provider.decisionXConditions.le2Buffer[cIDX] < cBar.low
//
)
//
;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
// Senario 1 Bearish Conditions ...
isSenario1Bearish =
//
// X3Ma / XVwap Switched To Bearish ...
(
//
// X3Ma Switched To Bearish ...
(
//
(provider.decisionXConditions.isX3MaFastCrossedUnderMid &&
decisionParser.isX3MaBearishStateOverPeaksGoldenZone)
//
)
//
||
//
// XVWap Switched To Bearish ...
(
//
(provider.decisionXConditions.isVWapFastCrossedUnderMid &&
decisionParser.isVWapBearishStateOverPeaksGoldenZone)
//
)
//
)
//
&&
//
// Checking other Conditions ...
(
//
// XSTR ...
provider.decisionXConditions.isStrBearish &&
//
// XCHE ...
provider.decisionXConditions.isCheBearish &&
provider.decisionXConditions.se1Buffer[cIDX] > cBar.high &&
provider.decisionXConditions.se2Buffer[cIDX] > cBar.high
//
)
//
;
//
int fromIDX = -1;
if (isSenario1Bullish)
// Filling Requirements using Senario 1 ...
isSenario1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenario1Happend)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
dir =
isSenario1Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.lower = vale;
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
int fromIDX = -1;
if (isSenario1Bullish)
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
else
{
//
fromIDX = lowerValeIDX;
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
//
if (IsValidIndex(fromIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
// Senario 2:
// ----------
bool useSenario2 = true;
bool isSenario2Happend = false;
bool isSenario2Bullish = false;
bool isSenario2Bearish = false;
if (useSenario2)
{
//
if (IsValidIndex(fromIDX))
{
// Senario 2 Bullish Conditions ...
isSenario2Bullish =
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
// XSMHK ...
(
//
(decisionParser.isRawHKBullishUnderValesGoldenZone &&
decisionParser.isSMHKSwitchedToBullishUnderValesGoldenZone)
//
||
//
(decisionParser.isSMHKBullishUnderValesGoldenZone &&
decisionParser.isRawHKSwitchedToBullishUnderValesGoldenZone)
//
)
//
&&
//
// Other Conditions ...
(
//
provider.decisionXConditions.isSarBullish &&
provider.decisionXConditions.isStrBullish
//
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
// Senario 2 Bearish Conditions ...
isSenario2Bearish =
//
// XSMHK ...
(
//
(decisionParser.isRawHKBearishOverPeaksGoldenZone &&
decisionParser.isSMHKSwitchedToBearishOverPeaksGoldenZone)
//
||
//
(decisionParser.isSMHKBearishOverPeaksGoldenZone &&
decisionParser.isRawHKSwitchedToBearishOverPeaksGoldenZone)
//
)
//
&&
//
// Other Conditions ...
(
//
provider.decisionXConditions.isSarBearish &&
provider.decisionXConditions.isStrBearish
//
);
//
// Filling Requirements using Senario 2 ...
isSenario2Happend =
isSenario2Bullish ||
isSenario2Bearish;
if (isSenario2Happend)
{
//
dir =
isSenario2Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario2Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
// Senario 3:
// ----------
bool useSenario3 = false;
bool isSenario3Happend = false;
bool isSenario3Bullish = false;
bool isSenario3Bearish = false;
if (useSenario3)
{
//
// Senario 3 Bullish Conditions ...
isSenario3Bullish = false;
//
// Senario 3 Bearish Conditions ...
isSenario3Bearish = false;
//
// Filling Requirements using Senario 3 ...
isSenario3Happend =
isSenario3Bullish ||
isSenario3Bearish;
if (isSenario3Happend)
{
//
dir =
isSenario3Bullish
? X_DIRECTION_BULLISH
: X_DIRECTION_BEARISH;
//
box.dir = dir;
box.to = TimeCurrent();
box.symbol = provider
.decisionXConditions
.symbol;
box.period = provider
.decisionXConditions
.period;
//
int fromIDX = -1;
if (isSenario3Bullish)
{
//
double vale = provider
.decisionXConditions
.valesBuffer[cIDX];
//
box.lower = vale;
//
box.upper = provider
.decisionXConditions
.valesGoldenBuffer[cIDX];
//
int lowerValeIDX = -1;
double lowerVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerVale(
lowerValeIDX,
vale,
cBar.Index() //
);
//
int higherValeIDX = -1;
double higherVale = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherVale(
higherValeIDX,
vale,
cBar.Index() //
);
//
if (IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX =
lowerValeIDX < higherValeIDX
? lowerValeIDX
: higherValeIDX;
}
else if (IsValidIndex(lowerValeIDX) &&
!IsValidIndex(higherValeIDX))
{
//
fromIDX = lowerValeIDX;
}
else if (!IsValidIndex(lowerValeIDX) &&
IsValidIndex(higherValeIDX))
{
//
fromIDX = higherValeIDX;
}
}
else
{
//
double peak = provider
.decisionXConditions
.peaksBuffer[cIDX];
//
box.upper = peak;
//
box.lower = provider
.decisionXConditions
.peaksGoldenBuffer[cIDX];
//
int lowerPeakIDX = -1;
double lowerPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetLowerPeak(
lowerPeakIDX,
peak,
cBar.Index() //
);
//
int higherPeakIDX = -1;
double higherPeak = provider
.decisionCycleHelper
.mX121Helper
.xpvHelper
.GetHigherPeak(
higherPeakIDX,
peak,
cBar.Index() //
);
//
if (IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX =
lowerPeakIDX < higherPeakIDX
? lowerPeakIDX
: higherPeakIDX;
}
else if (IsValidIndex(lowerPeakIDX) &&
!IsValidIndex(higherPeakIDX))
{
//
fromIDX = lowerPeakIDX;
}
else if (!IsValidIndex(lowerPeakIDX) &&
IsValidIndex(higherPeakIDX))
{
//
fromIDX = higherPeakIDX;
}
}
//
if (IsValidIndex(fromIDX))
{
//
box.from = iTime(
zBar.symbol,
zBar.period,
fromIDX //
);
}
else
{
box.from = pBar.time;
}
//
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
}
}
//
@@ -1217,14 +1643,18 @@ struct X121SMCStrategyXWZWorkingZone
//
isBullish =
//
isSenario1Bullish
isSenario1Bullish ||
isSenario2Bullish ||
isSenario3Bullish
//
;
//
isBearish =
//
isSenario1Bearish
isSenario1Bearish ||
isSenario2Bearish ||
isSenario3Bearish
//
;