last ...
This commit is contained in:
+6436
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -60,6 +60,12 @@ input group "ADX Detection";
|
||||
input int adxLength = 14; // ADX Length
|
||||
input double adxThreshold = 25; // ADX Threshold for Strong Trends
|
||||
|
||||
//
|
||||
input group "POI Detection";
|
||||
input ENUM_TIMEFRAMES orderBlockTF = PERIOD_H1; // Order Block Detection Time Frame
|
||||
input ENUM_TIMEFRAMES fairValueGapTF = PERIOD_M15; // Fair Value Gap Detection Time Frame
|
||||
input ENUM_TIMEFRAMES supDemTF = PERIOD_H4; // Supply and Demand Detection Time Frame
|
||||
|
||||
//
|
||||
input group "Alert";
|
||||
input bool mXWZEnableAlerts = true; // Enable Alerts
|
||||
@@ -1880,11 +1886,26 @@ void DetectOrderBlock(XOHCL &bar)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = bar.Index(orderBlockTF);
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isInited = iBar.Init(
|
||||
bar.symbol,
|
||||
orderBlockTF,
|
||||
iBarIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL zoneBar;
|
||||
ENUM_X_DIRECTION zoneDir;
|
||||
has = mXWZBarAnalyser.HasOrderBlock(
|
||||
bar,
|
||||
iBar,
|
||||
zoneBar,
|
||||
zoneDir,
|
||||
mXWZOBFVGSameBars //
|
||||
@@ -1928,7 +1949,7 @@ void DetectOrderBlock(XOHCL &bar)
|
||||
zoneDir,
|
||||
startedBar,
|
||||
isBodyOut,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -1960,7 +1981,7 @@ void DetectOrderBlock(XOHCL &bar)
|
||||
activationBar,
|
||||
isActivationBarBodyIn,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2005,7 +2026,7 @@ void DetectOrderBlock(XOHCL &bar)
|
||||
breakedBar,
|
||||
isBodyOut,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2078,6 +2099,7 @@ void DetectOrderBlock(XOHCL &bar)
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
zoneBar.Clean();
|
||||
}
|
||||
|
||||
@@ -2096,12 +2118,27 @@ void DetectFairValueGap(XOHCL &bar)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = bar.Index(fairValueGapTF);
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isInited = iBar.Init(
|
||||
bar.symbol,
|
||||
fairValueGapTF,
|
||||
iBarIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
XOHCL zoneEndBar;
|
||||
XOHCL zoneStartBar;
|
||||
ENUM_X_DIRECTION zoneDir;
|
||||
has = mXWZBarAnalyser.HasFairValueGap(
|
||||
bar,
|
||||
iBar,
|
||||
zoneStartBar,
|
||||
zoneEndBar,
|
||||
zoneDir,
|
||||
@@ -2149,7 +2186,7 @@ void DetectFairValueGap(XOHCL &bar)
|
||||
zoneDir,
|
||||
startedBar,
|
||||
isBodyOut,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2182,7 +2219,7 @@ void DetectFairValueGap(XOHCL &bar)
|
||||
activationBar,
|
||||
isActivationBarBodyIn,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2215,7 +2252,7 @@ void DetectFairValueGap(XOHCL &bar)
|
||||
breakedBar,
|
||||
isBodyOut,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2291,6 +2328,7 @@ void DetectFairValueGap(XOHCL &bar)
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
zoneEndBar.Clean();
|
||||
zoneStartBar.Clean();
|
||||
}
|
||||
@@ -2310,6 +2348,21 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = bar.Index(supDemTF);
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isInited = iBar.Init(
|
||||
bar.symbol,
|
||||
supDemTF,
|
||||
iBarIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int range = mXWZSuResRange * 2;
|
||||
|
||||
@@ -2317,7 +2370,7 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
XOHCL zoneBar;
|
||||
ENUM_X_DIRECTION zoneDir = X_DIRECTION_BEARISH;
|
||||
has = mXWZBarAnalyser.HasResistance(
|
||||
bar,
|
||||
iBar,
|
||||
zoneBar,
|
||||
range //
|
||||
);
|
||||
@@ -2361,7 +2414,7 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
zoneDir,
|
||||
startedBar,
|
||||
isBodyOut,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2393,7 +2446,7 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
activationBar,
|
||||
isActivationBarBodyIn,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2425,7 +2478,7 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
breakedBar,
|
||||
isBodyOut,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2498,6 +2551,7 @@ void DetectSupplyZone(XOHCL &bar)
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
zoneBar.Clean();
|
||||
}
|
||||
|
||||
@@ -2516,6 +2570,21 @@ void DetectDemandZone(XOHCL &bar)
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int iBarIndex = bar.Index(supDemTF);
|
||||
|
||||
//
|
||||
XOHCL iBar;
|
||||
bool isInited = iBar.Init(
|
||||
bar.symbol,
|
||||
supDemTF,
|
||||
iBarIndex //
|
||||
);
|
||||
if (!isInited)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
int range = mXWZSuResRange * 2;
|
||||
|
||||
@@ -2523,7 +2592,7 @@ void DetectDemandZone(XOHCL &bar)
|
||||
XOHCL zoneBar;
|
||||
ENUM_X_DIRECTION zoneDir = X_DIRECTION_BULLISH;
|
||||
has = mXWZBarAnalyser.HasSupport(
|
||||
bar,
|
||||
iBar,
|
||||
zoneBar,
|
||||
range //
|
||||
);
|
||||
@@ -2567,7 +2636,7 @@ void DetectDemandZone(XOHCL &bar)
|
||||
zoneDir,
|
||||
startedBar,
|
||||
isBodyOut,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2599,7 +2668,7 @@ void DetectDemandZone(XOHCL &bar)
|
||||
activationBar,
|
||||
isActivationBarBodyIn,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2631,7 +2700,7 @@ void DetectDemandZone(XOHCL &bar)
|
||||
breakedBar,
|
||||
isBodyOut,
|
||||
false,
|
||||
bar.period //
|
||||
iBar.period //
|
||||
);
|
||||
|
||||
//
|
||||
@@ -2704,6 +2773,7 @@ void DetectDemandZone(XOHCL &bar)
|
||||
}
|
||||
|
||||
//
|
||||
iBar.Clean();
|
||||
zoneBar.Clean();
|
||||
}
|
||||
|
||||
|
||||
@@ -7757,6 +7757,40 @@ void CleanupArray(
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void CleanupArray(
|
||||
int &removedIndexes[],
|
||||
T &buffer[] // Buffer to Cleanup ...
|
||||
)
|
||||
{
|
||||
//
|
||||
bool isValid = HasChild(buffer) &&
|
||||
HasChild(removedIndexes);
|
||||
if (!isValid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < ArraySize(removedIndexes); i++)
|
||||
{
|
||||
//
|
||||
int idx = removedIndexes[i];
|
||||
if (IsValidIndex(idx) && ArraySize(buffer) > idx)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
buffer,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
Clean(removedIndexes);
|
||||
}
|
||||
|
||||
//
|
||||
// Search Array For Specific Item ...
|
||||
template <typename T>
|
||||
|
||||
@@ -1265,6 +1265,65 @@ bool IsBoxUsed(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an Inside Box of source in a Collection ...
|
||||
*
|
||||
* @param index: int, Founded Index ...
|
||||
* @param source: XBoxZone instance ...
|
||||
* @param dest: XBoxZone instance Collection ...
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool HasInsideBox(
|
||||
int &index,
|
||||
XBoxZone &source,
|
||||
XBoxZone &dest[] //
|
||||
)
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
index = -1;
|
||||
|
||||
//
|
||||
result = source.IsValid() &&
|
||||
HasChild(dest);
|
||||
|
||||
//
|
||||
int count = ArraySize(dest);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox = dest[i];
|
||||
|
||||
//
|
||||
bool isInside = !iBox.IsSameAs(source) &&
|
||||
IsBoxInside(
|
||||
iBox,
|
||||
source //
|
||||
);
|
||||
if (isInside)
|
||||
{
|
||||
//
|
||||
index = i;
|
||||
iBox.Clean();
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
result = IsValidIndex(index);
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts to XBoxZone ...
|
||||
*
|
||||
|
||||
@@ -301,6 +301,27 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
X121Conditions consolidationXConditions = consolidationConditions.x121Conditions;
|
||||
X121Conditions visionXConditions = visionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Scores ...
|
||||
|
||||
//
|
||||
// Decision ...
|
||||
double decisionBullishScore = 0;
|
||||
double decisionBearishScore = 0;
|
||||
decisionXConditions.GenerateScore(
|
||||
decisionBullishScore,
|
||||
decisionBearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
// Analyse ...
|
||||
double analyseBullishScore = 0;
|
||||
double analyseBearishScore = 0;
|
||||
analyseXConditions.GenerateScore(
|
||||
analyseBullishScore,
|
||||
analyseBearishScore //
|
||||
);
|
||||
|
||||
//
|
||||
// Select Drawer Class ...
|
||||
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
|
||||
@@ -313,17 +334,12 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
double targets[];
|
||||
double reward = 0;
|
||||
XBoxZone signalBox;
|
||||
XOBFVG selectedZone;
|
||||
double amountPercent = 0;
|
||||
bool hasPriority = false;
|
||||
bool hasSignalBox = false;
|
||||
bool hasRewardAmount = false;
|
||||
bool hasSelectedZone = false;
|
||||
bool isSignalBoxReversal = false;
|
||||
bool isSelectedZoneReversal = false;
|
||||
bool hasSelectedConsolidationZone = false;
|
||||
XConsolidationZone selectedConsolidationZone;
|
||||
ENUM_X_DIRECTION selectedZoneDir = X_DIRECTION_NONE;
|
||||
ENUM_X_DIRECTION signalBoxDir = X_DIRECTION_NONE;
|
||||
ENUM_X121SMC_XWZ_PRIORITY priority = X121SMC_XWZ_PRIORITY_NONE;
|
||||
ENUM_X121SMC_XWZ_PROVIDERS provider = X121SMC_XWZ_PROVIDER_NONE;
|
||||
|
||||
@@ -367,300 +383,165 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
analyseState,
|
||||
decisionState //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
bool hasWaitingZones = hasWorkingZone &&
|
||||
workingZone.HasWaitingZones();
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Check Conditions if Has Inside Zones ...
|
||||
bool hasInsideZones = hasWorkingZone &&
|
||||
workingZone.HasInsideZones();
|
||||
if (hasInsideZones)
|
||||
{
|
||||
//
|
||||
int selectedIDX = -1;
|
||||
int count = workingZone.CountInsideZones();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
bool has = DetectSelectedZoneConditions(
|
||||
isSelectedZoneReversal,
|
||||
workingZone.insideZones[i],
|
||||
decisionState,
|
||||
decisionXConditions //
|
||||
);
|
||||
|
||||
//
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
selectedIDX = i;
|
||||
selectedZone = workingZone.insideZones[i];
|
||||
|
||||
//
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
if (IsValidIndex(selectedIDX))
|
||||
bool isDestroyed = workingZone.IsDestroyed(
|
||||
zIndex,
|
||||
period //
|
||||
);
|
||||
if (isDestroyed)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
workingZone.insideZones,
|
||||
selectedIDX,
|
||||
1 //
|
||||
);
|
||||
|
||||
//
|
||||
hasSelectedZone = selectedZone.IsValid();
|
||||
provider = X121SMC_XWZ_PROVIDER_PRICE_INSIDE_ZONE;
|
||||
result = false;
|
||||
workingZone.Clean();
|
||||
hasWorkingZone = false;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions if Has Breaked Zones ...
|
||||
bool hasBreakedZones = hasWorkingZone &&
|
||||
workingZone.HasBreakedZones();
|
||||
if (hasBreakedZones)
|
||||
{
|
||||
// //
|
||||
// if (!hasSelectedZone)
|
||||
// {
|
||||
// //
|
||||
// int selectedIDX = -1;
|
||||
// int count = workingZone.CountBreakedZones();
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// bool has = DetectSelectedZoneConditions(
|
||||
// isSelectedZoneReversal,
|
||||
// workingZone.breakedZones[i],
|
||||
// decisionState,
|
||||
// decisionXConditions //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// selectedIDX = i;
|
||||
// selectedZone = workingZone.breakedZones[i];
|
||||
|
||||
// //
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// if (IsValidIndex(selectedIDX))
|
||||
// {
|
||||
// //
|
||||
// ArrayRemove(
|
||||
// workingZone.breakedZones,
|
||||
// selectedIDX,
|
||||
// 1 //
|
||||
// );
|
||||
|
||||
// //
|
||||
// hasSelectedZone = selectedZone.IsValid();
|
||||
// provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
bool hasInsideBoxes = hasWorkingZone &&
|
||||
workingZone.HasInsideBoxes();
|
||||
if (hasInsideBoxes)
|
||||
// Waiting Box Detected ...
|
||||
bool hasWaitingBoxes = hasWorkingZone &&
|
||||
workingZone.HasWaitingBoxes();
|
||||
if (hasWaitingBoxes)
|
||||
{
|
||||
//
|
||||
XOHCL zBar;
|
||||
XOHCL cBar;
|
||||
XOHCL pBar;
|
||||
int count = 0;
|
||||
int idx = -1;
|
||||
bool has = false;
|
||||
XBoxZone tmpSelectedBox;
|
||||
int tmpSelectedBoxIDX = -1;
|
||||
|
||||
//
|
||||
has = zBar.Init(
|
||||
bool isInited = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
has = has &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
if (has)
|
||||
isInited =
|
||||
isInited &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
isInited =
|
||||
isInited &&
|
||||
cBar.GetPreviousBar(pBar);
|
||||
|
||||
//
|
||||
count = workingZone.CountWaitingBoxes();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
count = workingZone.CountInsideBoxes();
|
||||
for (int i = 0; i < count; i++)
|
||||
XBoxZone iBox = workingZone.waitingBoxes[i];
|
||||
ENUM_X_DIRECTION iDir = iBox.dir;
|
||||
bool isBullish = IsBullish(iDir);
|
||||
|
||||
//
|
||||
// Check Price Rejection ...
|
||||
|
||||
//
|
||||
bool hasBullishFiboPressure =
|
||||
decisionCycleHelper
|
||||
.mBarAnalyser
|
||||
.HasFiboPressure(
|
||||
cBar,
|
||||
X_DIRECTION_BULLISH,
|
||||
X_FIBO_LEVEL_382 //
|
||||
);
|
||||
|
||||
//
|
||||
bool hasBearishFiboPressure =
|
||||
decisionCycleHelper
|
||||
.mBarAnalyser
|
||||
.HasFiboPressure(
|
||||
cBar,
|
||||
X_DIRECTION_BEARISH,
|
||||
X_FIBO_LEVEL_382 //
|
||||
);
|
||||
|
||||
//
|
||||
// Bullish Rejection ...
|
||||
bool isBullishRejected =
|
||||
//
|
||||
isInited &&
|
||||
isBullish &&
|
||||
cBar.low < pBar.low &&
|
||||
zBar.low > iBox.upper &&
|
||||
cBar.low <= iBox.upper &&
|
||||
zBar.open > iBox.upper &&
|
||||
hasBullishFiboPressure &&
|
||||
cBar.GetLowShadow() > pBar.GetLowShadow()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// Bearish Rejection ...
|
||||
bool isBearishhRejected =
|
||||
//
|
||||
isInited &&
|
||||
!isBullish &&
|
||||
cBar.high > pBar.high &&
|
||||
zBar.open < iBox.lower &&
|
||||
zBar.high < iBox.lower &&
|
||||
hasBearishFiboPressure &&
|
||||
cBar.high >= iBox.lower &&
|
||||
cBar.GetHighShadow() > pBar.GetHighShadow()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has = isBullishRejected ||
|
||||
isBearishhRejected;
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
tmpSelectedBox = workingZone.insideBoxes[i];
|
||||
|
||||
//
|
||||
bool isBullish = tmpSelectedBox.IsBullish();
|
||||
bool isBearish = tmpSelectedBox.IsBearish();
|
||||
|
||||
//
|
||||
bool hasFiboPressure =
|
||||
visionCycleHelper
|
||||
.mBarAnalyser
|
||||
.HasFiboPressure(
|
||||
cBar,
|
||||
tmpSelectedBox.dir,
|
||||
X_FIBO_LEVEL_382 //
|
||||
);
|
||||
|
||||
//
|
||||
bool isBullishRejectedUpper =
|
||||
cBar.low < tmpSelectedBox.upper &&
|
||||
cBar.GetDown() > tmpSelectedBox.upper;
|
||||
|
||||
//
|
||||
bool isBullishRejectedLower =
|
||||
cBar.low < tmpSelectedBox.lower &&
|
||||
cBar.GetDown() > tmpSelectedBox.lower;
|
||||
|
||||
//
|
||||
bool isBearishRejectedUpper =
|
||||
cBar.high > tmpSelectedBox.upper &&
|
||||
cBar.GetUp() < tmpSelectedBox.upper;
|
||||
|
||||
//
|
||||
bool isBearishRejectedLower =
|
||||
cBar.high > tmpSelectedBox.lower &&
|
||||
cBar.GetUp() < tmpSelectedBox.lower;
|
||||
|
||||
//
|
||||
bool isBullishRejected =
|
||||
// isBullishRejectedUpper ||
|
||||
isBullishRejectedLower;
|
||||
|
||||
//
|
||||
bool isBearishRejected =
|
||||
isBearishRejectedUpper
|
||||
// || isBearishRejectedLower
|
||||
;
|
||||
|
||||
//
|
||||
bool isMaWapBullish =
|
||||
//
|
||||
(decisionXConditions.isX3MaBullishState &&
|
||||
decisionXConditions.isX3MaBullishOrdered)
|
||||
//
|
||||
&&
|
||||
//
|
||||
(decisionXConditions.isVWapBullishState &&
|
||||
decisionXConditions.isVWapBullishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isMaWapBearish =
|
||||
//
|
||||
(decisionXConditions.isX3MaBearishState &&
|
||||
decisionXConditions.isX3MaBearishOrdered)
|
||||
//
|
||||
&&
|
||||
//
|
||||
(decisionXConditions.isVWapBearishState &&
|
||||
decisionXConditions.isVWapBearishOrdered)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isX2MaWapInside =
|
||||
//
|
||||
(decisionXConditions.x3maFastBuffer[cIndex] < tmpSelectedBox.upper &&
|
||||
decisionXConditions.x3maMidBuffer[cIndex] < tmpSelectedBox.upper &&
|
||||
decisionXConditions.x3maFastBuffer[cIndex] > tmpSelectedBox.lower &&
|
||||
decisionXConditions.x3maMidBuffer[cIndex] > tmpSelectedBox.lower)
|
||||
//
|
||||
&&
|
||||
//
|
||||
(decisionXConditions.vwapFastBuffer[cIndex] < tmpSelectedBox.upper &&
|
||||
decisionXConditions.vwapMidBuffer[cIndex] < tmpSelectedBox.upper &&
|
||||
decisionXConditions.vwapFastBuffer[cIndex] > tmpSelectedBox.lower &&
|
||||
decisionXConditions.vwapMidBuffer[cIndex] > tmpSelectedBox.lower)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isBullishConditions =
|
||||
//
|
||||
isBullish &&
|
||||
isMaWapBearish &&
|
||||
isX2MaWapInside &&
|
||||
hasFiboPressure &&
|
||||
isBullishRejected &&
|
||||
cBar.low < cBar.GetDown()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isBearishConditions =
|
||||
//
|
||||
isBearish &&
|
||||
isMaWapBullish &&
|
||||
isX2MaWapInside &&
|
||||
hasFiboPressure &&
|
||||
isBearishRejected &&
|
||||
cBar.high > cBar.GetUp()
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
has = isBullishConditions ||
|
||||
isBearishConditions;
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
tmpSelectedBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
tmpSelectedBoxIDX = i;
|
||||
signalBox = tmpSelectedBox;
|
||||
|
||||
//
|
||||
tmpSelectedBox.Clean();
|
||||
break;
|
||||
idx = i;
|
||||
signalBox = iBox;
|
||||
hasSignalBox = has;
|
||||
signalBoxDir = iBox.dir;
|
||||
isSignalBoxReversal = false;
|
||||
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_ZONE;
|
||||
}
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
isSignalBoxReversal = false;
|
||||
hasSignalBox = signalBox.IsValid();
|
||||
if (hasSignalBox)
|
||||
// Remove Signal Box from Waiting Boxes of
|
||||
// Working Zone ...
|
||||
if (hasSignalBox &&
|
||||
IsValidIndex(idx))
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
workingZone.insideBoxes,
|
||||
tmpSelectedBoxIDX,
|
||||
workingZone.waitingBoxes,
|
||||
idx,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
tmpSelectedBox.Clean();
|
||||
pBar.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions if Has Inside Boxes ...
|
||||
bool hasInsideBoxes = hasWorkingZone &&
|
||||
workingZone.HasInsideBoxes();
|
||||
if (hasInsideBoxes)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Check Conditions if has Breaked Boxes ...
|
||||
bool hasBreakedBoxes = hasWorkingZone &&
|
||||
workingZone.HasBreakedBoxes();
|
||||
if (hasBreakedBoxes)
|
||||
@@ -668,8 +549,124 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Other Conditions ...
|
||||
if (!hasSignalBox)
|
||||
{
|
||||
//
|
||||
// Score Conditions ...
|
||||
double scoreMultiplier = 3;
|
||||
bool isBullishScorePassed =
|
||||
//
|
||||
analyseBullishScore > (analyseBearishScore * scoreMultiplier) &&
|
||||
decisionBullishScore > (decisionBearishScore * scoreMultiplier)
|
||||
//
|
||||
;
|
||||
bool isBearishScorePassed =
|
||||
//
|
||||
analyseBearishScore > (analyseBullishScore * scoreMultiplier) &&
|
||||
decisionBearishScore > (decisionBullishScore * scoreMultiplier)
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// X3Ma ...
|
||||
|
||||
//
|
||||
// X3Ma Bullish ...
|
||||
bool isX3MaBullish =
|
||||
//
|
||||
decisionXConditions.isX3MaBullishState &&
|
||||
decisionXConditions.isX3MaSwitchedToBullishOrdered &&
|
||||
decisionXConditions.x3maMidBuffer[1] > decisionXConditions.x3maSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// X3Ma Bearish ...
|
||||
bool isX3MaBearish =
|
||||
//
|
||||
decisionXConditions.isX3MaBearishState &&
|
||||
decisionXConditions.isX3MaSwitchedToBearishOrdered &&
|
||||
decisionXConditions.x3maMidBuffer[1] < decisionXConditions.x3maSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isX3MaHasCondition =
|
||||
(isX3MaBullish &&
|
||||
isBullishScorePassed) ||
|
||||
(isX3MaBearish &&
|
||||
isBearishScorePassed);
|
||||
|
||||
//
|
||||
// VWap ...
|
||||
|
||||
//
|
||||
// VWap Bullish ...
|
||||
bool isVWapBullish =
|
||||
//
|
||||
decisionXConditions.isVWapBullishState &&
|
||||
decisionXConditions.isVWapSwitchedToBullishOrdered &&
|
||||
decisionXConditions.vwapMidBuffer[1] > decisionXConditions.vwapSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
// VWap Bearish ...
|
||||
bool isVWapBearish =
|
||||
//
|
||||
decisionXConditions.isVWapBearishState &&
|
||||
decisionXConditions.isVWapSwitchedToBearishOrdered &&
|
||||
decisionXConditions.vwapMidBuffer[1] < decisionXConditions.vwapSlowBuffer[1]
|
||||
//
|
||||
;
|
||||
|
||||
//
|
||||
bool isVWapHasCondition =
|
||||
(isVWapBullish &&
|
||||
isBullishScorePassed) ||
|
||||
(isVWapBearish &&
|
||||
isBearishScorePassed);
|
||||
|
||||
//
|
||||
// Checking Other Conditions XWZ Reject on EMA 20 ...
|
||||
|
||||
//
|
||||
// Check Has Conditions ...
|
||||
bool hasXConditions =
|
||||
(isX3MaHasCondition ||
|
||||
isVWapHasCondition);
|
||||
|
||||
//
|
||||
if (hasXConditions)
|
||||
{
|
||||
//
|
||||
if (isX3MaHasCondition)
|
||||
{
|
||||
//
|
||||
signalBoxDir =
|
||||
isX3MaBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: isX3MaBearish
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
if (isVWapHasCondition)
|
||||
{
|
||||
//
|
||||
signalBoxDir =
|
||||
isVWapBullish
|
||||
? X_DIRECTION_BULLISH
|
||||
: isVWapBearish
|
||||
? X_DIRECTION_BEARISH
|
||||
: X_DIRECTION_NONE;
|
||||
}
|
||||
|
||||
//
|
||||
Print("X Conditions ...");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -677,285 +674,47 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
|
||||
//
|
||||
// Double Check and Prepare Signal Conditions ...
|
||||
// including Targets and SLs ...
|
||||
// Check Priority Exists ...
|
||||
hasPriority = workingZone
|
||||
.DetectPriority(
|
||||
priority,
|
||||
signalBoxDir,
|
||||
zIndex,
|
||||
period //
|
||||
);
|
||||
|
||||
//
|
||||
if (hasSelectedZone)
|
||||
// Check Price Reward and Amount Exists ...
|
||||
hasRewardAmount = CalculateRiskReward(
|
||||
priority,
|
||||
reward,
|
||||
amountPercent //
|
||||
);
|
||||
|
||||
//
|
||||
// Check Signal Conditions ...
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
int idx = -1;
|
||||
bool has = false;
|
||||
|
||||
//
|
||||
// Check Consolidation Zones for SL Handling ...
|
||||
selectedZoneDir =
|
||||
!isSelectedZoneReversal
|
||||
? selectedZone.GetDirection()
|
||||
: Opposit(selectedZone.GetDirection());
|
||||
bool isSelectedZonDirBullish = IsBullish(selectedZoneDir);
|
||||
|
||||
//
|
||||
if (isSelectedZoneReversal)
|
||||
{
|
||||
provider = X121SMC_XWZ_PROVIDER_ACTIVATED_CHOCH;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Priority ...
|
||||
hasPriority =
|
||||
hasWorkingZone &&
|
||||
workingZone
|
||||
.DetectPriority(
|
||||
priority,
|
||||
selectedZoneDir,
|
||||
zIndex,
|
||||
period //
|
||||
);
|
||||
|
||||
//
|
||||
// Calculate Risk Reward Ration based on Priority ...
|
||||
hasRewardAmount = CalculateRiskReward(
|
||||
priority,
|
||||
reward,
|
||||
amountPercent //
|
||||
XCBoxObject *iObj;
|
||||
has = drawer.DrawBox(
|
||||
signalBox,
|
||||
iObj //
|
||||
);
|
||||
|
||||
//
|
||||
// Calculate Pivot and Point ...
|
||||
|
||||
//
|
||||
pivot =
|
||||
isSelectedZonDirBullish
|
||||
? selectedZone.ob.Lower()
|
||||
: selectedZone.ob.Upper();
|
||||
|
||||
//
|
||||
point =
|
||||
isSelectedZonDirBullish
|
||||
? selectedZone.ob.Upper()
|
||||
: selectedZone.ob.Lower();
|
||||
|
||||
//
|
||||
// Detect Targets ...
|
||||
DetectSelectedZonesTargets(
|
||||
targets,
|
||||
selectedZone,
|
||||
selectedZoneDir,
|
||||
priority,
|
||||
workingZone,
|
||||
zIndex //
|
||||
);
|
||||
|
||||
//
|
||||
// Detect SLs ...
|
||||
double iAtr = decisionXConditions.atrBuffer[0];
|
||||
iAtr *= 1.5;
|
||||
|
||||
//
|
||||
// Default SL is Pivot ...
|
||||
if (pivot > 0)
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
Add(
|
||||
pivot,
|
||||
sls //
|
||||
);
|
||||
iObj.BoxWidth(1);
|
||||
iObj.BoxColor(clrYellow);
|
||||
iObj.BoxStyle(STYLE_SOLID);
|
||||
|
||||
//
|
||||
double iSL = iAtr * pivot;
|
||||
Add(
|
||||
iSL,
|
||||
sls //
|
||||
);
|
||||
Print("Signal Box Exists ...");
|
||||
}
|
||||
|
||||
//
|
||||
DetectSelectedZoneSLCandidates(
|
||||
sls,
|
||||
selectedZone,
|
||||
selectedZoneDir,
|
||||
workingZone,
|
||||
decisionXConditions,
|
||||
zIndex,
|
||||
maxAllowedSLDistanceInPoint //
|
||||
);
|
||||
|
||||
//
|
||||
// Summaries Conditions ...
|
||||
result =
|
||||
pivot > 0 &&
|
||||
point > 0 &&
|
||||
hasPriority &&
|
||||
hasRewardAmount &&
|
||||
HasDirection(selectedZoneDir);
|
||||
if (result)
|
||||
{
|
||||
//
|
||||
isBullish = IsBullish(selectedZoneDir);
|
||||
isBearish = IsBearish(selectedZoneDir);
|
||||
|
||||
//
|
||||
Copy(
|
||||
sls,
|
||||
mConditions.sls //
|
||||
);
|
||||
Copy(
|
||||
targets,
|
||||
mConditions.targets //
|
||||
);
|
||||
|
||||
//
|
||||
mConditions.pivot = pivot;
|
||||
mConditions.point = point;
|
||||
mConditions.reward = reward;
|
||||
mConditions.setupTime = cTime;
|
||||
mConditions.priority = priority;
|
||||
mConditions.provider = provider;
|
||||
mConditions.dir = selectedZoneDir;
|
||||
mConditions.signalBox = signalBox;
|
||||
mConditions.amountPercent = amountPercent;
|
||||
}
|
||||
|
||||
//
|
||||
// Cleanup Resources ...
|
||||
|
||||
//
|
||||
Clean(sls);
|
||||
Clean(targets);
|
||||
selectedZone.Clean();
|
||||
selectedConsolidationZone.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
if (hasSignalBox)
|
||||
{
|
||||
// //
|
||||
// workingZone.mInsideZoneObjects.Clear();
|
||||
// workingZone.mBreakedZoneObjects.Clear();
|
||||
// workingZone.mWaitingZoneObjects.Clear();
|
||||
// workingZone.mWorkingZoneObjects.Clear();
|
||||
|
||||
// //
|
||||
// XCBoxObject *iObj;
|
||||
// signalBox.to = cTime;
|
||||
// bool isCreated = drawer.CreateBox(
|
||||
// signalBox,
|
||||
// iObj //
|
||||
// );
|
||||
|
||||
// //
|
||||
// if (isCreated)
|
||||
// {
|
||||
// //
|
||||
// iObj.BoxWidth(2);
|
||||
// iObj.BoxColor(clrYellow);
|
||||
// iObj.BoxStyle(STYLE_SOLID);
|
||||
// }
|
||||
|
||||
// //
|
||||
// bool isSignalBoxBullishDir = signalBox.IsBullish();
|
||||
|
||||
// //
|
||||
// // Calculate Priority ...
|
||||
// hasPriority =
|
||||
// hasWorkingZone &&
|
||||
// workingZone
|
||||
// .DetectPriority(
|
||||
// priority,
|
||||
// signalBox.dir,
|
||||
// zIndex,
|
||||
// period //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Calculate Risk Reward Ration based on Priority ...
|
||||
// hasRewardAmount = CalculateRiskReward(
|
||||
// priority,
|
||||
// reward,
|
||||
// amountPercent //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Calculate Pivot and Point ...
|
||||
|
||||
// //
|
||||
// pivot =
|
||||
// isSignalBoxBullishDir
|
||||
// ? signalBox.lower
|
||||
// : signalBox.upper;
|
||||
|
||||
// //
|
||||
// point =
|
||||
// isSignalBoxBullishDir
|
||||
// ? signalBox.upper
|
||||
// : signalBox.lower;
|
||||
|
||||
// //
|
||||
// double defaultTarget =
|
||||
// isSignalBoxBullishDir
|
||||
// ? signalBox.upper
|
||||
// : signalBox.lower;
|
||||
// Add(
|
||||
// defaultTarget,
|
||||
// targets //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Detect SLs ...
|
||||
// double iAtr = decisionXConditions.atrBuffer[0];
|
||||
// iAtr *= 1.5;
|
||||
|
||||
// //
|
||||
// double defaultSL =
|
||||
// isSignalBoxBullishDir
|
||||
// ? decisionXConditions.valesBuffer[0] - iAtr
|
||||
// : decisionXConditions.peaksBuffer[0] + iAtr;
|
||||
|
||||
// //
|
||||
// Add(
|
||||
// defaultSL,
|
||||
// sls //
|
||||
// );
|
||||
|
||||
// //
|
||||
// // Summaries Conditions ...
|
||||
// result =
|
||||
// pivot > 0 &&
|
||||
// point > 0 &&
|
||||
// hasPriority &&
|
||||
// hasRewardAmount;
|
||||
// if (result)
|
||||
// {
|
||||
// //
|
||||
// isBullish = signalBox.IsBullish();
|
||||
// isBearish = signalBox.IsBearish();
|
||||
|
||||
// //
|
||||
// Copy(
|
||||
// sls,
|
||||
// mConditions.sls //
|
||||
// );
|
||||
// Copy(
|
||||
// targets,
|
||||
// mConditions.targets //
|
||||
// );
|
||||
|
||||
// //
|
||||
// mConditions.pivot = pivot;
|
||||
// mConditions.point = point;
|
||||
// mConditions.reward = reward;
|
||||
// mConditions.setupTime = cTime;
|
||||
// mConditions.priority = priority;
|
||||
// mConditions.provider = provider;
|
||||
// mConditions.dir = signalBox.dir;
|
||||
// mConditions.signalBox = signalBox;
|
||||
// mConditions.amountPercent = amountPercent;
|
||||
// }
|
||||
|
||||
// //
|
||||
// signalBox.Clean();
|
||||
// hasSignalBox = false;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -968,73 +727,18 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
workingZone.Draw(
|
||||
drawer,
|
||||
true, // Draw Waiting Zones ...
|
||||
true, // Draw Inside Zones ...
|
||||
true, // Draw Breaked Zones ...
|
||||
true, // Draw Supply Zone ...
|
||||
true, // Draw Demand Zone ...
|
||||
false, // Draw Supply Zones ...
|
||||
false, // Draw Demand Zones ...
|
||||
false, // Draw Support Zones ...
|
||||
false // Draw Resistance Zones ...
|
||||
//
|
||||
true, // Draw Waiting Boxes ...
|
||||
true, // Draw Inside Boxes ...
|
||||
true, // Draw Breaked Boxes ...
|
||||
//
|
||||
true, // Draw Supply Zone ...
|
||||
true, // Draw Demand Zone ...
|
||||
true, // Draw Supply Zones ...
|
||||
true, // Draw Demand Zones ...
|
||||
true, // Draw Support Zones ...
|
||||
true // Draw Resistance Zones ...
|
||||
);
|
||||
|
||||
//
|
||||
// XCBaseObject *objects[];
|
||||
// drawer.DrawState(
|
||||
// decisionState,
|
||||
// objects,
|
||||
// false, // DrawT icksZone ...
|
||||
// true, // Ignore SwingHighs ...
|
||||
// true, // Ignore SwingLows ...
|
||||
// true, // Ignore SupportZones ...
|
||||
// true, // Ignore ResistanceZones ...
|
||||
// true, // Ignore SupplyZones ...
|
||||
// true, // Ignore DemandZones ...
|
||||
// true, // Ignore BullishOrderBlocks ...
|
||||
// true, // Ignore BearishOrderBlocks ...
|
||||
// true, // Ignore BullishFairValueGaps ...
|
||||
// true, // Ignore BearishFairValueGaps ...
|
||||
// true, // Ignore BullishRejectionBars ...
|
||||
// true, // Ignore BearishRejectionBars ...
|
||||
// true, // Ignore BullishMomentumBars ...
|
||||
// true, // Ignore BearishMomentumBars ...
|
||||
// true, // Ignore BullishConsolidationZones ...
|
||||
// true // Ignore BearishConsolidationZones ...
|
||||
// );
|
||||
|
||||
// //
|
||||
// int count = 0;
|
||||
// bool has = false;
|
||||
|
||||
// //
|
||||
// has = workingZone.HasSupplyZones();
|
||||
// if (has)
|
||||
// {
|
||||
// }
|
||||
|
||||
// //
|
||||
// has = workingZone.HasDemandZones();
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// count = workingZone.CountDemandZones();
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XCDemandZone *iZone = workingZone.demandZones[i];
|
||||
|
||||
// //
|
||||
// XCDemandZoneObject *iObj;
|
||||
// bool isCreated = drawer.CreateDemandZone(
|
||||
// iZone,
|
||||
// iObj //
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// Print("");
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -767,7 +767,7 @@ class XCX121SMCStrategy : public XCX121SMCBaseStrategy
|
||||
|
||||
//
|
||||
// XPV ...
|
||||
x121Inputs.xpvInputs.showSar = showAll || false;
|
||||
x121Inputs.xpvInputs.showSar = showAll || true;
|
||||
x121Inputs.xpvInputs.showPeaks = showAll || true;
|
||||
x121Inputs.xpvInputs.showVales = showAll || true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user