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 double eaLastPositionProfitForAcceptNextInPoint = 30; // Last Position Profit In Points for Accept new Signal
input int eaDelaysBetweenTwoSignalsInBar = 12; // Delay between two Signals in Bars input int eaDelaysBetweenTwoSignalsInBar = 12; // Delay between two Signals in Bars
input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling input double eaMaxAllowedSpread = 25; // Max Allowed Spread for Signalling
input int eaMinRequiredVerificationForSpreadPass = 20; // Minimum Spread Verification for Signalling
// //
// Trade ... // Trade ...
@@ -76,13 +75,13 @@ input double eaDynamicVolumeStep = 0.01; // Increa
input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume input double eaDynamicVolumeBalanceFactor = 200; // Balance Factor for Generate Dynamic Volume
input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades input double eaMaxAllowedDrawdownToOpenTrades = 3; // Max Allowed Drawdown for Open Trades
input int eaMaxAllowedSLToPauseSignallingPerSymbol = 2; // Max Allowed SL for Pause Signalling Per Symbol 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 ... // Protection ...
input group "Protection"; input group "Protection";
input bool eaAllowHedging = true; // Allow Hedge Positions 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 eaHedgingMinVolumeStep = 0.01; // Minimum Volume Step for Hedging
input double eaHedgeingMinRequiredProfitPerVolumeStep = 1.0; // Minimum Required Profit Per 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.LastPositionProfitForAcceptNextInPoint(eaLastPositionProfitForAcceptNextInPoint);
eaExpert.DelaysBetweenTwoSignalsInBar(eaDelaysBetweenTwoSignalsInBar); eaExpert.DelaysBetweenTwoSignalsInBar(eaDelaysBetweenTwoSignalsInBar);
eaExpert.MaxAllowedSpread(eaMaxAllowedSpread); eaExpert.MaxAllowedSpread(eaMaxAllowedSpread);
eaExpert.MinRequiredVerificationForSpreadPass(eaMinRequiredVerificationForSpreadPass);
// //
// Trade ... // Trade ...
@@ -154,26 +154,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
mR2R = value; 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 ... * Get Long Signalling State ...
* *
@@ -572,9 +552,6 @@ class XCX121SMCBaseStrategy : public XCBaseAlert
double mR2R; // Risk/Rewar Ratio ... double mR2R; // Risk/Rewar Ratio ...
double mVolume; // Static Volume Per Trades ... double mVolume; // Static Volume Per Trades ...
//
double mMaxAllowedSpread; // Max Allowed Spread ...
// //
// On X121 Signal Recieved Event Handler(s) ... // On X121 Signal Recieved Event Handler(s) ...
TOnX121SMCSignal mSignalEventHandlers[]; TOnX121SMCSignal mSignalEventHandlers[];
+1 -34
View File
@@ -295,36 +295,6 @@ class XC121SMCExpert : public XCBaseExpert
ReConfigure(); 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 ... // Trade ...
@@ -1242,6 +1212,7 @@ class XC121SMCExpert : public XCBaseExpert
mTradeHandler.SaveTrades(false); mTradeHandler.SaveTrades(false);
mTradeHandler.SaveSignals(false); mTradeHandler.SaveSignals(false);
mTradeHandler.SaveConditions(false); mTradeHandler.SaveConditions(false);
mTradeHandler.MaxAllowedSpread(MaxAllowedSpread());
// //
ReConfigureTradeHandler(); ReConfigureTradeHandler();
@@ -1802,9 +1773,6 @@ class XC121SMCExpert : public XCBaseExpert
strategy.R2R(R2R()); strategy.R2R(R2R());
strategy.AllowLong(AllowLong()); strategy.AllowLong(AllowLong());
strategy.AllowShort(AllowShort()); strategy.AllowShort(AllowShort());
strategy.MaxAllowedSpread(20);
// strategy.MaxAllowedSaveTicks(150);
// strategy.MinRequiredTicksForSpreadPass(100);
// //
if (Disabled()) if (Disabled())
@@ -1920,7 +1888,6 @@ class XC121SMCExpert : public XCBaseExpert
double mLastPositionProfitForAcceptNextInPoint; // Last Position Profit In Points for Accept new Signal ... double mLastPositionProfitForAcceptNextInPoint; // Last Position Profit In Points for Accept new Signal ...
int mDelaysBetweenTwoSignalsInBar; // Delay between two Signals in Bars ... int mDelaysBetweenTwoSignalsInBar; // Delay between two Signals in Bars ...
double mMaxAllowedSpread; // Max Allowed Spread for Signalling ... double mMaxAllowedSpread; // Max Allowed Spread for Signalling ...
int mMinRequiredVerificationForSpreadPass; // Minimum Spread Verification for Signalling ...
// //
// Trade ... // Trade ...
+660 -230
View File
@@ -953,262 +953,688 @@ struct X121SMCStrategyXWZWorkingZone
// //
// Senario 1: // Senario 1:
// ---------- // ----------
bool useSenario1 = false;
// bool isSenario1Happend = false;
// Senario 1 Bullish Conditions ... bool isSenario1Bullish = false;
bool isSenario1Bullish = bool isSenario1Bearish = false;
// if (useSenario1)
// 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)
{ {
// //
dir = // Senario 1 Bullish Conditions ...
isSenario1Bullish isSenario1Bullish =
? X_DIRECTION_BULLISH //
: X_DIRECTION_BEARISH; // 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; // Senario 1 Bearish Conditions ...
box.to = TimeCurrent(); isSenario1Bearish =
box.symbol = provider //
.decisionXConditions // X3Ma / XVwap Switched To Bearish ...
.symbol; (
box.period = provider //
.decisionXConditions // X3Ma Switched To Bearish ...
.period; (
//
(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; // Filling Requirements using Senario 1 ...
if (isSenario1Bullish) isSenario1Happend =
isSenario1Bullish ||
isSenario1Bearish;
if (isSenario1Happend)
{ {
// //
double vale = provider dir =
.decisionXConditions isSenario1Bullish
.valesBuffer[cIDX]; ? 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 int fromIDX = -1;
.decisionXConditions if (isSenario1Bullish)
.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 = double vale = provider
lowerValeIDX < higherValeIDX .decisionXConditions
? lowerValeIDX .valesBuffer[cIDX];
: higherValeIDX;
//
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) && else
!IsValidIndex(higherValeIDX))
{ {
// //
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; box.from = iTime(
} zBar.symbol,
} zBar.period,
else fromIDX //
{ );
//
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
{
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( // XSMHK ...
zBar.symbol, (
zBar.period, //
fromIDX // (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 = isBullish =
// //
isSenario1Bullish isSenario1Bullish ||
isSenario2Bullish ||
isSenario3Bullish
// //
; ;
// //
isBearish = isBearish =
// //
isSenario1Bearish isSenario1Bearish ||
isSenario2Bearish ||
isSenario3Bearish
// //
; ;