apply some changes on signal senario 1 ...
This commit is contained in:
@@ -1164,6 +1164,103 @@ hasWaitingBoxes = workingZone.HasWaitingBoxes();
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//
|
||||||
|
// Senario 1:
|
||||||
|
// ----------
|
||||||
|
bool useSenario1 = true;
|
||||||
|
bool isSenario1Happend = false;
|
||||||
|
bool isSenario1Bullish = false;
|
||||||
|
bool isSenario1Bearish = false;
|
||||||
|
if (useSenario1)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
)
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,8 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
// Props ...
|
// Props ...
|
||||||
|
bool useGuards;
|
||||||
|
bool useQuarterTargets;
|
||||||
X121SMCStrategyXWZWorkingZone workingZone;
|
X121SMCStrategyXWZWorkingZone workingZone;
|
||||||
X121SMCStrategyXWZSignalConditions mConditions;
|
X121SMCStrategyXWZSignalConditions mConditions;
|
||||||
X121SMCStrategyXWZSignalConditions mConditionsCollection[];
|
X121SMCStrategyXWZSignalConditions mConditionsCollection[];
|
||||||
@@ -443,39 +445,39 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
}
|
}
|
||||||
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX)
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_BOX)
|
||||||
{
|
{
|
||||||
//
|
// //
|
||||||
if (isBullish)
|
// if (isBullish)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
iSL = MathMin(
|
// iSL = MathMin(
|
||||||
provider.decisionXConditions.le1Buffer[1],
|
// provider.decisionXConditions.le1Buffer[1],
|
||||||
provider.decisionXConditions.le2Buffer[1] //
|
// provider.decisionXConditions.le2Buffer[1] //
|
||||||
);
|
// );
|
||||||
if (iSL > 0)
|
// if (iSL > 0)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Add(
|
// Add(
|
||||||
iSL,
|
// iSL,
|
||||||
sls //
|
// sls //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
iSL = MathMax(
|
// iSL = MathMax(
|
||||||
provider.decisionXConditions.se1Buffer[1],
|
// provider.decisionXConditions.se1Buffer[1],
|
||||||
provider.decisionXConditions.se2Buffer[1] //
|
// provider.decisionXConditions.se2Buffer[1] //
|
||||||
);
|
// );
|
||||||
if (iSL > 0)
|
// if (iSL > 0)
|
||||||
{
|
// {
|
||||||
//
|
// //
|
||||||
Add(
|
// Add(
|
||||||
iSL,
|
// iSL,
|
||||||
sls //
|
// sls //
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_AREA)
|
else if (signalProvider == X121SMC_XWZ_PROVIDER_ACTIVATED_AREA)
|
||||||
{
|
{
|
||||||
@@ -483,7 +485,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
double iAtr = provider.decisionXConditions.atrBuffer[1];
|
double iAtr = provider.decisionXConditions.atrBuffer[1];
|
||||||
iAtr *= 0;
|
iAtr *= 2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Select Condition SL ...
|
// Select Condition SL ...
|
||||||
@@ -532,266 +534,271 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Based On Priority ...
|
// Based On Priority ...
|
||||||
has = priority != X121SMC_XWZ_PRIORITY_NONE;
|
useQuarterTargets = false;
|
||||||
if (has)
|
if (useQuarterTargets)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
switch (priority)
|
has = priority != X121SMC_XWZ_PRIORITY_NONE;
|
||||||
|
if (has)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_WEAK:
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
switch (priority)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.supplyZone.Lower(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.demandZone.Upper(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_LOW:
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
case X121SMC_XWZ_PRIORITY_WEAK:
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Weak ...
|
if (isBullish)
|
||||||
Add(
|
{
|
||||||
workingZone.supplyZone.Lower(),
|
//
|
||||||
targets //
|
// Weak ...
|
||||||
);
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Weak ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
|
||||||
// Low ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter1,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.demandZone.Upper(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Low ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter3,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_REGULAR:
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
case X121SMC_XWZ_PRIORITY_LOW:
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Weak ...
|
if (isBullish)
|
||||||
Add(
|
{
|
||||||
workingZone.supplyZone.Lower(),
|
//
|
||||||
targets //
|
// Weak ...
|
||||||
);
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Low ...
|
// Low ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter1,
|
workingZone.quarter1,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Weak ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular ...
|
// Low ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter2,
|
workingZone.quarter3,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
break;
|
||||||
{
|
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.demandZone.Upper(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Low ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter3,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Regular ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter2,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_HIGH:
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
case X121SMC_XWZ_PRIORITY_REGULAR:
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Weak ...
|
if (isBullish)
|
||||||
Add(
|
{
|
||||||
workingZone.supplyZone.Lower(),
|
//
|
||||||
targets //
|
// Weak ...
|
||||||
);
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Low ...
|
// Low ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter1,
|
workingZone.quarter1,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular ...
|
// Regular ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter2,
|
workingZone.quarter2,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Weak ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// High ...
|
// Low ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter3,
|
workingZone.quarter3,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.demandZone.Upper(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Low ...
|
// Regular ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter3,
|
workingZone.quarter2,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
//
|
|
||||||
// Regular ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter2,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// High ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter1,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
//
|
|
||||||
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
|
||||||
//
|
//
|
||||||
if (isBullish)
|
case X121SMC_XWZ_PRIORITY_HIGH:
|
||||||
{
|
|
||||||
//
|
//
|
||||||
// Weak ...
|
if (isBullish)
|
||||||
Add(
|
{
|
||||||
workingZone.supplyZone.Lower(),
|
//
|
||||||
targets //
|
// Weak ...
|
||||||
);
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Low ...
|
// Low ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter1,
|
workingZone.quarter1,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Regular ...
|
// Regular ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter2,
|
workingZone.quarter2,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// High ...
|
// High ...
|
||||||
Add(
|
Add(
|
||||||
workingZone.quarter3,
|
workingZone.quarter3,
|
||||||
targets //
|
targets //
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Weak ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Low ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter3,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Regular ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter2,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// High ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter1,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
//
|
||||||
|
case X121SMC_XWZ_PRIORITY_STRONG_HIGH:
|
||||||
//
|
//
|
||||||
// Strong High ...
|
if (isBullish)
|
||||||
Add(
|
{
|
||||||
workingZone.demandZone.Upper(),
|
//
|
||||||
targets //
|
// Weak ...
|
||||||
);
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Low ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter1,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Regular ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter2,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// High ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter3,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Strong High ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Weak ...
|
||||||
|
Add(
|
||||||
|
workingZone.demandZone.Upper(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Low ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter3,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Regular ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter2,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// High ...
|
||||||
|
Add(
|
||||||
|
workingZone.quarter1,
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Strong High ...
|
||||||
|
Add(
|
||||||
|
workingZone.supplyZone.Lower(),
|
||||||
|
targets //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Weak ...
|
|
||||||
Add(
|
|
||||||
workingZone.demandZone.Upper(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Low ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter3,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Regular ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter2,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// High ...
|
|
||||||
Add(
|
|
||||||
workingZone.quarter1,
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Strong High ...
|
|
||||||
Add(
|
|
||||||
workingZone.supplyZone.Lower(),
|
|
||||||
targets //
|
|
||||||
);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -967,6 +974,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
//
|
//
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!useGuards)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
Clean(guards);
|
Clean(guards);
|
||||||
|
|
||||||
@@ -1653,6 +1666,9 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
|||||||
*/
|
*/
|
||||||
void Init()
|
void Init()
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
useGuards = true;
|
||||||
|
useQuarterTargets = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -924,38 +924,7 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool isBearish = false;
|
bool isBearish = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
XOHCL zBar;
|
X121SMCStrategyConditionParser cParser;
|
||||||
XOHCL cBar;
|
|
||||||
XOHCL pBar;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Initial Bars ...
|
|
||||||
result = zBar.Init(
|
|
||||||
symbol,
|
|
||||||
period,
|
|
||||||
barIndex //
|
|
||||||
);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
zBar.GetPreviousBar(cBar);
|
|
||||||
result =
|
|
||||||
result &&
|
|
||||||
cBar.GetPreviousBar(pBar);
|
|
||||||
if (!result)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
zBar.Clean();
|
|
||||||
cBar.Clean();
|
|
||||||
pBar.Clean();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detecting Signal Conditions ...
|
|
||||||
X121SMCStrategyConditionParser decisionParser;
|
|
||||||
decisionParser.Parse(provider.decisionXConditions);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Senario 1:
|
// Senario 1:
|
||||||
@@ -967,405 +936,30 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
if (useSenario1)
|
if (useSenario1)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Senario 1 Bullish Conditions ...
|
isSenario1Happend = cParser.HasSenario1Conditions(
|
||||||
|
X_CYCLE_DECISION,
|
||||||
|
box,
|
||||||
|
holderBox,
|
||||||
|
dir,
|
||||||
|
provider,
|
||||||
|
X_CYCLE_ANALYSE,
|
||||||
|
barIndex //
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
isSenario1Bullish =
|
isSenario1Bullish =
|
||||||
//
|
isSenario1Happend &&
|
||||||
// X3Ma / XVwap Switched To Bulish ...
|
IsBullish(dir);
|
||||||
(
|
|
||||||
//
|
|
||||||
// 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 ...
|
|
||||||
isSenario1Bearish =
|
isSenario1Bearish =
|
||||||
//
|
isSenario1Happend &&
|
||||||
// X3Ma / XVwap Switched To Bearish ...
|
IsBearish(dir);
|
||||||
(
|
|
||||||
//
|
|
||||||
// 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 ...
|
|
||||||
isSenario1Happend =
|
|
||||||
isSenario1Bullish ||
|
|
||||||
isSenario1Bearish;
|
|
||||||
if (isSenario1Happend)
|
if (isSenario1Happend)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
dir =
|
|
||||||
isSenario1Bullish
|
|
||||||
? 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 (isSenario1Bullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Detect Holder Box ...
|
|
||||||
XBoxZone tmpBoxes[];
|
|
||||||
if (isSenario1Bullish)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Demand Zones ...
|
|
||||||
XBoxZone tmp[];
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.demandZones,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Order Blocks ...
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.bullishOrderBlocks,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bullish Fair Value Gaps ...
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.bullishFairValueGaps,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Supply Zones ...
|
|
||||||
XBoxZone tmp[];
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.supplyZones,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Order Blocks ...
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.bearishOrderBlocks,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Bearish Fair Value Gaps ...
|
|
||||||
ToBox(
|
|
||||||
provider.visionState.bearishFairValueGaps,
|
|
||||||
tmp //
|
|
||||||
);
|
|
||||||
Copy(
|
|
||||||
tmp,
|
|
||||||
tmpBoxes,
|
|
||||||
false //
|
|
||||||
);
|
|
||||||
Clean(tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
has = HasChild(tmpBoxes);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
while (HasChild(tmpBoxes))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
idx = GetOldest(tmpBoxes);
|
|
||||||
has = IsValidIndex(idx);
|
|
||||||
if (!has)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
XBoxZone iBox = tmpBoxes[idx];
|
|
||||||
ArrayRemove(
|
|
||||||
tmpBoxes,
|
|
||||||
idx,
|
|
||||||
1 //
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
has = IsBoxInside(
|
|
||||||
box,
|
|
||||||
iBox //
|
|
||||||
);
|
|
||||||
if (has)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
holderBox = iBox;
|
|
||||||
holderBox.to = TimeCurrent();
|
|
||||||
iBox.Clean();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
iBox.Clean();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
Clean(tmpBoxes);
|
|
||||||
|
|
||||||
//
|
|
||||||
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
|
signalProvider = X121SMC_XWZ_PROVIDER_ACTIVATED_BOX;
|
||||||
|
|
||||||
//
|
|
||||||
// Validate Conditions to Force Has Holder Box ...
|
|
||||||
// isSenario1Happend =
|
|
||||||
// holderBox.IsValid() &&
|
|
||||||
// isSenario1Happend;
|
|
||||||
// if (!isSenario1Happend)
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// isSenario1Bullish = false;
|
|
||||||
// isSenario1Bearish = false;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1378,228 +972,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool isSenario2Bearish = false;
|
bool isSenario2Bearish = false;
|
||||||
if (useSenario2)
|
if (useSenario2)
|
||||||
{
|
{
|
||||||
//
|
|
||||||
// Senario 2 Bullish Conditions ...
|
|
||||||
isSenario2Bullish =
|
|
||||||
//
|
|
||||||
// XSMHK ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
(decisionParser.isRawHKBullishUnderValesGoldenZone &&
|
|
||||||
decisionParser.isSMHKSwitchedToBullishUnderValesGoldenZone)
|
|
||||||
//
|
|
||||||
||
|
|
||||||
//
|
|
||||||
(decisionParser.isSMHKBullishUnderValesGoldenZone &&
|
|
||||||
decisionParser.isRawHKSwitchedToBullishUnderValesGoldenZone)
|
|
||||||
//
|
|
||||||
)
|
|
||||||
//
|
|
||||||
&&
|
|
||||||
//
|
|
||||||
// Other Conditions ...
|
|
||||||
(
|
|
||||||
//
|
|
||||||
provider.decisionXConditions.isSarBullish &&
|
|
||||||
provider.decisionXConditions.isStrBullish
|
|
||||||
//
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1611,182 +983,6 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
bool isSenario3Bearish = false;
|
bool isSenario3Bearish = false;
|
||||||
if (useSenario3)
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -1819,12 +1015,12 @@ struct X121SMCStrategyXWZWorkingZone
|
|||||||
isBearish);
|
isBearish);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Cleanup Resources ...
|
if (!result)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
zBar.Clean();
|
box.Clean();
|
||||||
cBar.Clean();
|
holderBox.Clean();
|
||||||
pBar.Clean();
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -268,6 +268,9 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
type //
|
type //
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
double spread = GetSpread(conditions.symbol);
|
||||||
|
|
||||||
//
|
//
|
||||||
double slAddition = 0;
|
double slAddition = 0;
|
||||||
sl =
|
sl =
|
||||||
@@ -317,8 +320,10 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
hasXWZSignal)
|
hasXWZSignal)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Configuring Amount Percent and ETC ...
|
// Configuring Amount Percent and etc ...
|
||||||
bool ignoreEAVolume = mXWZConditions.reward > 0 &&
|
// TODO: Enable if required ...
|
||||||
|
bool ignoreEAVolume = false &&
|
||||||
|
mXWZConditions.reward > 0 &&
|
||||||
mXWZConditions.amountPercent > 0;
|
mXWZConditions.amountPercent > 0;
|
||||||
if (ignoreEAVolume)
|
if (ignoreEAVolume)
|
||||||
{
|
{
|
||||||
@@ -379,6 +384,13 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Apply Spread on Signal's TP ...
|
||||||
|
signal.tp =
|
||||||
|
hasLong
|
||||||
|
? signal.tp + spread
|
||||||
|
: signal.tp - spread;
|
||||||
|
|
||||||
//
|
//
|
||||||
hasLong = false;
|
hasLong = false;
|
||||||
hasShort = false;
|
hasShort = false;
|
||||||
@@ -692,7 +704,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
useXWZSignal = true;
|
useXWZSignal = true;
|
||||||
useXWZSignalGuard = false;
|
useXWZSignalGuard = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
string symbol = GetSymbol();
|
string symbol = GetSymbol();
|
||||||
@@ -735,7 +747,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
bool showAll = false;
|
bool showAll = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
x121Inputs.showRSI = false;
|
x121Inputs.showRSI = showAll || false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
@@ -791,7 +803,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XPV ...
|
// XPV ...
|
||||||
x121Inputs.xpvInputs.showSar = showAll || false;
|
x121Inputs.xpvInputs.showSar = showAll || true;
|
||||||
x121Inputs.xpvInputs.showPeaks = showAll || true;
|
x121Inputs.xpvInputs.showPeaks = showAll || true;
|
||||||
x121Inputs.xpvInputs.showVales = showAll || true;
|
x121Inputs.xpvInputs.showVales = showAll || true;
|
||||||
x121Inputs.xpvInputs.showGoldenZones = showAll || true;
|
x121Inputs.xpvInputs.showGoldenZones = showAll || true;
|
||||||
@@ -810,7 +822,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
|||||||
|
|
||||||
//
|
//
|
||||||
// XSTR ...
|
// XSTR ...
|
||||||
x121Inputs.xstrInputs.showStr = showAll || false;
|
x121Inputs.xstrInputs.showStr = showAll || true;
|
||||||
x121Inputs.xstrInputs.showStrUpper = showAll || false;
|
x121Inputs.xstrInputs.showStrUpper = showAll || false;
|
||||||
x121Inputs.xstrInputs.showStrLower = showAll || false;
|
x121Inputs.xstrInputs.showStrLower = showAll || false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user