last ...
This commit is contained in:
@@ -302,6 +302,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
X121Conditions visionXConditions = visionConditions.x121Conditions;
|
||||
|
||||
//
|
||||
// Select Drawer Class ...
|
||||
XCPOIDrawer *drawer = visionCycleHelper.mPOIDrawer;
|
||||
|
||||
//
|
||||
@@ -311,11 +312,14 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
double point = 0;
|
||||
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;
|
||||
@@ -369,6 +373,10 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
bool hasWaitingZones = hasWorkingZone &&
|
||||
workingZone.HasWaitingZones();
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Check Conditions if Has Inside Zones ...
|
||||
bool hasInsideZones = hasWorkingZone &&
|
||||
@@ -422,7 +430,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
workingZone.HasBreakedZones();
|
||||
if (hasBreakedZones)
|
||||
{
|
||||
//
|
||||
|
||||
if (!hasSelectedZone)
|
||||
{
|
||||
//
|
||||
@@ -467,12 +475,189 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
bool hasInsideBoxes = hasWorkingZone &&
|
||||
workingZone.HasInsideBoxes();
|
||||
if (hasInsideBoxes)
|
||||
{
|
||||
Print("Inside Boxes ...");
|
||||
//
|
||||
XOHCL zBar;
|
||||
XOHCL cBar;
|
||||
int count = 0;
|
||||
bool has = false;
|
||||
XBoxZone tmpSelectedBox;
|
||||
int tmpSelectedBoxIDX = -1;
|
||||
|
||||
//
|
||||
has = zBar.Init(
|
||||
symbol,
|
||||
period,
|
||||
zIndex //
|
||||
);
|
||||
has = has &&
|
||||
zBar.GetPreviousBar(cBar);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
count = workingZone.CountInsideBoxes();
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
isSignalBoxReversal = false;
|
||||
hasSignalBox = signalBox.IsValid();
|
||||
if (hasSignalBox)
|
||||
{
|
||||
//
|
||||
ArrayRemove(
|
||||
workingZone.insideBoxes,
|
||||
tmpSelectedBoxIDX,
|
||||
1 //
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
zBar.Clean();
|
||||
cBar.Clean();
|
||||
tmpSelectedBox.Clean();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -480,35 +665,17 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
workingZone.HasBreakedBoxes();
|
||||
if (hasBreakedBoxes)
|
||||
{
|
||||
Print("Breaked Boxes ...");
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Other Senario for Signals ...
|
||||
// if (!hasWaitingZones &&
|
||||
// !hasSelectedZone)
|
||||
// {
|
||||
// //
|
||||
// bool has = false;
|
||||
// ENUM_X_DIRECTION dir;
|
||||
|
||||
// //
|
||||
// has = DetectX121Conditions(
|
||||
// pivot,
|
||||
// point,
|
||||
// sls,
|
||||
// targets,
|
||||
// dir,
|
||||
// analyseState,
|
||||
// decisionState,
|
||||
// decisionXConditions,
|
||||
// drawer //
|
||||
// );
|
||||
// }
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Double Check and Prepare Signal Conditions ...
|
||||
// including Targets and SLs ...
|
||||
|
||||
//
|
||||
if (hasSelectedZone)
|
||||
{
|
||||
//
|
||||
@@ -640,7 +807,7 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
mConditions.priority = priority;
|
||||
mConditions.provider = provider;
|
||||
mConditions.dir = selectedZoneDir;
|
||||
mConditions.signalZone = selectedZone;
|
||||
mConditions.signalBox = signalBox;
|
||||
mConditions.amountPercent = amountPercent;
|
||||
}
|
||||
|
||||
@@ -654,6 +821,137 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
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;
|
||||
}
|
||||
|
||||
//
|
||||
UpdateTo(cTime);
|
||||
|
||||
@@ -664,15 +962,15 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
//
|
||||
workingZone.Draw(
|
||||
drawer,
|
||||
true, // Draw Waiting Zones ..
|
||||
true, // Draw Inside Zones ..
|
||||
false, // Draw Breaked Zones ..
|
||||
false, // Draw Supply Zone ..
|
||||
false, // Draw Demand Zone ..
|
||||
false, // Draw Supply Zones ..
|
||||
false, // Draw Demand Zones ..
|
||||
false, // Draw Support Zones ..
|
||||
false // Draw Resistance Zones ..
|
||||
true, // Draw Waiting Zones ...
|
||||
true, // Draw Inside Zones ...
|
||||
true, // Draw Breaked Zones ...
|
||||
true, // Draw Supply Zone ...
|
||||
true, // Draw Demand Zone ...
|
||||
true, // Draw Supply Zones ...
|
||||
true, // Draw Demand Zones ...
|
||||
false, // Draw Support Zones ...
|
||||
false // Draw Resistance Zones ...
|
||||
);
|
||||
|
||||
//
|
||||
@@ -698,6 +996,39 @@ class XCX121SMCXWZSignalDetector : public XCBase
|
||||
// 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("");
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -630,6 +630,16 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Price Validation ...
|
||||
has = cBar.high < tmpSupplies[i].Lower();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpSupplies[i],
|
||||
@@ -718,6 +728,16 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Price Validation ...
|
||||
has = cBar.low > tmpDemands[i].Upper();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpDemands[i],
|
||||
@@ -728,7 +748,7 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(demandZones);
|
||||
Clean(tmpDemands);
|
||||
|
||||
//
|
||||
// Support Zones ...
|
||||
@@ -806,6 +826,16 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Price Validation ...
|
||||
has = cBar.low > tmpSupports[i].Upper();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpSupports[i],
|
||||
@@ -894,6 +924,16 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Checking Price Validation ...
|
||||
has = cBar.high < tmpResistances[i].Lower();
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpResistances[i],
|
||||
@@ -909,353 +949,397 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
//
|
||||
// STF TTF ...
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
count = stfState.FilterSupplyZones(
|
||||
tmpSupplies,
|
||||
NULL,
|
||||
XZONE_STATE_PASSED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_IGNORED,
|
||||
false //
|
||||
);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = ToBox(
|
||||
iBox,
|
||||
tmpSupplies[i] //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
// //
|
||||
// // Supply Zones ...
|
||||
// count = stfState.FilterSupplyZones(
|
||||
// tmpSupplies,
|
||||
// NULL,
|
||||
// XZONE_STATE_PASSED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_IGNORED,
|
||||
// false //
|
||||
// );
|
||||
// has = IsValidSize(count);
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XBoxZone iBox;
|
||||
// has = ToBox(
|
||||
// iBox,
|
||||
// tmpSupplies[i] //
|
||||
// );
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
// Find Index ...
|
||||
// //
|
||||
// // Find Index ...
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
insideBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// insideBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
breakedBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// breakedBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
tmpSupplies[i],
|
||||
supplyZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// tmpSupplies[i],
|
||||
// supplyZones //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpSupplies[i],
|
||||
supplyZones //
|
||||
);
|
||||
// //
|
||||
// // Checking Price Validation ...
|
||||
// has = cBar.high < tmpSupplies[i].Lower();
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(tmpSupplies);
|
||||
// //
|
||||
// Add(
|
||||
// tmpSupplies[i],
|
||||
// supplyZones //
|
||||
// );
|
||||
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// }
|
||||
// }
|
||||
// Clean(tmpSupplies);
|
||||
|
||||
// //
|
||||
// // Demand Zones ...
|
||||
// count = stfState.FilterDemandZones(
|
||||
// tmpDemands,
|
||||
// NULL,
|
||||
// XZONE_STATE_PASSED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_IGNORED,
|
||||
// false //
|
||||
// );
|
||||
// has = IsValidSize(count);
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XBoxZone iBox;
|
||||
// has = ToBox(
|
||||
// iBox,
|
||||
// tmpDemands[i] //
|
||||
// );
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Find Index ...
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// insideBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// breakedBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// tmpDemands[i],
|
||||
// demandZones //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Checking Price Validation ...
|
||||
// has = cBar.low > tmpDemands[i].Upper();
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// Add(
|
||||
// tmpDemands[i],
|
||||
// demandZones //
|
||||
// );
|
||||
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// }
|
||||
// }
|
||||
// Clean(tmpDemands);
|
||||
|
||||
// //
|
||||
// // Support Zones ...
|
||||
// count = ttfState.FilterSupportZones(
|
||||
// tmpSupports,
|
||||
// period,
|
||||
// XZONE_STATE_PASSED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_IGNORED,
|
||||
// false //
|
||||
// );
|
||||
// has = IsValidSize(count);
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XBoxZone iBox;
|
||||
// has = ToBox(
|
||||
// iBox,
|
||||
// tmpSupports[i] //
|
||||
// );
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Find Index ...
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// insideBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// breakedBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// tmpSupports[i],
|
||||
// supportZones //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Checking Price Validation ...
|
||||
// has = cBar.low > tmpSupports[i].Upper();
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// Add(
|
||||
// tmpSupports[i],
|
||||
// supportZones //
|
||||
// );
|
||||
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// }
|
||||
// }
|
||||
// Clean(tmpSupports);
|
||||
|
||||
// //
|
||||
// // Resistance Zones ..
|
||||
// count = ttfState.FilterResistanceZones(
|
||||
// tmpResistances,
|
||||
// period,
|
||||
// XZONE_STATE_PASSED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_FAILED,
|
||||
// false,
|
||||
// XZONE_STATE_IGNORED,
|
||||
// false //
|
||||
// );
|
||||
// has = IsValidSize(count);
|
||||
// if (has)
|
||||
// {
|
||||
// //
|
||||
// for (int i = 0; i < count; i++)
|
||||
// {
|
||||
// //
|
||||
// XBoxZone iBox;
|
||||
// has = ToBox(
|
||||
// iBox,
|
||||
// tmpResistances[i] //
|
||||
// );
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Find Index ...
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// insideBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// iBox,
|
||||
// breakedBoxes //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// idx = FindIndex(
|
||||
// tmpResistances[i],
|
||||
// resistanceZones //
|
||||
// );
|
||||
// has = !IsValidIndex(idx);
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Checking Price Validation ...
|
||||
// has = cBar.high < tmpResistances[i].Lower();
|
||||
// if (!has)
|
||||
// {
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //
|
||||
// Add(
|
||||
// tmpResistances[i],
|
||||
// resistanceZones //
|
||||
// );
|
||||
|
||||
// //
|
||||
// iBox.Clean();
|
||||
// }
|
||||
// }
|
||||
// Clean(tmpResistances);
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
count = stfState.FilterDemandZones(
|
||||
tmpDemands,
|
||||
NULL,
|
||||
XZONE_STATE_PASSED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_IGNORED,
|
||||
false //
|
||||
);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = ToBox(
|
||||
iBox,
|
||||
tmpDemands[i] //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Index ...
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
insideBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
breakedBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
tmpDemands[i],
|
||||
demandZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpDemands[i],
|
||||
demandZones //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(demandZones);
|
||||
|
||||
//
|
||||
// Support Zones ...
|
||||
count = ttfState.FilterSupportZones(
|
||||
tmpSupports,
|
||||
period,
|
||||
XZONE_STATE_PASSED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_IGNORED,
|
||||
false //
|
||||
);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = ToBox(
|
||||
iBox,
|
||||
tmpSupports[i] //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Index ...
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
insideBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
breakedBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
tmpSupports[i],
|
||||
supportZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpSupports[i],
|
||||
supportZones //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(tmpSupports);
|
||||
|
||||
//
|
||||
// Resistance Zones ..
|
||||
count = ttfState.FilterResistanceZones(
|
||||
tmpResistances,
|
||||
period,
|
||||
XZONE_STATE_PASSED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_FAILED,
|
||||
false,
|
||||
XZONE_STATE_IGNORED,
|
||||
false //
|
||||
);
|
||||
has = IsValidSize(count);
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
XBoxZone iBox;
|
||||
has = ToBox(
|
||||
iBox,
|
||||
tmpResistances[i] //
|
||||
);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
// Find Index ...
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
insideBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
iBox,
|
||||
breakedBoxes //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
idx = FindIndex(
|
||||
tmpResistances[i],
|
||||
resistanceZones //
|
||||
);
|
||||
has = !IsValidIndex(idx);
|
||||
if (!has)
|
||||
{
|
||||
//
|
||||
iBox.Clean();
|
||||
continue;
|
||||
}
|
||||
|
||||
//
|
||||
Add(
|
||||
tmpResistances[i],
|
||||
resistanceZones //
|
||||
);
|
||||
|
||||
//
|
||||
iBox.Clean();
|
||||
}
|
||||
}
|
||||
Clean(tmpResistances);
|
||||
|
||||
//
|
||||
// Consolidation Zones ...
|
||||
@@ -2222,6 +2306,33 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zone ...
|
||||
if (drawDemandZone)
|
||||
{
|
||||
//
|
||||
has = HasDemandZone();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XCDemandZoneObject *iObj;
|
||||
isCreated = drawer.CreateDemandZone(
|
||||
demandZone,
|
||||
iObj //
|
||||
);
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
mWorkingZoneObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Supply Zones ...
|
||||
if (drawSupplyZones)
|
||||
@@ -2250,29 +2361,6 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zone ...
|
||||
if (drawDemandZone)
|
||||
{
|
||||
//
|
||||
has = HasDemandZone();
|
||||
if (has)
|
||||
{
|
||||
//
|
||||
XCDemandZoneObject *iObj;
|
||||
isCreated = drawer.CreateDemandZone(
|
||||
demandZone,
|
||||
iObj //
|
||||
);
|
||||
|
||||
//
|
||||
if (isCreated)
|
||||
{
|
||||
mWorkingZoneObjects.Add(iObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Demand Zones ...
|
||||
if (drawDemandZones)
|
||||
@@ -2357,6 +2445,10 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Waiting Zones ...
|
||||
if (drawWaitingZones)
|
||||
@@ -2503,6 +2595,10 @@ struct X121SMCStrategyXWZWorkingZone
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// Quarters ...
|
||||
has = IsValid();
|
||||
@@ -2692,7 +2788,7 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
double targets[];
|
||||
|
||||
//
|
||||
XOBFVG signalZone;
|
||||
XBoxZone signalBox;
|
||||
|
||||
//
|
||||
ENUM_X121SMC_XWZ_PRIORITY priority;
|
||||
@@ -2825,7 +2921,7 @@ struct X121SMCStrategyXWZSignalConditions
|
||||
//
|
||||
Clean(sls);
|
||||
Clean(targets);
|
||||
signalZone.Clean();
|
||||
signalBox.Clean();
|
||||
|
||||
//
|
||||
provider = X121SMC_XWZ_PROVIDER_NONE;
|
||||
@@ -3107,7 +3203,7 @@ bool DetectSelectedZoneConditions(
|
||||
*
|
||||
* @return ( bool )
|
||||
*/
|
||||
bool DetectSelectedZoneConditions(
|
||||
bool DetectSelectedBoxConditions(
|
||||
bool &isReversal,
|
||||
XBoxZone &zone,
|
||||
XPOIState &state,
|
||||
|
||||
Reference in New Issue
Block a user